diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 4eac1643b8..0fe6bdda9e 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -335,7 +335,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_flip_cid(switch_channel_t *channel); -SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in); +SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel); /*! \brief Retrieve caller extension from a given channel diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 903d083ccb..51a9621142 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1251,6 +1251,7 @@ typedef enum { CF_JITTERBUFFER, CF_JITTERBUFFER_PLC, CF_DIALPLAN, + CF_BLEG, CF_BLOCK_BROADCAST_UNTIL_MEDIA, CF_CNG_PLC, CF_ATTENDED_TRANSFER, diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 87b4d14da2..084f16cfcb 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -2997,6 +2997,10 @@ SWITCH_STANDARD_APP(fifo_function) originatee_cp->callee_id_name = tname; originatee_cp->callee_id_number = tnum; + + if (switch_channel_direction(other_channel) == SWITCH_CALL_DIRECTION_INBOUND) { + switch_channel_set_flag(other_channel, CF_BLEG); + } } diff --git a/src/switch_channel.c b/src/switch_channel.c index 64e58d0cfe..0a664994ea 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2891,26 +2891,16 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel) } -SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in) +SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel) { - if (in) { - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(channel, CF_DIALPLAN)) { - switch_channel_set_flag(channel, CF_DIALPLAN); - switch_channel_flip_cid(channel); - } - - return; + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND && switch_channel_test_flag(channel, CF_BLEG)) { + switch_channel_flip_cid(channel); + switch_channel_clear_flag(channel, CF_BLEG); + } else if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(channel, CF_DIALPLAN)) { + switch_channel_set_flag(channel, CF_DIALPLAN); + switch_channel_flip_cid(channel); } - - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(channel, CF_DIALPLAN)) { - switch_channel_clear_flag(channel, CF_DIALPLAN); - switch_mutex_lock(channel->profile_mutex); - channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING; - channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING; - switch_mutex_unlock(channel->profile_mutex); - } - } SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_queued_extension(switch_channel_t *channel) @@ -2939,7 +2929,7 @@ SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *chann { switch_assert(channel != NULL); - switch_channel_sort_cid(channel, SWITCH_TRUE); + switch_channel_sort_cid(channel); switch_mutex_lock(channel->profile_mutex); caller_extension->next = channel->caller_profile->caller_extension; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 09a2140ec2..97364b14c0 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1124,6 +1124,15 @@ static const switch_state_handler_table_t signal_bridge_state_handlers = { static void check_bridge_export(switch_channel_t *channel, switch_channel_t *peer_channel) { + switch_caller_profile_t *originator_cp, *originatee_cp; + + originator_cp = switch_channel_get_caller_profile(channel); + originatee_cp = switch_channel_get_caller_profile(peer_channel); + + originator_cp->callee_id_name = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_name); + originator_cp->callee_id_number = switch_core_strdup(originator_cp->pool, originatee_cp->callee_id_number); + + switch_channel_process_export(peer_channel, channel, NULL, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE); switch_channel_process_export(channel, peer_channel, NULL, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE); } @@ -1656,6 +1665,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu originatee_cp->callee_id_name = tname; originatee_cp->callee_id_number = tnum; + + if (switch_channel_direction(originatee_channel) == SWITCH_CALL_DIRECTION_INBOUND) { + switch_channel_set_flag(originatee_channel, CF_BLEG); + } + }