浏览代码

fix(conference): fire failed event on o/a failure

release-8443
Hristo Terezov 6 年前
父节点
当前提交
ee1854c1b1
共有 4 个文件被更改,包括 40 次插入58 次删除
  1. 2
    2
      JitsiConferenceErrors.js
  2. 23
    20
      JitsiConferenceEventManager.js
  3. 10
    19
      modules/xmpp/JingleSessionPC.js
  4. 5
    17
      service/xmpp/XMPPEvents.js

+ 2
- 2
JitsiConferenceErrors.js 查看文件

@@ -56,9 +56,9 @@ export const INCOMPATIBLE_SERVER_VERSIONS
56 56
     = 'conference.incompatible_server_versions';
57 57
 
58 58
 /**
59
- * Indicates that jingle fatal error happened.
59
+ * Indicates that offer/answer had failed.
60 60
  */
61
-export const JINGLE_FATAL_ERROR = 'conference.jingleFatalError';
61
+export const OFFER_ANSWER_FAILED = 'conference.offerAnswerFailed';
62 62
 
63 63
 /**
64 64
  * Indicates that password cannot be set for this conference.

+ 23
- 20
JitsiConferenceEventManager.js 查看文件

@@ -142,6 +142,13 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
142 142
             });
143 143
         });
144 144
 
145
+    chatRoom.addListener(XMPPEvents.RENEGOTIATION_FAILED, (e, session) => {
146
+        if (!session.isP2P) {
147
+            conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
148
+                JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
149
+        }
150
+    });
151
+
145 152
     this.chatRoomForwarder.forward(XMPPEvents.ROOM_JOIN_ERROR,
146 153
         JitsiConferenceEvents.CONFERENCE_FAILED,
147 154
         JitsiConferenceErrors.CONNECTION_ERROR);
@@ -180,15 +187,6 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
180 187
         JitsiConferenceEvents.CONFERENCE_FAILED,
181 188
         JitsiConferenceErrors.GRACEFUL_SHUTDOWN);
182 189
 
183
-    chatRoom.addListener(XMPPEvents.JINGLE_FATAL_ERROR,
184
-        (session, error) => {
185
-            if (!session.isP2P) {
186
-                conference.eventEmitter.emit(
187
-                    JitsiConferenceEvents.CONFERENCE_FAILED,
188
-                    JitsiConferenceErrors.JINGLE_FATAL_ERROR, error);
189
-            }
190
-        });
191
-
192 190
     chatRoom.addListener(XMPPEvents.CONNECTION_ICE_FAILED,
193 191
         jingleSession => {
194 192
             conference._onIceConnectionFailed(jingleSession);
@@ -238,17 +236,6 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function() {
238 236
     this.chatRoomForwarder.forward(XMPPEvents.PHONE_NUMBER_CHANGED,
239 237
         JitsiConferenceEvents.PHONE_NUMBER_CHANGED);
240 238
 
241
-    chatRoom.addListener(
242
-        XMPPEvents.CONFERENCE_SETUP_FAILED,
243
-        (jingleSession, error) => {
244
-            if (!jingleSession.isP2P) {
245
-                conference.eventEmitter.emit(
246
-                    JitsiConferenceEvents.CONFERENCE_FAILED,
247
-                    JitsiConferenceErrors.SETUP_FAILED,
248
-                    error);
249
-            }
250
-        });
251
-
252 239
     chatRoom.setParticipantPropertyListener((node, from) => {
253 240
         const participant = conference.getParticipantById(from);
254 241
 
@@ -503,21 +490,37 @@ JitsiConferenceEventManager.prototype.setupRTCListeners = function() {
503 490
     rtc.addListener(RTCEvents.CREATE_ANSWER_FAILED,
504 491
         (e, tpc) => {
505 492
             conference.statistics.sendCreateAnswerFailed(e, tpc);
493
+            if (!tpc.isP2P) {
494
+                conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
495
+                    JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
496
+            }
506 497
         });
507 498
 
508 499
     rtc.addListener(RTCEvents.CREATE_OFFER_FAILED,
509 500
         (e, tpc) => {
510 501
             conference.statistics.sendCreateOfferFailed(e, tpc);
502
+            if (!tpc.isP2P) {
503
+                conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
504
+                    JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
505
+            }
511 506
         });
512 507
 
513 508
     rtc.addListener(RTCEvents.SET_LOCAL_DESCRIPTION_FAILED,
514 509
         (e, tpc) => {
515 510
             conference.statistics.sendSetLocalDescFailed(e, tpc);
511
+            if (!tpc.isP2P) {
512
+                conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
513
+                    JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
514
+            }
516 515
         });
517 516
 
518 517
     rtc.addListener(RTCEvents.SET_REMOTE_DESCRIPTION_FAILED,
519 518
         (e, tpc) => {
520 519
             conference.statistics.sendSetRemoteDescFailed(e, tpc);
520
+            if (!tpc.isP2P) {
521
+                conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED,
522
+                    JitsiConferenceErrors.OFFER_ANSWER_FAILED, e);
523
+            }
521 524
         });
522 525
 
523 526
     rtc.addListener(RTCEvents.LOCAL_TRACK_SSRC_UPDATED,

+ 10
- 19
modules/xmpp/JingleSessionPC.js 查看文件

@@ -1012,7 +1012,6 @@ export default class JingleSessionPC extends JingleSession {
1012 1012
                             this.isInitiator ? 'answer: ' : 'offer: '}${error}`,
1013 1013
                         newRemoteSdp);
1014 1014
 
1015
-                    this._onJingleFatalError(error);
1016 1015
                     finishedCallback(error);
1017 1016
                 });
1018 1017
         };
@@ -1584,16 +1583,22 @@ export default class JingleSessionPC extends JingleSession {
1584 1583
      */
1585 1584
     _renegotiate(optionalRemoteSdp) {
1586 1585
         if (this.peerconnection.signalingState === 'closed') {
1587
-            return Promise.reject('Attempted to renegotiate in state closed');
1586
+            const error = new Error('Attempted to renegotiate in state closed');
1587
+
1588
+            this.room.eventEmitter.emit(XMPPEvents.RENEGOTIATION_FAILED, error, this);
1589
+
1590
+            return Promise.reject(error);
1588 1591
         }
1589 1592
 
1590 1593
         const remoteSdp
1591 1594
             = optionalRemoteSdp || this.peerconnection.remoteDescription.sdp;
1592 1595
 
1593 1596
         if (!remoteSdp) {
1594
-            return Promise.reject(
1595
-                'Can not renegotiate without remote description,'
1596
-                    + `- current state: ${this.state}`);
1597
+            const error = new Error(`Can not renegotiate without remote description, current state: ${this.state}`);
1598
+
1599
+            this.room.eventEmitter.emit(XMPPEvents.RENEGOTIATION_FAILED, error, this);
1600
+
1601
+            return Promise.reject(error);
1597 1602
         }
1598 1603
 
1599 1604
         const remoteDescription = new RTCSessionDescription({
@@ -2234,20 +2239,6 @@ export default class JingleSessionPC extends JingleSession {
2234 2239
         };
2235 2240
     }
2236 2241
 
2237
-    /**
2238
-     *
2239
-     * @param error
2240
-     * @private
2241
-     */
2242
-    _onJingleFatalError(error) {
2243
-        if (this.room) {
2244
-            this.room.eventEmitter.emit(
2245
-                XMPPEvents.CONFERENCE_SETUP_FAILED, this, error);
2246
-            this.room.eventEmitter.emit(
2247
-                XMPPEvents.JINGLE_FATAL_ERROR, this, error);
2248
-        }
2249
-    }
2250
-
2251 2242
     /**
2252 2243
      * Returns the ice connection state for the peer connection.
2253 2244
      * @returns the ice connection state for the peer connection.

+ 5
- 17
service/xmpp/XMPPEvents.js 查看文件

@@ -29,8 +29,6 @@ const XMPPEvents = {
29 29
     // The conference properties (as advertised by jicofo) have changed
30 30
     CONFERENCE_PROPERTIES_CHANGED: 'xmpp.conference_properties_changed',
31 31
 
32
-    CONFERENCE_SETUP_FAILED: 'xmpp.conference_setup_failed',
33
-
34 32
     /**
35 33
      * This event is triggered when the ICE connects for the first time.
36 34
      */
@@ -87,21 +85,6 @@ const XMPPEvents = {
87 85
      */
88 86
     ICE_RESTART_SUCCESS: 'rtc.ice_restart_success',
89 87
 
90
-    /* Event fired when XMPP error is returned to any request, it is meant to be
91
-     * used to report 'signaling' errors to CallStats
92
-     *
93
-     * {
94
-     *   code: {XMPP error code}
95
-     *   reason: {XMPP error condition}
96
-     *   source = request.tree()
97
-     *   session = {JingleSession instance}
98
-     * }
99
-     */
100
-    JINGLE_ERROR: 'xmpp.jingle_error',
101
-
102
-    // Event fired when we have failed to set initial offer
103
-    JINGLE_FATAL_ERROR: 'xmpp.jingle_fatal_error',
104
-
105 88
     /**
106 89
      * Designates an event indicating that we were kicked from the XMPP MUC.
107 90
      * @param {boolean} isSelfPresence - whether it is for local participant
@@ -189,6 +172,11 @@ const XMPPEvents = {
189 172
     // Designates an event indicating that we received statistics from a
190 173
     // participant in the MUC.
191 174
     REMOTE_STATS: 'xmpp.remote_stats',
175
+
176
+    /**
177
+     * Indicates that the offer / answer renegotiation has failed.
178
+     */
179
+    RENEGOTIATION_FAILED: 'xmpp.renegotiation_failed',
192 180
     RESERVATION_ERROR: 'xmpp.room_reservation_error',
193 181
     ROOM_CONNECT_ERROR: 'xmpp.room_connect_error',
194 182
     ROOM_CONNECT_NOT_ALLOWED_ERROR: 'xmpp.room_connect_error.not_allowed',

正在加载...
取消
保存