]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-3144 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 11 May 2011 18:23:56 +0000 (13:23 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 11 May 2011 18:23:56 +0000 (13:23 -0500)
src/mod/endpoints/mod_sofia/sofia_presence.c

index fdc3bd4d9a560f40b6b6c3a394d90d7063bb57c2..c6ba6ce7497f9f80381e8eec0da25fef6feb45c9 100644 (file)
@@ -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);