summaryrefslogtreecommitdiff
path: root/res/res_pjsip_outbound_registration.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2015-11-17 14:53:19 -0600
committerRichard Mudgett <rmudgett@digium.com>2015-11-18 13:26:49 -0600
commit3dbaf696e98aa0d31de9635c00de4a3de2d3f008 (patch)
tree7c39edf9f6cddaf50f29af0f6a8c821e42d5418b /res/res_pjsip_outbound_registration.c
parenteaf898ac881585c23ac0fcb31c5369809c68b1bb (diff)
res_pjsip_outbound_registration.c: Be tolerant of short registration timeouts.
Change-Id: Ie16f5053ebde0dc6507845393709b4d6a3ea526d
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 2fd5b8c48..83386c61c 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;