summaryrefslogtreecommitdiff
path: root/res/res_pjsip_outbound_registration.c
diff options
context:
space:
mode:
authorScott Griepentrog <sgriepentrog@digium.com>2014-10-31 16:21:57 +0000
committerScott Griepentrog <sgriepentrog@digium.com>2014-10-31 16:21:57 +0000
commitb4ee155c6266edaeadc9e6a67fb5c64dc5eb2d77 (patch)
tree2b7475ae0bf8eafd78ec469e3ea70a1f42838932 /res/res_pjsip_outbound_registration.c
parentf6809b01df4a958d493f12d2c286a86193a8775a (diff)
pjsip: Handle outbound unregister correctly
This updates the status of the outbound registration to reflect when it has been unregistered. Since the registration is unregistered but is not stopped, the registration schedule remains active as before. The patch also updates the documentation of both the AMI and CLI commands. ASTERISK-24411 #close Review: https://reviewboard.asterisk.org/r/4119/ Reported by: John Bigelow patches: unregister-patch1.txt uploaded by John Bigelow (License 5091) ........ Merged revisions 426923 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@426924 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_outbound_registration.c')
-rw-r--r--res/res_pjsip_outbound_registration.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c
index 3e6c984b2..af4a3694d 100644
--- a/res/res_pjsip_outbound_registration.c
+++ b/res/res_pjsip_outbound_registration.c
@@ -138,6 +138,14 @@
<para>The outbound registration to unregister.</para>
</parameter>
</syntax>
+ <description>
+ <para>
+ Send a SIP REGISTER request to the specified outbound registration with an expiration of 0.
+ This will cause the contact added by this registration to be removed on the remote system.
+ Note: The specified outbound registration will attempt to re-register according to it's last
+ registration expiration.
+ </para>
+ </description>
</manager>
<manager name="PJSIPShowRegistrationsOutbound" language="en_US">
<synopsis>
@@ -465,11 +473,17 @@ static int handle_registration_response(void *data)
}
if (PJSIP_IS_STATUS_IN_CLASS(response->code, 200)) {
- /* 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);
+ /* Check if this is in regards to registering or unregistering */
+ if (response->expiration) {
+ /* 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);
+ } else {
+ ast_debug(1, "Outbound unregistration to '%s' with client '%s' successful\n", server_uri, client_uri);
+ response->client_state->status = SIP_REGISTRATION_UNREGISTERED;
+ }
} else if (response->retry_after) {
/* If we have been instructed to retry after a period of time, schedule it as such */
schedule_retry(response, response->retry_after, server_uri, client_uri);
@@ -999,7 +1013,9 @@ static char *cli_unregister(struct ast_cli_entry *e, int cmd, struct ast_cli_arg
"Usage: pjsip send unregister <registration>\n"
" Send a SIP REGISTER request to the specified outbound "
"registration with an expiration of 0. This will cause the contact "
- "added by this registration to be removed on the remote system.\n";
+ "added by this registration to be removed on the remote system. Note: "
+ "The specified outbound registration will attempt to re-register "
+ "according to its last registration expiration.\n";
return NULL;
case CLI_GENERATE:
return cli_complete_registration(a->line, a->word, a->pos, a->n);