[svn-commits] file: trunk r400825 - in /trunk: ./ res/ res/res_pjsip/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 10 07:26:21 CDT 2013


Author: file
Date: Thu Oct 10 07:26:20 2013
New Revision: 400825

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400825
Log:
Fix an assertion in res_pjsip when specifying an invalid outbound proxy.

This change fixes two issues when setting an outbound proxy:

1. The outbound proxy URI was not parsed and validated during configuration.
2. If an outgoing dialog was created and the outbound proxy could not be set an assertion would
occur because the usage count on the dialog was not decremented.

The documentation has also been updated to specify that a full URI must be specified for
the outbound proxy.

(closes issue ASTERISK-22672)
Reported by: Antti Yrjola
........

Merged revisions 400824 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip.c
    trunk/res/res_pjsip/pjsip_configuration.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/res/res_pjsip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip.c?view=diff&rev=400825&r1=400824&r2=400825
==============================================================================
--- trunk/res/res_pjsip.c (original)
+++ trunk/res/res_pjsip.c Thu Oct 10 07:26:20 2013
@@ -254,7 +254,7 @@
 					<synopsis>Authentication object used for outbound requests</synopsis>
 				</configOption>
 				<configOption name="outbound_proxy">
-					<synopsis>Proxy through which to send requests</synopsis>
+					<synopsis>Proxy through which to send requests, a full SIP URI must be provided</synopsis>
 				</configOption>
 				<configOption name="rewrite_contact">
 					<synopsis>Allow Contact header to be rewritten with the source IP address-port</synopsis>
@@ -1401,6 +1401,7 @@
 
 		pj_strdup2_with_null(dlg->pool, &tmp, outbound_proxy);
 		if (!(route = pjsip_parse_hdr(dlg->pool, &ROUTE_HNAME, tmp.ptr, tmp.slen, NULL))) {
+			dlg->sess_count--;
 			pjsip_dlg_terminate(dlg);
 			return NULL;
 		}

Modified: trunk/res/res_pjsip/pjsip_configuration.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/pjsip_configuration.c?view=diff&rev=400825&r1=400824&r2=400825
==============================================================================
--- trunk/res/res_pjsip/pjsip_configuration.c (original)
+++ trunk/res/res_pjsip/pjsip_configuration.c Thu Oct 10 07:26:20 2013
@@ -593,6 +593,28 @@
 
 	if (!(endpoint->persistent = persistent_endpoint_find_or_create(endpoint))) {
 		return -1;
+	}
+
+	if (!ast_strlen_zero(endpoint->outbound_proxy)) {
+		pj_pool_t *pool = pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(), "Outbound Proxy Validation", 256, 256);
+		static const pj_str_t ROUTE_HNAME = { "Route", 5 };
+		pj_str_t tmp;
+
+		if (!pool) {
+			ast_log(LOG_ERROR, "Could not allocate pool for outbound proxy validation on '%s'\n",
+				ast_sorcery_object_get_id(endpoint));
+			return -1;
+		}
+
+		pj_strdup2_with_null(pool, &tmp, endpoint->outbound_proxy);
+		if (!pjsip_parse_hdr(pool, &ROUTE_HNAME, tmp.ptr, tmp.slen, NULL)) {
+			ast_log(LOG_ERROR, "Invalid outbound proxy '%s' specified on endpoint '%s'\n",
+				endpoint->outbound_proxy, ast_sorcery_object_get_id(endpoint));
+			pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
+			return -1;
+		}
+
+		pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
 	}
 
 	return 0;




More information about the svn-commits mailing list