浏览代码

Improves SIP gateway auto configuration by getting feedback from the focus.

master
paweldomas 10 年前
父节点
当前提交
c76b78eb46
共有 2 个文件被更改,包括 27 次插入1 次删除
  1. 26
    0
      moderator.js
  2. 1
    1
      toolbar.js

+ 26
- 0
moderator.js 查看文件

@@ -11,6 +11,10 @@ var Moderator = (function (my) {
11 11
     var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
12 12
     // External authentication stuff
13 13
     var externalAuthEnabled = false;
14
+    // Sip gateway can be enabled by configuring Jigasi host in config.js or
15
+    // it will be enabled automatically if focus detects the component through
16
+    // service discovery.
17
+    var sipGatewayEnabled = config.hosts.call_control !== undefined;
14 18
 
15 19
     my.isModerator = function () {
16 20
         return connection.emuc.isModerator();
@@ -24,6 +28,10 @@ var Moderator = (function (my) {
24 28
         return externalAuthEnabled;
25 29
     };
26 30
 
31
+    my.isSipGatewayEnabled = function () {
32
+        return sipGatewayEnabled;
33
+    };
34
+
27 35
     my.onModeratorStatusChanged = function (isModerator) {
28 36
 
29 37
         Toolbar.showSipCallButton(isModerator);
@@ -99,6 +107,14 @@ var Moderator = (function (my) {
99 107
                 { name: 'bridge', value: config.hosts.bridge})
100 108
                 .up();
101 109
         }
110
+        // Tell the focus we have Jigasi configured
111
+        if (config.hosts.call_control !== undefined)
112
+        {
113
+            elem.c(
114
+                'property',
115
+                { name: 'call_control', value: config.hosts.call_control})
116
+                .up();
117
+        }
102 118
         if (config.channelLastN !== undefined)
103 119
         {
104 120
             elem.c(
@@ -148,7 +164,17 @@ var Moderator = (function (my) {
148 164
         if (extAuthParam.length) {
149 165
             externalAuthEnabled = extAuthParam.attr('value') === 'true';
150 166
         }
167
+
151 168
         console.info("External authentication enabled: " + externalAuthEnabled);
169
+
170
+        // Check if focus has auto-detected Jigasi component(this will be also
171
+        // included if we have passed our host from the config)
172
+        if ($(resultIq).find(
173
+                '>conference>property[name=\'sipGatewayEnabled\']').length) {
174
+            sipGatewayEnabled = true;
175
+        }
176
+
177
+        console.info("Sip gateway enabled: " + sipGatewayEnabled);
152 178
     };
153 179
 
154 180
     // FIXME: we need to show the fact that we're waiting for the focus

+ 1
- 1
toolbar.js 查看文件

@@ -265,7 +265,7 @@ var Toolbar = (function (my) {
265 265
 
266 266
     // Shows or hides SIP calls button
267 267
     my.showSipCallButton = function (show) {
268
-        if (config.hosts.call_control && show) {
268
+        if (Moderator.isSipGatewayEnabled() && show) {
269 269
             $('#sipCallButton').css({display: "inline"});
270 270
         } else {
271 271
             $('#sipCallButton').css({display: "none"});

正在加载...
取消
保存