|
|
@@ -57,6 +57,11 @@ function JitsiConference(options) {
|
|
57
|
57
|
};
|
|
58
|
58
|
this.isMutedByFocus = false;
|
|
59
|
59
|
this.reportedAudioSSRCs = {};
|
|
|
60
|
+ // Flag indicates if the 'onCallEnded' method was ever called on this
|
|
|
61
|
+ // instance. Used to log extra analytics event for debugging purpose.
|
|
|
62
|
+ // We need to know if the potential issue happened before or after
|
|
|
63
|
+ // the restart.
|
|
|
64
|
+ this.wasStopped = false;
|
|
60
|
65
|
}
|
|
61
|
66
|
|
|
62
|
67
|
/**
|
|
|
@@ -786,6 +791,10 @@ function (jingleSession, jingleOffer, now) {
|
|
786
|
791
|
// Accept incoming call
|
|
787
|
792
|
this.room.setJingleSession(jingleSession);
|
|
788
|
793
|
this.room.connectionTimes["session.initiate"] = now;
|
|
|
794
|
+ // Log "session.restart"
|
|
|
795
|
+ if (this.wasStopped) {
|
|
|
796
|
+ Statistics.sendEventToAll("session.restart");
|
|
|
797
|
+ }
|
|
789
|
798
|
// add info whether call is cross-region
|
|
790
|
799
|
var crossRegion = null;
|
|
791
|
800
|
if (window.jitsiRegionInfo)
|
|
|
@@ -852,7 +861,48 @@ function (jingleSession, jingleOffer, now) {
|
|
852
|
861
|
// both camera and microphone.
|
|
853
|
862
|
this.statistics.startCallStats(jingleSession, this.settings);
|
|
854
|
863
|
this.statistics.startRemoteStats(jingleSession.peerconnection);
|
|
855
|
|
-}
|
|
|
864
|
+};
|
|
|
865
|
+
|
|
|
866
|
+/**
|
|
|
867
|
+ * Handles the call ended event.
|
|
|
868
|
+ * @param {JingleSessionPC} JingleSession the jingle session which has been
|
|
|
869
|
+ * terminated.
|
|
|
870
|
+ * @param {String} reasonCondition the Jingle reason condition.
|
|
|
871
|
+ * @param {String|null} reasonText human readable reason text which may provide
|
|
|
872
|
+ * more details about why the call has been terminated.
|
|
|
873
|
+ */
|
|
|
874
|
+JitsiConference.prototype.onCallEnded
|
|
|
875
|
+= function (JingleSession, reasonCondition, reasonText) {
|
|
|
876
|
+ logger.info("Call ended: " + reasonCondition + " - " + reasonText);
|
|
|
877
|
+ this.wasStopped = true;
|
|
|
878
|
+ // Send session.terminate event
|
|
|
879
|
+ Statistics.sendEventToAll("session.terminate");
|
|
|
880
|
+ // Stop the stats
|
|
|
881
|
+ if (this.statistics) {
|
|
|
882
|
+ this.statistics.stopRemoteStats();
|
|
|
883
|
+ this.statistics.stopCallStats();
|
|
|
884
|
+ }
|
|
|
885
|
+ // Current JingleSession is invalid so set it to null on the room
|
|
|
886
|
+ this.room.setJingleSession(null);
|
|
|
887
|
+ // Let the RTC service do any cleanups
|
|
|
888
|
+ this.rtc.onCallEnded();
|
|
|
889
|
+ // PeerConnection has been closed which means that SSRCs stored in
|
|
|
890
|
+ // JitsiLocalTrack will not match those assigned by the old PeerConnection
|
|
|
891
|
+ // and SSRC replacement logic will not work as expected.
|
|
|
892
|
+ // We want to re-register 'ssrcHandler' of our local tracks, so that they
|
|
|
893
|
+ // will learn what their SSRC from the new PeerConnection which will be
|
|
|
894
|
+ // created on incoming call event.
|
|
|
895
|
+ var self = this;
|
|
|
896
|
+ this.rtc.localTracks.forEach(function(localTrack) {
|
|
|
897
|
+ // Reset SSRC as it will no longer be valid
|
|
|
898
|
+ localTrack._setSSRC(null);
|
|
|
899
|
+ // Bind the handler to fetch new SSRC, it will un register itself once
|
|
|
900
|
+ // it reads the values
|
|
|
901
|
+ self.room.addListener(
|
|
|
902
|
+ XMPPEvents.SENDRECV_STREAMS_CHANGED, localTrack.ssrcHandler);
|
|
|
903
|
+ });
|
|
|
904
|
+};
|
|
|
905
|
+
|
|
856
|
906
|
|
|
857
|
907
|
JitsiConference.prototype.updateDTMFSupport = function () {
|
|
858
|
908
|
var somebodySupportsDTMF = false;
|