mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-17 01:02:12 +00:00
display update
This commit is contained in:
parent
3bfbae343b
commit
0fc8050cbc
@ -2606,6 +2606,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc
|
|||||||
|
|
||||||
SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel)
|
SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel)
|
||||||
{
|
{
|
||||||
|
switch_event_t *event;
|
||||||
|
|
||||||
switch_mutex_lock(channel->profile_mutex);
|
switch_mutex_lock(channel->profile_mutex);
|
||||||
if (channel->caller_profile->callee_id_name) {
|
if (channel->caller_profile->callee_id_name) {
|
||||||
switch_channel_set_variable(channel, "pre_transfer_caller_id_name", channel->caller_profile->caller_id_name);
|
switch_channel_set_variable(channel, "pre_transfer_caller_id_name", channel->caller_profile->caller_id_name);
|
||||||
@ -2620,6 +2622,23 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel)
|
|||||||
channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING;
|
channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING;
|
||||||
switch_mutex_unlock(channel->profile_mutex);
|
switch_mutex_unlock(channel->profile_mutex);
|
||||||
|
|
||||||
|
|
||||||
|
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "RECV");
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Caller-Name", channel->caller_profile->caller_id_name);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Caller-Number", channel->caller_profile->caller_id_number);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Name", channel->caller_profile->callee_id_name);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Number", channel->caller_profile->callee_id_number);
|
||||||
|
|
||||||
|
if (uuid) {
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
|
||||||
|
}
|
||||||
|
switch_channel_event_set_data(channel, event);
|
||||||
|
switch_event_fire(&event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, "%s Flipping CID from \"%s\" <%s> to \"%s\" <%s>\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, "%s Flipping CID from \"%s\" <%s> to \"%s\" <%s>\n",
|
||||||
switch_channel_get_name(channel),
|
switch_channel_get_name(channel),
|
||||||
switch_str_nil(switch_channel_get_variable(channel, "pre_transfer_caller_id_name")),
|
switch_str_nil(switch_channel_get_variable(channel, "pre_transfer_caller_id_name")),
|
||||||
|
@ -1299,7 +1299,7 @@ static void core_event_handler(switch_event_t *event)
|
|||||||
break;
|
break;
|
||||||
case SWITCH_EVENT_CALL_UPDATE:
|
case SWITCH_EVENT_CALL_UPDATE:
|
||||||
{
|
{
|
||||||
const char *name = NULL, *number = NULL, *direction;
|
const char *name = NULL, *number = NULL, *direction, *cid_name = NULL, *cid_num = NULL;
|
||||||
int recv = 0;
|
int recv = 0;
|
||||||
|
|
||||||
direction = switch_event_get_header(event, "direction");
|
direction = switch_event_get_header(event, "direction");
|
||||||
@ -1310,6 +1310,7 @@ static void core_event_handler(switch_event_t *event)
|
|||||||
number = switch_event_get_header(event, "callee-number");
|
number = switch_event_get_header(event, "callee-number");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
name = switch_event_get_header(event, "caller-callee-id-name");
|
name = switch_event_get_header(event, "caller-callee-id-name");
|
||||||
}
|
}
|
||||||
@ -1318,22 +1319,38 @@ static void core_event_handler(switch_event_t *event)
|
|||||||
number = switch_event_get_header(event, "caller-callee-id-number");
|
number = switch_event_get_header(event, "caller-callee-id-number");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cid_name = switch_event_get_header(event, "caller-name");
|
||||||
|
cid_num = switch_event_get_header(event, "caller-number");
|
||||||
|
|
||||||
|
if (!cid_name) {
|
||||||
|
cid_name = switch_event_get_header(event, "caller-caller-id-name");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cid_num) {
|
||||||
|
cid_num = switch_event_get_header(event, "caller-caller-id-number");
|
||||||
|
}
|
||||||
|
|
||||||
if (!zstr(name) && !zstr(number)) {
|
if (!zstr(name) && !zstr(number)) {
|
||||||
new_sql() = switch_mprintf("update channels set state='%s',callstate='%s',callee_name='%q',"
|
new_sql() = switch_mprintf("update channels set state='%s',callstate='%s',callee_name='%q',"
|
||||||
"callee_num='%q',callee_direction='%q' where uuid='%s' and hostname='%q'",
|
"callee_num='%q',callee_direction='%q',cid_name='%q',cid_num='%q' where uuid='%s' and hostname='%q'",
|
||||||
switch_event_get_header_nil(event, "channel-state"),
|
switch_event_get_header_nil(event, "channel-state"),
|
||||||
switch_event_get_header_nil(event, "channel-call-state"),
|
switch_event_get_header_nil(event, "channel-call-state"),
|
||||||
switch_str_nil(name),
|
switch_str_nil(name),
|
||||||
switch_str_nil(number),
|
switch_str_nil(number),
|
||||||
switch_event_get_header_nil(event, "direction"),
|
switch_event_get_header_nil(event, "direction"),
|
||||||
|
switch_str_nil(cid_name),
|
||||||
|
switch_str_nil(cid_num),
|
||||||
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname());
|
||||||
|
|
||||||
name = switch_event_get_header(event, "callee-name");
|
name = switch_event_get_header(event, "callee-name");
|
||||||
number = switch_event_get_header(event, "callee-number");
|
number = switch_event_get_header(event, "callee-number");
|
||||||
|
|
||||||
if (name && number && recv) {
|
if (name && number && recv) {
|
||||||
new_sql() = switch_mprintf("update calls set callee_cid_name='%q',callee_cid_num='%q' where caller_uuid='%q'",
|
new_sql() = switch_mprintf("update calls set callee_cid_name='%q',callee_cid_num='%q',caller_cid_name='%q',caller_cid_num='%q'"
|
||||||
name, number, switch_event_get_header_nil(event, "unique-id"));
|
" where caller_uuid='%q'",
|
||||||
|
name, number, switch_str_nil(cid_name), switch_str_nil(cid_num),
|
||||||
|
switch_event_get_header_nil(event, "unique-id"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user