refactor and cleanup more cid stuff
This commit is contained in:
parent
312b86e331
commit
18c429f66f
|
@ -334,6 +334,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc
|
|||
*/
|
||||
SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension);
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_invert_cid(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel);
|
||||
|
||||
|
@ -603,7 +604,9 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(_In_ switch_channel_
|
|||
SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *channel, const char *in, switch_event_t *var_list, switch_event_t *api_list, uint32_t recur);
|
||||
#define switch_channel_expand_variables(_channel, _in) switch_channel_expand_variables_check(_channel, _in, NULL, NULL, 0)
|
||||
|
||||
#define switch_channel_inbound_display(_channel) (switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_INBOUND || switch_channel_test_flag(_channel, CF_DIALPLAN))
|
||||
#define switch_channel_inbound_display(_channel) ((switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(_channel, CF_BLEG)) || (switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(_channel, CF_DIALPLAN)))
|
||||
|
||||
#define switch_channel_outbound_display(_channel) ((switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_INBOUND && switch_channel_test_flag(_channel, CF_BLEG)) || (switch_channel_direction(_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(_channel, CF_DIALPLAN)))
|
||||
|
||||
SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile,
|
||||
_In_opt_ const char *prefix);
|
||||
|
|
|
@ -2985,18 +2985,7 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||
originatee_cp = switch_channel_get_caller_profile(other_channel);
|
||||
|
||||
if (switch_channel_inbound_display(other_channel)) {
|
||||
const char *tname = originatee_cp->caller_id_name;
|
||||
const char *tnum = originatee_cp->caller_id_number;
|
||||
|
||||
#ifdef DEEP_DEBUG_CID
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SWAP [%s][%s] [%s][%s]\n", originatee_cp->caller_id_name, originatee_cp->caller_id_number, originatee_cp->callee_id_name, originatee_cp->callee_id_number);
|
||||
#endif
|
||||
|
||||
originatee_cp->caller_id_name = originatee_cp->callee_id_name;
|
||||
originatee_cp->caller_id_number = originatee_cp->callee_id_number;
|
||||
|
||||
originatee_cp->callee_id_name = tname;
|
||||
originatee_cp->callee_id_number = tnum;
|
||||
switch_channel_invert_cid(other_channel);
|
||||
|
||||
if (switch_channel_direction(other_channel) == SWITCH_CALL_DIRECTION_INBOUND) {
|
||||
switch_channel_set_flag(other_channel, CF_BLEG);
|
||||
|
|
|
@ -2850,6 +2850,36 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc
|
|||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_invert_cid(switch_channel_t *channel)
|
||||
{
|
||||
const char *tname, *tnum;
|
||||
switch_caller_profile_t *cp;
|
||||
|
||||
cp = switch_channel_get_caller_profile(channel);
|
||||
|
||||
tname = cp->caller_id_name;
|
||||
tnum = cp->caller_id_number;
|
||||
|
||||
#ifdef DEEP_DEBUG_CID
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SWAP [%s][%s] [%s][%s]\n", originate_cp->caller_id_name, cp->caller_id_number, cp->callee_id_name, cp->callee_id_number);
|
||||
#endif
|
||||
|
||||
cp->caller_id_name = cp->callee_id_name;
|
||||
cp->caller_id_number = cp->callee_id_number;
|
||||
|
||||
cp->callee_id_name = tname;
|
||||
cp->callee_id_number = tnum;
|
||||
|
||||
if (zstr(cp->caller_id_name)) {
|
||||
cp->caller_id_name = "Unknown";
|
||||
}
|
||||
|
||||
if (zstr(cp->caller_id_number)) {
|
||||
cp->caller_id_number = "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel)
|
||||
{
|
||||
switch_event_t *event;
|
||||
|
|
|
@ -1652,20 +1652,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
|
|||
originator_cp = switch_channel_get_caller_profile(originator_channel);
|
||||
originatee_cp = switch_channel_get_caller_profile(originatee_channel);
|
||||
|
||||
|
||||
|
||||
if (switch_channel_outbound_display(originator_channel)) {
|
||||
switch_channel_invert_cid(originator_channel);
|
||||
|
||||
if (switch_channel_direction(originator_channel) == SWITCH_CALL_DIRECTION_INBOUND) {
|
||||
switch_channel_clear_flag(originatee_channel, CF_BLEG);
|
||||
}
|
||||
}
|
||||
|
||||
if (switch_channel_inbound_display(originatee_channel)) {
|
||||
const char *tname = originatee_cp->caller_id_name;
|
||||
const char *tnum = originatee_cp->caller_id_number;
|
||||
|
||||
#ifdef DEEP_DEBUG_CID
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SWAP [%s][%s] [%s][%s]\n", originatee_cp->caller_id_name, originatee_cp->caller_id_number, originatee_cp->callee_id_name, originatee_cp->callee_id_number);
|
||||
#endif
|
||||
|
||||
originatee_cp->caller_id_name = originatee_cp->callee_id_name;
|
||||
originatee_cp->caller_id_number = originatee_cp->callee_id_number;
|
||||
|
||||
originatee_cp->callee_id_name = tname;
|
||||
originatee_cp->callee_id_number = tnum;
|
||||
|
||||
switch_channel_invert_cid(originatee_channel);
|
||||
|
||||
if (switch_channel_direction(originatee_channel) == SWITCH_CALL_DIRECTION_INBOUND) {
|
||||
switch_channel_set_flag(originatee_channel, CF_BLEG);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue