Procházet zdrojové kódy

feat(XMPPEvents): add CALL_ENDED event

The event is triggered when Jicofo sends 'session-terminate' and our
PeerConnection is closed.
master
paweldomas před 9 roky
rodič
revize
a51feba392

+ 15
- 1
JitsiConference.js Zobrazit soubor

@@ -852,7 +852,21 @@ function (jingleSession, jingleOffer, now) {
852 852
     // both camera and microphone.
853 853
     this.statistics.startCallStats(jingleSession, this.settings);
854 854
     this.statistics.startRemoteStats(jingleSession.peerconnection);
855
-}
855
+};
856
+
857
+/**
858
+ * Handles the call ended event.
859
+ * @param {JingleSessionPC} JingleSession the jingle session which has been
860
+ * terminated.
861
+ * @param {String} reasonCondition the Jingle reason condition.
862
+ * @param {String|null} reasonText human readable reason text which may provide
863
+ * more details about why the call has been terminated.
864
+ */
865
+JitsiConference.prototype.onCallEnded
866
+= function (JingleSession, reasonCondition, reasonText) {
867
+    logger.info("Call ended: " + reasonCondition + " - " + reasonText);
868
+};
869
+
856 870
 
857 871
 JitsiConference.prototype.updateDTMFSupport = function () {
858 872
     var somebodySupportsDTMF = false;

+ 2
- 0
JitsiConferenceEventManager.js Zobrazit soubor

@@ -487,6 +487,8 @@ JitsiConferenceEventManager.prototype.setupXMPPListeners = function () {
487 487
     var conference = this.conference;
488 488
     conference.xmpp.addListener(
489 489
         XMPPEvents.CALL_INCOMING, conference.onIncomingCall.bind(conference));
490
+    conference.xmpp.addListener(
491
+        XMPPEvents.CALL_ENDED, conference.onCallEnded.bind(conference));
490 492
 
491 493
     conference.xmpp.addListener(XMPPEvents.START_MUTED_FROM_FOCUS,
492 494
         function (audioMuted, videoMuted) {

+ 2
- 0
modules/xmpp/strophe.jingle.js Zobrazit soubor

@@ -114,6 +114,8 @@ module.exports = function(XMPP, eventEmitter) {
114 114
                         reasonText = $(iq).find('>jingle>reason>text').text();
115 115
                     }
116 116
                     this.terminate(sess.sid, reasonCondition, reasonText);
117
+                    eventEmitter.emit(XMPPEvents.CALL_ENDED,
118
+                        sess, reasonCondition, reasonText);
117 119
                     break;
118 120
                 case 'transport-replace':
119 121
                     var now = window.performance.now();

+ 5
- 0
service/xmpp/XMPPEvents.js Zobrazit soubor

@@ -11,6 +11,11 @@ var XMPPEvents = {
11 11
     // Designates an event indicating that an offer (e.g. Jingle
12 12
     // session-initiate) was received.
13 13
     CALL_INCOMING: "xmpp.callincoming.jingle",
14
+    // Triggered when Jicofo kills our media session, this can happen while
15
+    // we're still in the MUC, when it decides to terminate the media session.
16
+    // For example when the session is idle for too long, because we're the only
17
+    // person in the conference room.
18
+    CALL_ENDED: "xmpp.callended.jingle",
14 19
     CHAT_ERROR_RECEIVED: "xmpp.chat_error_received",
15 20
     CONFERENCE_SETUP_FAILED: "xmpp.conference_setup_failed",
16 21
     // Designates an event indicating that the connection to the XMPP server

Načítá se…
Zrušit
Uložit