[asterisk-commits] file: trunk r394004 - /trunk/res/res_sip_outbound_registration.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 10 15:03:00 CDT 2013


Author: file
Date: Wed Jul 10 15:02:59 2013
New Revision: 394004

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394004
Log:
Handle outbound registration failures that do not occur as a result of a real response.

(closes issue ASTERISK-22064)
Reported by: Rusty Newton

Modified:
    trunk/res/res_sip_outbound_registration.c

Modified: trunk/res/res_sip_outbound_registration.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_sip_outbound_registration.c?view=diff&rev=394004&r1=394003&r2=394004
==============================================================================
--- trunk/res/res_sip_outbound_registration.c (original)
+++ trunk/res/res_sip_outbound_registration.c Wed Jul 10 15:02:59 2013
@@ -296,7 +296,10 @@
 {
 	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 @@
 {
 	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)) {




More information about the asterisk-commits mailing list