Преглед на файлове

Returns 'error' response when incoming jingle session has not been accepted instead of sending session-terminate later on.

dev1
paweldomas преди 9 години
родител
ревизия
1723c46a71
променени са 3 файла, в които са добавени 20 реда и са изтрити 4 реда
  1. 0
    1
      JitsiConference.js
  2. 2
    1
      modules/xmpp/JingleSessionPC.js
  3. 18
    2
      modules/xmpp/strophe.jingle.js

+ 0
- 1
JitsiConference.js Целия файл

@@ -870,7 +870,6 @@ function setupListeners(conference) {
870 870
             logger.error(
871 871
                 "Rejecting session-initiate from non focus user: "
872 872
                         + jingleSession.peerjid);
873
-            jingleSession.terminate('not-authorized');
874 873
         }
875 874
     });
876 875
 

+ 2
- 1
modules/xmpp/JingleSessionPC.js Целия файл

@@ -420,7 +420,8 @@ JingleSessionPC.prototype.onTerminated = function (reasonCondition,
420 420
     //this.reasonText = reasonText;
421 421
     logger.info("Session terminated", this, reasonCondition, reasonText);
422 422
 
423
-    this.peerconnection.close();
423
+    if (this.peerconnection)
424
+        this.peerconnection.close();
424 425
 };
425 426
 
426 427
 /**

+ 18
- 2
modules/xmpp/strophe.jingle.js Целия файл

@@ -91,8 +91,6 @@ module.exports = function(XMPP, eventEmitter) {
91 91
                 this.connection.send(ack);
92 92
                 return true;
93 93
             }
94
-            // FIXME: check for a defined action
95
-            this.connection.send(ack);
96 94
             // see http://xmpp.org/extensions/xep-0166.html#concepts-session
97 95
             switch (action) {
98 96
                 case 'session-initiate':
@@ -116,7 +114,19 @@ module.exports = function(XMPP, eventEmitter) {
116 114
                     this.jid2session[sess.peerjid] = sess;
117 115
 
118 116
                     var jingleOffer = $(iq).find('>jingle');
117
+                    // FIXME there's no nice way with event to get the reason
118
+                    // why the call was rejected
119 119
                     eventEmitter.emit(XMPPEvents.CALL_INCOMING, sess, jingleOffer);
120
+                    if (!sess.active())
121
+                    {
122
+                        // Call not accepted
123
+                        ack.attrs({ type: 'error' });
124
+                        ack.c('error', {type: 'cancel'})
125
+                           .c('bad-request',
126
+                            { xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas' })
127
+                            .up();
128
+                        this.terminate(sess.sid);
129
+                    }
120 130
                     break;
121 131
                 case 'session-terminate':
122 132
                     logger.log('terminating...', sess.sid);
@@ -139,8 +149,14 @@ module.exports = function(XMPP, eventEmitter) {
139 149
                     break;
140 150
                 default:
141 151
                     logger.warn('jingle action not implemented', action);
152
+                    ack.attrs({ type: 'error' });
153
+                    ack.c('error', {type: 'cancel'})
154
+                        .c('bad-request',
155
+                            { xmlns: 'urn:ietf:params:xml:ns:xmpp-stanzas' })
156
+                        .up();
142 157
                     break;
143 158
             }
159
+            this.connection.send(ack);
144 160
             return true;
145 161
         },
146 162
         terminate: function (sid, reasonCondition, reasonText) {

Loading…
Отказ
Запис