diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 73eb7f1026..6af8cfb72c 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -187,6 +187,7 @@ SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel); \param caller_profile the profile to assign */ SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); +SWITCH_DECLARE(void) switch_channel_step_caller_profile(switch_channel_t *channel); /*! \brief Retrieve the given channel's caller profile @@ -200,7 +201,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit \param channel channel to assign the profile to \param caller_profile the profile to assign */ -SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); +SWITCH_DECLARE(void) _switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); +#define switch_channel_set_originator_caller_profile(_c, _cp) switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(_c), SWITCH_LOG_CRIT, "%s SET ORIGINATOR\n", switch_channel_get_name(_c)); _switch_channel_set_originator_caller_profile(_c, _cp) SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); @@ -216,7 +218,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_p \param channel channel to assign the profile to \param caller_profile the profile to assign */ -SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); +SWITCH_DECLARE(void) _switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); +#define switch_channel_set_originatee_caller_profile(_c, _cp) switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(_c), SWITCH_LOG_CRIT, "%s SET ORIGINATEE\n", switch_channel_get_name(_c)); _switch_channel_set_originatee_caller_profile(_c, _cp) /*! \brief Retrieve the given channel's originatee caller profile @@ -651,6 +654,7 @@ SWITCH_DECLARE(void) switch_channel_state_thread_lock(switch_channel_t *channel) SWITCH_DECLARE(void) switch_channel_state_thread_unlock(switch_channel_t *channel); SWITCH_DECLARE(switch_status_t) switch_channel_state_thread_trylock(switch_channel_t *channel); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 7e75326147..685517beef 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -2906,7 +2906,7 @@ SWITCH_STANDARD_APP(fifo_function) if (node && other_session) { switch_channel_t *other_channel = switch_core_session_get_channel(other_session); - switch_caller_profile_t *cloned_profile; + switch_caller_profile_t *cloned_profile, *a_cp, *b_cp; const char *o_announce = NULL; const char *record_template = switch_channel_get_variable(channel, "fifo_record_template"); char *expanded = NULL; @@ -2931,7 +2931,6 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id); switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session)); - switch_channel_set_flag(other_channel, CF_BREAK); while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && @@ -2981,15 +2980,29 @@ SWITCH_STANDARD_APP(fifo_function) } switch_channel_answer(channel); - cloned_profile = switch_caller_profile_clone(other_session, switch_channel_get_caller_profile(channel)); + + a_cp = switch_channel_get_caller_profile(channel); + b_cp = switch_channel_get_caller_profile(other_channel); + + + + cloned_profile = switch_caller_profile_clone(other_session, a_cp); switch_assert(cloned_profile); switch_channel_set_originator_caller_profile(other_channel, cloned_profile); - cloned_profile = switch_caller_profile_clone(session, switch_channel_get_caller_profile(other_channel)); + a_cp->callee_id_name = switch_core_strdup(a_cp->pool, b_cp->caller_id_name); + a_cp->callee_id_number = switch_core_strdup(a_cp->pool, b_cp->caller_id_number); + + + cloned_profile = switch_caller_profile_clone(session, b_cp); switch_assert(cloned_profile); switch_assert(cloned_profile->next == NULL); switch_channel_set_originatee_caller_profile(channel, cloned_profile); + b_cp->callee_id_name = switch_core_strdup(b_cp->pool, a_cp->caller_id_name); + b_cp->callee_id_number = switch_core_strdup(b_cp->pool, a_cp->caller_id_number); + + ts = switch_micro_time_now(); switch_time_exp_lt(&tm, ts); epoch_start = (long)switch_epoch_time_now(NULL); diff --git a/src/switch_channel.c b/src/switch_channel.c index f673c8659f..95b7fe0756 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2497,8 +2497,18 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw switch_mutex_unlock(channel->profile_mutex); } +SWITCH_DECLARE(void) switch_channel_step_caller_profile(switch_channel_t *channel) +{ + switch_caller_profile_t *cp; + switch_mutex_lock(channel->profile_mutex); + cp = switch_caller_profile_clone(channel->session, channel->caller_profile); + switch_mutex_unlock(channel->profile_mutex); + + switch_channel_set_caller_profile(channel, cp); +} + SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) { char *uuid = NULL; @@ -2561,7 +2571,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit return profile; } -SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) +SWITCH_DECLARE(void) _switch_channel_set_originator_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) { switch_assert(channel != NULL); switch_assert(channel->caller_profile != NULL); @@ -2625,7 +2635,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_origination_caller_ } -SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) +SWITCH_DECLARE(void) _switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) { switch_assert(channel != NULL); switch_assert(channel->caller_profile != NULL); diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 96d664e5fd..695105b8da 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1648,9 +1648,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu switch_channel_set_variable(originator_channel, "original_caller_id_name", originator_cp->caller_id_name); switch_channel_set_variable(originator_channel, "original_caller_id_number", originator_cp->caller_id_number); + switch_channel_step_caller_profile(originatee_channel); + switch_channel_step_caller_profile(originator_channel); + + originator_cp = switch_channel_get_caller_profile(originator_channel); + originatee_cp = switch_channel_get_caller_profile(originatee_channel); switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp)); switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp)); + + originator_cp->callee_id_name = switch_core_strdup(originator_cp->pool, originatee_cp->caller_id_name); + originator_cp->callee_id_number = switch_core_strdup(originator_cp->pool, originatee_cp->caller_id_number); + + originatee_cp->callee_id_name = switch_core_strdup(originatee_cp->pool, originator_cp->caller_id_name); + originatee_cp->callee_id_number = switch_core_strdup(originatee_cp->pool, originator_cp->caller_id_number); + switch_channel_stop_broadcast(originator_channel); switch_channel_stop_broadcast(originatee_channel);