Skip to content

Commit

Permalink
Do not specify reason phrase when replying unless it differs from the…
Browse files Browse the repository at this point in the history
… standard
  • Loading branch information
jmillan committed Nov 26, 2012
1 parent 96b9f6c commit 73e4dcb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
4 changes: 1 addition & 3 deletions src/Dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@ JsSIP.Dialog.prototype = {
if(request.cseq < this.remote_seqnum) {
if(this.state === JsSIP.c.DIALOG_EARLY) {
var retryAfter = (Math.random() * 10 | 0) + 1;
request.reply(500, JsSIP.c.REASON_PHRASE[500], [
'Retry-After:'+ retryAfter
]);
request.reply(500, null, ['Retry-After:'+ retryAfter]);
} else {
request.reply(500);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ JsSIP.Message.prototype.init_incoming = function(request) {
request.reply(200);
}
} else {
request.reply(415, JsSIP.c.REASON_PHRASE[415], ["Accept: text/plain, text/html"]);
request.reply(415, null, ['Accept: text/plain, text/html']);
}
};

Expand Down
11 changes: 3 additions & 8 deletions src/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,7 @@ JsSIP.Session.prototype.receiveInitialRequest = function(ua, request) {
return;
}

request.reply(200, JsSIP.c.REASON_PHRASE[200], [
'Contact: <' + session.contact + '>'],
request.reply(200, null, ['Contact: <' + session.contact + '>'],
sdp,
// onSuccess
function(){
Expand Down Expand Up @@ -446,9 +445,7 @@ JsSIP.Session.prototype.receiveInitialRequest = function(ua, request) {
if (this.status !== JsSIP.c.SESSION_TERMINATED) {
this.progress('local');

request.reply(180, JsSIP.c.REASON_PHRASE[180], [
'Contact: <' + this.contact + '>'
]);
request.reply(180, null, ['Contact: <' + this.contact + '>']);
}
} else {
request.reply(415);
Expand Down Expand Up @@ -632,9 +629,7 @@ JsSIP.Session.prototype.invite2xxRetransmission = function(retransmissions, requ
if((retransmissions * JsSIP.Timers.T1) <= JsSIP.Timers.T2) {
retransmissions += 1;

request.reply(200, JsSIP.c.REASON_PHRASE[200], [
'Contact: <' + this.contact + '>'],
body);
request.reply(200, null, ['Contact: <' + this.contact + '>'], body);

this.invite2xxTimer = window.setTimeout(
function() {
Expand Down
4 changes: 2 additions & 2 deletions src/UA.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,13 @@ JsSIP.UA.prototype.receiveRequest = function(request) {
* They are processed as if they had been received outside the dialog.
*/
if(method === JsSIP.c.OPTIONS) {
request.reply(200, JsSIP.c.REASON_PHRASE[200], [
request.reply(200, null, [
'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_PHRASE[405], ['Allow: '+ JsSIP.utils.getAllowedMethods(this)]);
request.reply(405, null, ['Allow: '+ JsSIP.utils.getAllowedMethods(this)]);
return;
}
message = new JsSIP.Message(this);
Expand Down

0 comments on commit 73e4dcb

Please sign in to comment.