summaryrefslogtreecommitdiff
path: root/res/res_pjsip_outbound_registration.c
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-11-21 10:57:12 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-11-21 10:57:12 -0600
commitaa8f1b04b6e5553c7c414fd081429a48939b8bed (patch)
tree1849e24fb7e97b81866db1ccc8a94e576c979986 /res/res_pjsip_outbound_registration.c
parent6fcd361540a2b38724d5f49bd193d97f5522616c (diff)
parentd4a522d587bb1986cc66ed59a087be3784eaaceb (diff)
Merge "res_pjsip_outbound_registration.c: Be tolerant of short registration timeouts." into 13
Diffstat (limited to 'res/res_pjsip_outbound_registration.c')
-rw-r--r--res/res_pjsip_outbound_registration.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 1c772b4ad..9795a5971 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -796,11 +796,18 @@ static int handle_registration_response(void *data)
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;