Skip to content

Commit 4bfc34c

Browse files
author
Gavin Llewellyn
committed
Fix handling of 423 response to REGISTER
1 parent da983aa commit 4bfc34c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Registrator.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Registrator = function(ua, transport) {
2020

2121
this.registrar = ua.configuration.registrar_server;
2222
this.expires = ua.configuration.register_expires;
23-
this.min_expires = ua.configuration.register_min_expires;
2423

2524
// Call-ID and CSeq values RFC3261 10.2
2625
this.call_id = JsSIP.Utils.createRandomToken(22);
@@ -71,7 +70,7 @@ Registrator.prototype = {
7170
* @private
7271
*/
7372
this.receiveResponse = function(response) {
74-
var contact, expires, min_expires,
73+
var contact, expires,
7574
contacts = response.countHeader('contact');
7675

7776
// Discard responses to older REGISTER/un-REGISTER requests.
@@ -138,11 +137,12 @@ Registrator.prototype = {
138137
// Interval too brief RFC3261 10.2.8
139138
case /^423$/.test(response.status_code):
140139
if(response.hasHeader('min-expires')) {
141-
min_expires = response.getHeader('min-expires');
142-
expires = (min_expires - this.expires);
140+
// Increase our registration interval to the suggested minimum
141+
this.expires = response.getHeader('min-expires');
142+
// Attempt the registration again immediately
143143
this.registrationTimer = window.setTimeout(function() {
144144
self.register();
145-
}, this.expires * 1000);
145+
}, 0);
146146
} else { //This response MUST contain a Min-Expires header field
147147
console.warn(LOG_PREFIX +'423 response received for REGISTER without Min-Expires');
148148
this.registrationFailure(response, JsSIP.C.causes.SIP_FAILURE_CODE);

0 commit comments

Comments
 (0)