From 73e4dcbb857cca0e07dff8166f8a6e4f2b2e1e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Mon, 26 Nov 2012 16:19:55 +0100 Subject: [PATCH] Do not specify reason phrase when replying unless it differs from the standard --- src/Dialogs.js | 4 +--- src/Message.js | 2 +- src/Session.js | 11 +++-------- src/UA.js | 4 ++-- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Dialogs.js b/src/Dialogs.js index b97485d79..c0dbed8c0 100644 --- a/src/Dialogs.js +++ b/src/Dialogs.js @@ -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); } diff --git a/src/Message.js b/src/Message.js index 90ecbd829..0a54709e4 100644 --- a/src/Message.js +++ b/src/Message.js @@ -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']); } }; diff --git a/src/Session.js b/src/Session.js index 99236d948..1b80bd92e 100644 --- a/src/Session.js +++ b/src/Session.js @@ -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(){ @@ -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); @@ -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() { diff --git a/src/UA.js b/src/UA.js index f747991d4..c7bcad72e 100644 --- a/src/UA.js +++ b/src/UA.js @@ -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);