Skip to content
Permalink
Browse files

Fire UA 'newMessage' event for incoming MESSAGE requests regardless t…

…hey are out of dialog or in-dialog.
  • Loading branch information
jmillan committed Nov 20, 2012
1 parent 1ab3423 commit d6428e7331978f063186f0d90bf5575816976b25
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/UA.js
@@ -364,6 +364,14 @@ JsSIP.UA.prototype.receiveRequest = function(request) {
'Allow: '+ JsSIP.utils.getAllowedMethods(this),
'Accept: '+ JsSIP.c.ACCEPTED_BODY_TYPES
]);
} else if (method === JsSIP.c.MESSAGE) {
if (!this.checkEvent('newMessage') || this.listeners('newMessage').length === 0) {
request.reply(405, JsSIP.c.REASON_405, ['Allow: '+ JsSIP.utils.getAllowedMethods(this)]);
}
return;
}
message = new JsSIP.Message(this);
message.init_incoming(request);
}

// Initial Request
@@ -375,10 +383,6 @@ JsSIP.UA.prototype.receiveRequest = function(request) {
}

switch(method) {
case JsSIP.c.MESSAGE:
message = new JsSIP.Message(this);
message.init_incoming(request);
break;
case JsSIP.c.INVITE:
if(!JsSIP.utils.isWebRtcSupported()) {
console.warn(JsSIP.c.LOG_UA +'Call invitation received but rtcweb is not supported');

0 comments on commit d6428e7

Please sign in to comment.
You can’t perform that action at this time.