|
|
@@ -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) {
|