[asterisk-commits] mmichelson: trunk r398695 - in /trunk: ./ res/res_pjsip_endpoint_identifier_ip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 9 17:00:46 CDT 2013


Author: mmichelson
Date: Mon Sep  9 17:00:44 2013
New Revision: 398695

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=398695
Log:
Add extra debugging to res_pjsip_endpoint_identifier_ip
........

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

Modified:
    trunk/   (props changed)
    trunk/res/res_pjsip_endpoint_identifier_ip.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Mon Sep  9 17:00:44 2013
@@ -1,1 +1,1 @@
-/branches/12:1-398558,398560-398577,398579-398651
+/branches/12:1-398558,398560-398577,398579-398651,398694

Modified: trunk/res/res_pjsip_endpoint_identifier_ip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_pjsip_endpoint_identifier_ip.c?view=diff&rev=398695&r1=398694&r2=398695
==============================================================================
--- trunk/res/res_pjsip_endpoint_identifier_ip.c (original)
+++ trunk/res/res_pjsip_endpoint_identifier_ip.c Mon Sep  9 17:00:44 2013
@@ -89,8 +89,20 @@
 {
 	struct ip_identify_match *identify = obj;
 	struct ast_sockaddr *addr = arg;
+	int sense;
 
-	return (ast_apply_ha(identify->matches, addr) != AST_SENSE_ALLOW) ? CMP_MATCH | CMP_STOP : 0;
+	sense = ast_apply_ha(identify->matches, addr);
+	if (sense != AST_SENSE_ALLOW) {
+		ast_debug(3, "Source address %s matches identify '%s'\n",
+				ast_sockaddr_stringify(addr),
+				ast_sorcery_object_get_id(identify));
+		return CMP_MATCH | CMP_STOP;
+	} else {
+		ast_debug(3, "Source address %s does not match identify '%s'\n",
+				ast_sockaddr_stringify(addr),
+				ast_sorcery_object_get_id(identify));
+		return 0;
+	}
 }
 
 static struct ast_sip_endpoint *ip_identify(pjsip_rx_data *rdata)
@@ -103,6 +115,7 @@
 	/* If no possibilities exist return early to save some time */
 	if (!(candidates = ast_sorcery_retrieve_by_fields(ast_sip_get_sorcery(), "identify", AST_RETRIEVE_FLAG_MULTIPLE | AST_RETRIEVE_FLAG_ALL, NULL)) ||
 		!ao2_container_count(candidates)) {
+		ast_debug(3, "No identify sections to match against\n");
 		return NULL;
 	}
 
@@ -110,12 +123,17 @@
 	ast_sockaddr_set_port(&addr, rdata->pkt_info.src_port);
 
 	if (!(match = ao2_callback(candidates, 0, ip_identify_match_check, &addr))) {
+		ast_debug(3, "'%s' did not match any identify section rules\n",
+				ast_sockaddr_stringify(&addr));
 		return NULL;
 	}
 
 	endpoint = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "endpoint", match->endpoint_name);
 	if (endpoint) {
 		ast_debug(3, "Retrieved endpoint %s\n", ast_sorcery_object_get_id(endpoint));
+	} else {
+		ast_log(LOG_WARNING, "Identify section '%s' points to endpoint '%s' but endpoint could not be looked up\n",
+				ast_sorcery_object_get_id(match), match->endpoint_name);
 	}
 
 	return endpoint;




More information about the asterisk-commits mailing list