Browse Source

Adds SIP calls support

j8
hristoterezov 9 years ago
parent
commit
e494c3028d
3 changed files with 25 additions and 10 deletions
  1. 5
    8
      app.js
  2. 19
    1
      libs/lib-jitsi-meet.js
  3. 1
    1
      modules/UI/toolbars/Toolbar.js

+ 5
- 8
app.js View File

86
             membersCount: 0,
86
             membersCount: 0,
87
             audioMuted: false,
87
             audioMuted: false,
88
             videoMuted: false,
88
             videoMuted: false,
89
-            sipGatewayEnabled: false, //FIXME handle
90
             isLocalId (id) {
89
             isLocalId (id) {
91
                 return this.localId === id;
90
                 return this.localId === id;
92
             },
91
             },
186
         APP.UI.addLocalStream(track);
185
         APP.UI.addLocalStream(track);
187
     };
186
     };
188
 
187
 
188
+    APP.conference.sipGatewayEnabled = () => {
189
+        return room.isSIPCallingSupported();
190
+    };
191
+
189
     function getDisplayName(id) {
192
     function getDisplayName(id) {
190
         if (APP.conference.isLocalId(id)) {
193
         if (APP.conference.isLocalId(id)) {
191
             return APP.settings.getDisplayName();
194
             return APP.settings.getDisplayName();
442
     });
445
     });
443
 
446
 
444
     APP.UI.addListener(UIEvents.SIP_DIAL, function (sipNumber) {
447
     APP.UI.addListener(UIEvents.SIP_DIAL, function (sipNumber) {
445
-        // FIXME add dial
446
-        // APP.xmpp.dial(
447
-        //     sipNumber,
448
-        //     'fromnumber',
449
-        //     APP.conference.roomName,
450
-        //     roomLocker.password
451
-        // );
448
+        room.dial(sipNumber);
452
     });
449
     });
453
 
450
 
454
 
451
 

+ 19
- 1
libs/lib-jitsi-meet.js View File

579
         reject(new Error("The conference is not created yet!"))});
579
         reject(new Error("The conference is not created yet!"))});
580
 }
580
 }
581
 
581
 
582
+/**
583
+ * Returns true if the SIP calls are supported and false otherwise
584
+ */
585
+JitsiConference.prototype.isSIPCallingSupported = function () {
586
+    if(this.room)
587
+        return this.room.isSIPCallingSupported();
588
+    return false;
589
+}
590
+
582
 /**
591
 /**
583
  * Dials a number.
592
  * Dials a number.
584
  * @param number the number
593
  * @param number the number
6753
         reject(new Error("The conference is not created yet!"))});
6762
         reject(new Error("The conference is not created yet!"))});
6754
 }
6763
 }
6755
 
6764
 
6765
+/**
6766
+ * Returns true if the SIP calls are supported and false otherwise
6767
+ */
6768
+ChatRoom.prototype.isSIPCallingSupported = function () {
6769
+    if(this.moderator)
6770
+        return this.moderator.isSipGatewayEnabled();
6771
+    return false;
6772
+}
6773
+
6756
 /**
6774
 /**
6757
  * Dials a number.
6775
  * Dials a number.
6758
  * @param number the number
6776
  * @param number the number
10552
     // Sip gateway can be enabled by configuring Jigasi host in config.js or
10570
     // Sip gateway can be enabled by configuring Jigasi host in config.js or
10553
     // it will be enabled automatically if focus detects the component through
10571
     // it will be enabled automatically if focus detects the component through
10554
     // service discovery.
10572
     // service discovery.
10555
-    this.sipGatewayEnabled =
10573
+    this.sipGatewayEnabled = this.xmppService.options.hosts &&
10556
         this.xmppService.options.hosts.call_control !== undefined;
10574
         this.xmppService.options.hosts.call_control !== undefined;
10557
 
10575
 
10558
     this.eventEmitter = emitter;
10576
     this.eventEmitter = emitter;

+ 1
- 1
modules/UI/toolbars/Toolbar.js View File

311
 
311
 
312
     // Shows or hides SIP calls button
312
     // Shows or hides SIP calls button
313
     showSipCallButton (show) {
313
     showSipCallButton (show) {
314
-        if (APP.conference.sipGatewayEnabled && UIUtil.isButtonEnabled('sip') && show) {
314
+        if (APP.conference.sipGatewayEnabled() && UIUtil.isButtonEnabled('sip') && show) {
315
             $('#toolbar_button_sip').css({display: "inline-block"});
315
             $('#toolbar_button_sip').css({display: "inline-block"});
316
         } else {
316
         } else {
317
             $('#toolbar_button_sip').css({display: "none"});
317
             $('#toolbar_button_sip').css({display: "none"});

Loading…
Cancel
Save