Browse Source

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

master
paweldomas 10 years ago
parent
commit
c76b78eb46
2 changed files with 27 additions and 1 deletions
  1. 26
    0
      moderator.js
  2. 1
    1
      toolbar.js

+ 26
- 0
moderator.js View File

11
     var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
11
     var getNextErrorTimeout = Util.createExpBackoffTimer(1000);
12
     // External authentication stuff
12
     // External authentication stuff
13
     var externalAuthEnabled = false;
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
     my.isModerator = function () {
19
     my.isModerator = function () {
16
         return connection.emuc.isModerator();
20
         return connection.emuc.isModerator();
24
         return externalAuthEnabled;
28
         return externalAuthEnabled;
25
     };
29
     };
26
 
30
 
31
+    my.isSipGatewayEnabled = function () {
32
+        return sipGatewayEnabled;
33
+    };
34
+
27
     my.onModeratorStatusChanged = function (isModerator) {
35
     my.onModeratorStatusChanged = function (isModerator) {
28
 
36
 
29
         Toolbar.showSipCallButton(isModerator);
37
         Toolbar.showSipCallButton(isModerator);
99
                 { name: 'bridge', value: config.hosts.bridge})
107
                 { name: 'bridge', value: config.hosts.bridge})
100
                 .up();
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
         if (config.channelLastN !== undefined)
118
         if (config.channelLastN !== undefined)
103
         {
119
         {
104
             elem.c(
120
             elem.c(
148
         if (extAuthParam.length) {
164
         if (extAuthParam.length) {
149
             externalAuthEnabled = extAuthParam.attr('value') === 'true';
165
             externalAuthEnabled = extAuthParam.attr('value') === 'true';
150
         }
166
         }
167
+
151
         console.info("External authentication enabled: " + externalAuthEnabled);
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
     // FIXME: we need to show the fact that we're waiting for the focus
180
     // FIXME: we need to show the fact that we're waiting for the focus

+ 1
- 1
toolbar.js View File

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

Loading…
Cancel
Save