[svn-commits] file: trunk r400834 - in /trunk: ./ res/res_pjsip/location.c

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


Author: file
Date: Thu Oct 10 13:21:55 2013
New Revision: 400834

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=400834
Log:
Perform validation of permanent contacts on AORs in res_pjsip.
........

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

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

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

Modified: trunk/res/res_pjsip/location.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip/location.c?view=diff&rev=400834&r1=400833&r2=400834
==============================================================================
--- trunk/res/res_pjsip/location.c (original)
+++ trunk/res/res_pjsip/location.c Thu Oct 10 13:21:55 2013
@@ -270,6 +270,24 @@
 {
 	struct ast_sip_aor *aor = obj;
 	RAII_VAR(struct ast_sip_contact *, contact, NULL, ao2_cleanup);
+	pj_pool_t *pool;
+	pj_str_t contact_uri;
+	static const pj_str_t HCONTACT = { "Contact", 7 };
+
+	pool = pjsip_endpt_create_pool(ast_sip_get_pjsip_endpoint(), "Permanent Contact Validation", 256, 256);
+	if (!pool) {
+		return -1;
+	}
+
+	pj_strdup2_with_null(pool, &contact_uri, var->value);
+	if (!pjsip_parse_hdr(pool, &HCONTACT, contact_uri.ptr, contact_uri.slen, NULL)) {
+		ast_log(LOG_ERROR, "Permanent URI on aor '%s' with contact '%s' failed to parse\n",
+			ast_sorcery_object_get_id(aor), var->value);
+		pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
+		return -1;
+	}
+
+	pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), pool);
 
 	if ((!aor->permanent_contacts && !(aor->permanent_contacts = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, NULL))) ||
 		!(contact = ast_sorcery_alloc(ast_sip_get_sorcery(), "contact", NULL))) {




More information about the svn-commits mailing list