summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2013-07-10 20:02:59 +0000
committerJoshua Colp <jcolp@digium.com>2013-07-10 20:02:59 +0000
commitc232a1f821758b348ed55cad7d22307f7ec7e749 (patch)
treeb1a900f6bb0320de187ad8f0f36d76574b78832b /res
parent15036c297985dbb40e5bc7f92983863a1712493f (diff)
Handle outbound registration failures that do not occur as a result of a real response.
(closes issue ASTERISK-22064) Reported by: Rusty Newton git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394004 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_sip_outbound_registration.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/res/res_sip_outbound_registration.c b/res/res_sip_outbound_registration.c
index b80b85b61..8ce16df69 100644
--- a/res/res_sip_outbound_registration.c
+++ b/res/res_sip_outbound_registration.c
@@ -296,7 +296,10 @@ static void registration_response_destroy(void *obj)
{
struct registration_response *response = obj;
- pjsip_rx_data_free_cloned(response->rdata);
+ if (response->rdata) {
+ pjsip_rx_data_free_cloned(response->rdata);
+ }
+
ao2_cleanup(response->client_state);
}
@@ -390,14 +393,19 @@ static void sip_outbound_registration_response_cb(struct pjsip_regc_cbparam *par
{
RAII_VAR(struct sip_outbound_registration_client_state *, client_state, param->token, ao2_cleanup);
struct registration_response *response = ao2_alloc(sizeof(*response), registration_response_destroy);
- struct pjsip_retry_after_hdr *retry_after = pjsip_msg_find_hdr(param->rdata->msg_info.msg, PJSIP_H_RETRY_AFTER, NULL);
response->code = param->code;
response->expiration = param->expiration;
- response->retry_after = retry_after ? retry_after->ivalue : 0;
response->client_state = client_state;
- response->tsx = pjsip_rdata_get_tsx(param->rdata);
- pjsip_rx_data_clone(param->rdata, 0, &response->rdata);
+
+ if (param->rdata) {
+ struct pjsip_retry_after_hdr *retry_after = pjsip_msg_find_hdr(param->rdata->msg_info.msg, PJSIP_H_RETRY_AFTER, NULL);
+
+ response->retry_after = retry_after ? retry_after->ivalue : 0;
+ response->tsx = pjsip_rdata_get_tsx(param->rdata);
+ pjsip_rx_data_clone(param->rdata, 0, &response->rdata);
+ }
+
ao2_ref(response->client_state, +1);
if (ast_sip_push_task(client_state->serializer, handle_registration_response, response)) {