[svn-commits] file: branch file/pimp_sip_location r382801 - in /team/file/pimp_sip_location...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 11 11:45:53 CDT 2013


Author: file
Date: Mon Mar 11 11:45:49 2013
New Revision: 382801

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382801
Log:
Incorporate review feedback.

Modified:
    team/file/pimp_sip_location/channels/chan_gulp.c
    team/file/pimp_sip_location/res/res_sip.c
    team/file/pimp_sip_location/res/res_sip/location.c
    team/file/pimp_sip_location/res/res_sip_endpoint_identifier_ip.c
    team/file/pimp_sip_location/res/res_sip_session.c

Modified: team/file/pimp_sip_location/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/channels/chan_gulp.c?view=diff&rev=382801&r1=382800&r2=382801
==============================================================================
--- team/file/pimp_sip_location/channels/chan_gulp.c (original)
+++ team/file/pimp_sip_location/channels/chan_gulp.c Mon Mar 11 11:45:49 2013
@@ -167,8 +167,8 @@
 	}
 
 	while ((aor_name = strsep(&rest, ","))) {
-		struct ast_sip_aor *aor = ast_sip_location_retrieve_aor(aor_name);
-		struct ao2_container *contacts;
+		RAII_VAR(struct ast_sip_aor *, aor, ast_sip_location_retrieve_aor(aor_name), ao2_cleanup);
+		RAII_VAR(struct ao2_container *, contacts, NULL, ao2_cleanup);
 		struct ao2_iterator it_contacts;
 		struct ast_sip_contact *contact;
 
@@ -176,13 +176,10 @@
 			/* If the AOR provided is not found skip it, there may be more */
 			continue;
 		} else if (!(contacts = ast_sip_location_retrieve_aor_contacts(aor))) {
-			/* No contacts are available, skip it a well */
-			ao2_cleanup(aor);
+			/* No contacts are available, skip it as well */
 			continue;
 		} else if (!ao2_container_count(contacts)) {
 			/* We were given a container but no contacts are in it... */
-			ao2_cleanup(contacts);
-			ao2_cleanup(aor);
 			continue;
 		}
 
@@ -196,9 +193,6 @@
 			ast_str_append(&dial, -1, "%s/%s&", args.endpoint_name, contact->uri);
 		}
 		ao2_iterator_destroy(&it_contacts);
-
-		ao2_cleanup(contacts);
-		ao2_cleanup(aor);
 	}
 
 	/* Trim the '&' at the end off */

Modified: team/file/pimp_sip_location/res/res_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip.c?view=diff&rev=382801&r1=382800&r2=382801
==============================================================================
--- team/file/pimp_sip_location/res/res_sip.c (original)
+++ team/file/pimp_sip_location/res/res_sip.c Mon Mar 11 11:45:49 2013
@@ -259,11 +259,12 @@
 {
 	RAII_VAR(struct ast_uuid *, uuid, ast_uuid_generate(), ast_free_ptr);
 	char uuid_str[AST_UUID_STR_LEN];
-	pj_str_t local_uri = pj_str("sip:temp at temp"), remote_uri;
+	static pj_str_t local_uri = { "sip:temp at temp", 13 };
+	pj_str_t remote_uri;
 	pjsip_dialog *dlg = NULL;
 	const char *transport_name = endpoint->transport, *outbound_proxy = endpoint->outbound_proxy;
 	pjsip_tpselector selector = { .type = PJSIP_TPSELECTOR_NONE, };
-	const pj_str_t HCONTACT = { "Contact", 7 };
+	static const pj_str_t HCONTACT = { "Contact", 7 };
 
 	if (!uuid) {
 		return NULL;

Modified: team/file/pimp_sip_location/res/res_sip/location.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip/location.c?view=diff&rev=382801&r1=382800&r2=382801
==============================================================================
--- team/file/pimp_sip_location/res/res_sip/location.c (original)
+++ team/file/pimp_sip_location/res/res_sip/location.c Mon Mar 11 11:45:49 2013
@@ -101,7 +101,7 @@
 	char regex[strlen(ast_sorcery_object_get_id(aor)) + 3];
 	struct ao2_container *contacts;
 
-	snprintf(regex, sizeof(regex), "^%s-", ast_sorcery_object_get_id(aor));
+	snprintf(regex, sizeof(regex), "^%s;@", ast_sorcery_object_get_id(aor));
 
 	if (!(contacts = ast_sorcery_retrieve_by_regex(ast_sip_get_sorcery(), "contact", regex))) {
 		return NULL;
@@ -128,7 +128,7 @@
 	char name[AST_UUID_STR_LEN];
 	RAII_VAR(struct ast_sip_contact *, contact, NULL, ao2_cleanup);
 
-	snprintf(name, sizeof(name), "%s-%s", ast_sorcery_object_get_id(aor), uri);
+	snprintf(name, sizeof(name), "%s;@%s", ast_sorcery_object_get_id(aor), uri);
 
 	if (!(contact = ast_sorcery_alloc(ast_sip_get_sorcery(), "contact", name))) {
 		return -1;

Modified: team/file/pimp_sip_location/res/res_sip_endpoint_identifier_ip.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip_endpoint_identifier_ip.c?view=diff&rev=382801&r1=382800&r2=382801
==============================================================================
--- team/file/pimp_sip_location/res/res_sip_endpoint_identifier_ip.c (original)
+++ team/file/pimp_sip_location/res/res_sip_endpoint_identifier_ip.c Mon Mar 11 11:45:49 2013
@@ -106,6 +106,7 @@
 	struct ip_identify_match *identify = obj;
 	int error = 0;
 
+	/* We deny what we actually want to match because there is an implicit permit all rule for ACLs */
 	if (!(identify->matches = ast_append_ha("d", var->value, identify->matches, &error))) {
 		return -1;
 	}

Modified: team/file/pimp_sip_location/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/file/pimp_sip_location/res/res_sip_session.c?view=diff&rev=382801&r1=382800&r2=382801
==============================================================================
--- team/file/pimp_sip_location/res/res_sip_session.c (original)
+++ team/file/pimp_sip_location/res/res_sip_session.c Mon Mar 11 11:45:49 2013
@@ -543,6 +543,8 @@
 
 	/* If the location is still empty we have nowhere to go */
 	if (ast_strlen_zero(location) || !(rest = ast_strdupa(location))) {
+		ast_log(LOG_WARNING, "No location is configured on endpoint '%s' and one was not provided\n",
+			ast_sorcery_object_get_id(endpoint));
 		return NULL;
 	}
 




More information about the svn-commits mailing list