[Asterisk-code-review] res pjsip outbound registration.c: Be tolerant of short regi... (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Tue Nov 17 16:41:35 CST 2015


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/1645

Change subject: res_pjsip_outbound_registration.c: Be tolerant of short registration timeouts.
......................................................................

res_pjsip_outbound_registration.c: Be tolerant of short registration timeouts.

Change-Id: Ie16f5053ebde0dc6507845393709b4d6a3ea526d
---
M res/res_pjsip_outbound_registration.c
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/45/1645/1

diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 6eda6d1..7862195 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -786,11 +786,18 @@
 	if (PJSIP_IS_STATUS_IN_CLASS(response->code, 200)) {
 		/* Check if this is in regards to registering or unregistering */
 		if (response->expiration) {
+			int next_registration_round;
+
 			/* If the registration went fine simply reschedule registration for the future */
 			ast_debug(1, "Outbound registration to '%s' with client '%s' successful\n", server_uri, client_uri);
 			response->client_state->status = SIP_REGISTRATION_REGISTERED;
 			response->client_state->retries = 0;
-			schedule_registration(response->client_state, response->expiration - REREGISTER_BUFFER_TIME);
+			next_registration_round = response->expiration - REREGISTER_BUFFER_TIME;
+			if (next_registration_round < 0) {
+				/* Re-register immediately. */
+				next_registration_round = 0;
+			}
+			schedule_registration(response->client_state, next_registration_round);
 		} else {
 			ast_debug(1, "Outbound unregistration to '%s' with client '%s' successful\n", server_uri, client_uri);
 			response->client_state->status = SIP_REGISTRATION_UNREGISTERED;

-- 
To view, visit https://gerrit.asterisk.org/1645
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie16f5053ebde0dc6507845393709b4d6a3ea526d
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list