Przeglądaj źródła

Adds SIP calls support

j8
hristoterezov 9 lat temu
rodzic
commit
e494c3028d
3 zmienionych plików z 25 dodań i 10 usunięć
  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 Wyświetl plik

@@ -86,7 +86,6 @@ const APP = {
86 86
             membersCount: 0,
87 87
             audioMuted: false,
88 88
             videoMuted: false,
89
-            sipGatewayEnabled: false, //FIXME handle
90 89
             isLocalId (id) {
91 90
                 return this.localId === id;
92 91
             },
@@ -186,6 +185,10 @@ function initConference(localTracks, connection) {
186 185
         APP.UI.addLocalStream(track);
187 186
     };
188 187
 
188
+    APP.conference.sipGatewayEnabled = () => {
189
+        return room.isSIPCallingSupported();
190
+    };
191
+
189 192
     function getDisplayName(id) {
190 193
         if (APP.conference.isLocalId(id)) {
191 194
             return APP.settings.getDisplayName();
@@ -442,13 +445,7 @@ function initConference(localTracks, connection) {
442 445
     });
443 446
 
444 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 Wyświetl plik

@@ -579,6 +579,15 @@ JitsiConference.prototype.toggleRecording = function (token, followEntity) {
579 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 592
  * Dials a number.
584 593
  * @param number the number
@@ -6753,6 +6762,15 @@ ChatRoom.prototype.toggleRecording = function (token, followEntity) {
6753 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 6775
  * Dials a number.
6758 6776
  * @param number the number
@@ -10552,7 +10570,7 @@ function Moderator(roomName, xmpp, emitter) {
10552 10570
     // Sip gateway can be enabled by configuring Jigasi host in config.js or
10553 10571
     // it will be enabled automatically if focus detects the component through
10554 10572
     // service discovery.
10555
-    this.sipGatewayEnabled =
10573
+    this.sipGatewayEnabled = this.xmppService.options.hosts &&
10556 10574
         this.xmppService.options.hosts.call_control !== undefined;
10557 10575
 
10558 10576
     this.eventEmitter = emitter;

+ 1
- 1
modules/UI/toolbars/Toolbar.js Wyświetl plik

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

Ładowanie…
Anuluj
Zapisz