Browse Source

Adds isSIPCallingSupported method to the conference

master
hristoterezov 9 years ago
parent
commit
aaefe38c1e
4 changed files with 137 additions and 2 deletions
  1. 108
    0
      JitsiConference.js
  2. 19
    1
      lib-jitsi-meet.js
  3. 9
    0
      modules/xmpp/ChatRoom.js
  4. 1
    1
      modules/xmpp/moderator.js

+ 108
- 0
JitsiConference.js View File

@@ -538,6 +538,103 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) {
538 538
     this.dtmfManager.sendTones(tones, duration, pause);
539 539
 };
540 540
 
541
+/**
542
+ * Returns true if the recording is supproted and false if not.
543
+ */
544
+JitsiConference.prototype.isRecordingSupported = function () {
545
+    if(this.room)
546
+        return this.room.isRecordingSupported();
547
+    return false;
548
+};
549
+
550
+/**
551
+ * Returns null if the recording is not supported, "on" if the recording started
552
+ * and "off" if the recording is not started.
553
+ */
554
+JitsiConference.prototype.getRecordingState = function () {
555
+    if(this.room)
556
+        return this.room.getRecordingState();
557
+    return "off";
558
+}
559
+
560
+/**
561
+ * Returns the url of the recorded video.
562
+ */
563
+JitsiConference.prototype.getRecordingURL = function () {
564
+    if(this.room)
565
+        return this.room.getRecordingURL();
566
+    return null;
567
+}
568
+
569
+/**
570
+ * Starts/stops the recording
571
+ * @param token a token for authentication.
572
+ */
573
+JitsiConference.prototype.toggleRecording = function (token, followEntity) {
574
+    if(this.room)
575
+        return this.room.toggleRecording(token, followEntity);
576
+    return new Promise(function(resolve, reject){
577
+        reject(new Error("The conference is not created yet!"))});
578
+}
579
+
580
+/**
581
+ * Returns true if the SIP calls are supported and false otherwise
582
+ */
583
+JitsiConference.prototype.isSIPCallingSupported = function () {
584
+    if(this.room)
585
+        return this.room.isSIPCallingSupported();
586
+    return false;
587
+}
588
+
589
+/**
590
+ * Dials a number.
591
+ * @param number the number
592
+ */
593
+JitsiConference.prototype.dial = function (number) {
594
+    if(this.room)
595
+        return this.room.dial(number);
596
+    return new Promise(function(resolve, reject){
597
+        reject(new Error("The conference is not created yet!"))});
598
+}
599
+
600
+/**
601
+ * Hangup an existing call
602
+ */
603
+JitsiConference.prototype.hangup = function () {
604
+    if(this.room)
605
+        return this.room.hangup();
606
+    return new Promise(function(resolve, reject){
607
+        reject(new Error("The conference is not created yet!"))});
608
+}
609
+
610
+/**
611
+ * Returns the phone number for joining the conference.
612
+ */
613
+JitsiConference.prototype.getPhoneNumber = function () {
614
+    if(this.room)
615
+        return this.room.getPhoneNumber();
616
+    return null;
617
+}
618
+
619
+/**
620
+ * Returns the pin for joining the conference with phone.
621
+ */
622
+JitsiConference.prototype.getPhonePin = function () {
623
+    if(this.room)
624
+        return this.room.getPhonePin();
625
+    return null;
626
+}
627
+
628
+/**
629
+ * Returns the connection state for the current room. Its ice connection state
630
+ * for its session.
631
+ */
632
+JitsiConference.prototype.getConnectionState = function () {
633
+    if(this.room)
634
+        return this.room.getConnectionState();
635
+    return null;
636
+}
637
+
541 638
 /**
542 639
  * Setups the listeners needed for the conference.
543 640
  * @param conference the conference
@@ -596,6 +693,17 @@ function setupListeners(conference) {
596 693
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
597 694
     });
598 695
 
696
+    conference.room.addListener(XMPPEvents.RECORDING_STATE_CHANGED,
697
+        function () {
698
+            conference.eventEmitter.emit(
699
+                JitsiConferenceEvents.RECORDING_STATE_CHANGED);
700
+        });
701
+
702
+    conference.room.addListener(XMPPEvents.PHONE_NUMBER_CHANGED, function () {
703
+        conference.eventEmitter.emit(
704
+            JitsiConferenceEvents.PHONE_NUMBER_CHANGED);
705
+    });
706
+
599 707
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
600 708
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);
601 709
     });

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

@@ -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;

+ 9
- 0
modules/xmpp/ChatRoom.js View File

@@ -706,6 +706,15 @@ ChatRoom.prototype.toggleRecording = function (token, followEntity) {
706 706
         reject(new Error("The conference is not created yet!"))});
707 707
 }
708 708
 
709
+/**
710
+ * Returns true if the SIP calls are supported and false otherwise
711
+ */
712
+ChatRoom.prototype.isSIPCallingSupported = function () {
713
+    if(this.moderator)
714
+        return this.moderator.isSipGatewayEnabled();
715
+    return false;
716
+}
717
+
709 718
 /**
710 719
  * Dials a number.
711 720
  * @param number the number

+ 1
- 1
modules/xmpp/moderator.js View File

@@ -38,7 +38,7 @@ function Moderator(roomName, xmpp, emitter) {
38 38
     // Sip gateway can be enabled by configuring Jigasi host in config.js or
39 39
     // it will be enabled automatically if focus detects the component through
40 40
     // service discovery.
41
-    this.sipGatewayEnabled =
41
+    this.sipGatewayEnabled = this.xmppService.options.hosts &&
42 42
         this.xmppService.options.hosts.call_control !== undefined;
43 43
 
44 44
     this.eventEmitter = emitter;

Loading…
Cancel
Save