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
}
-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_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);
+ 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);
}
-
}
SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_queued_extension(switch_channel_t *channel)
{
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;
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);
}
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);
+ }
+
}