summaryrefslogtreecommitdiff
path: root/res/res_pjsip_endpoint_identifier_ip.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2013-09-09 22:00:44 +0000
committerMark Michelson <mmichelson@digium.com>2013-09-09 22:00:44 +0000
commit9fb34542d1ba6c737879a4c1c434371359a497d1 (patch)
tree3ca2a962249414536167ed49eee204b7c8fe6ec5 /res/res_pjsip_endpoint_identifier_ip.c
parentc2e6e1ef49d8e8745c9e4b6be2601b210a34506f (diff)
Add extra debugging to res_pjsip_endpoint_identifier_ip
........ Merged revisions 398694 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398695 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_endpoint_identifier_ip.c')
-rw-r--r--res/res_pjsip_endpoint_identifier_ip.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/res/res_pjsip_endpoint_identifier_ip.c b/res/res_pjsip_endpoint_identifier_ip.c
index f3bccfa7d..b49143406 100644
--- a/res/res_pjsip_endpoint_identifier_ip.c
+++ b/res/res_pjsip_endpoint_identifier_ip.c
@@ -89,8 +89,20 @@ static int ip_identify_match_check(void *obj, void *arg, int flags)
{
struct ip_identify_match *identify = obj;
struct ast_sockaddr *addr = arg;
-
- return (ast_apply_ha(identify->matches, addr) != AST_SENSE_ALLOW) ? CMP_MATCH | CMP_STOP : 0;
+ int sense;
+
+ 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 @@ static struct ast_sip_endpoint *ip_identify(pjsip_rx_data *rdata)
/* 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 @@ static struct ast_sip_endpoint *ip_identify(pjsip_rx_data *rdata)
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;