FS-4049 alt patch 3
This commit is contained in:
parent
1932f852ee
commit
c909ed6cf1
|
@ -2420,7 +2420,7 @@ 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 *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 *answer_state = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
|
||||||
const char *dft_state;
|
const char *dft_state;
|
||||||
const char *from_id;
|
const char *from_id = NULL, *from_name = NULL;
|
||||||
const char *to_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_to_user"));
|
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"));
|
const char *from_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_from_user"));
|
||||||
char *clean_to_user = NULL;
|
char *clean_to_user = NULL;
|
||||||
|
@ -2451,24 +2451,24 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||||
|
|
||||||
if (!strcasecmp(direction, "inbound")) {
|
if (!strcasecmp(direction, "inbound")) {
|
||||||
from_id = switch_str_nil(switch_event_get_header(helper->event, "Caller-Destination-Number"));
|
from_id = switch_str_nil(switch_event_get_header(helper->event, "Caller-Destination-Number"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"));
|
from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"));
|
||||||
}
|
from_name = switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Name");
|
||||||
|
|
||||||
if (zstr(from_id)) {
|
if (zstr(from_id)) {
|
||||||
from_id = from_user;
|
from_id = switch_str_nil(switch_event_get_header(helper->event, "Caller-Caller-ID-Number"));
|
||||||
|
from_name = switch_event_get_header(helper->event, "Caller-Caller-ID-Name");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zstr(from_id)) {
|
|
||||||
from_id = switch_str_nil(switch_event_get_header(helper->event, "Caller-Callee-ID-Number"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (zstr(from_id)) {
|
if (zstr(from_name)) {
|
||||||
from_id = "n/a";
|
from_name = switch_event_get_header(helper->event, "Caller-Caller-ID-Name");
|
||||||
|
if (zstr(from_name)) {
|
||||||
|
from_name = from_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
char *buf;
|
char *buf;
|
||||||
switch_event_serialize(helper->event, &buf, SWITCH_FALSE);
|
switch_event_serialize(helper->event, &buf, SWITCH_FALSE);
|
||||||
|
@ -2580,7 +2580,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||||
if (switch_true(switch_event_get_header(helper->event, "Presence-Privacy"))) {
|
if (switch_true(switch_event_get_header(helper->event, "Presence-Privacy"))) {
|
||||||
stream.write_function(&stream, "<remote>\n<identity display=\"Anonymous\">sip:anonymous@anonymous.invalid</identity>\n");
|
stream.write_function(&stream, "<remote>\n<identity display=\"Anonymous\">sip:anonymous@anonymous.invalid</identity>\n");
|
||||||
} else {
|
} else {
|
||||||
stream.write_function(&stream, "<remote>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_from_user, clean_from_user,
|
stream.write_function(&stream, "<remote>\n<identity display=\"%s\">sip:%s@%s</identity>\n",
|
||||||
|
from_name ? from_name : clean_from_user, clean_from_user,
|
||||||
host);
|
host);
|
||||||
}
|
}
|
||||||
stream.write_function(&stream, "<target uri=\"sip:**%s@%s\"/>\n", clean_to_user, host);
|
stream.write_function(&stream, "<target uri=\"sip:**%s@%s\"/>\n", clean_to_user, host);
|
||||||
|
|
Loading…
Reference in New Issue