From d98d51ed39b2b8a826b505d7a6f4c269652a4d7d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 May 2011 13:23:56 -0500 Subject: [PATCH] FS-3144 --resolve --- src/mod/endpoints/mod_sofia/sofia_presence.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index fdc3bd4d9a..c6ba6ce749 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1417,6 +1417,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } if (!(nh = nua_handle_by_call_id(profile->nua, call_id))) { + + if (mod_sofia_globals.debug_presence > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find handle for call id %s\n", call_id); + } + goto end; } @@ -1468,12 +1473,18 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * const char *astate = switch_str_nil(switch_event_get_header(helper->event, "astate")); const char *answer_state = switch_str_nil(switch_event_get_header(helper->event, "answer-state")); const char *dft_state; - const char *from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number")); + const char *from_id; const char *to_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_to_user")); const char *from_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_from_user")); char *clean_to_user = NULL; char *clean_from_user = NULL; int force_status = 0; + + if (!strcasecmp(direction, "inbound")) { + from_id = switch_str_nil(switch_event_get_header(helper->event, "Caller-Destination-Number")); + } else { + from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number")); + } #if 0 char *buf; switch_event_serialize(helper->event, &buf, SWITCH_FALSE);