tweaks for caller id in certian uuid_bridge situations

This commit is contained in:
Anthony Minessale 2013-03-28 22:17:28 -05:00
parent 32b7673cde
commit aca9257f93
4 changed files with 47 additions and 8 deletions

View File

@ -187,6 +187,7 @@ SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel);
\param caller_profile the profile to assign \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_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 \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 channel channel to assign the profile to
\param caller_profile the profile to assign \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); 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 channel channel to assign the profile to
\param caller_profile the profile to assign \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 \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(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_DECLARE(switch_status_t) switch_channel_state_thread_trylock(switch_channel_t *channel);
SWITCH_END_EXTERN_C SWITCH_END_EXTERN_C
#endif #endif
/* For Emacs: /* For Emacs:

View File

@ -2906,7 +2906,7 @@ SWITCH_STANDARD_APP(fifo_function)
if (node && other_session) { if (node && other_session) {
switch_channel_t *other_channel = switch_core_session_get_channel(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 *o_announce = NULL;
const char *record_template = switch_channel_get_variable(channel, "fifo_record_template"); const char *record_template = switch_channel_get_variable(channel, "fifo_record_template");
char *expanded = NULL; 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_by", my_id);
switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session)); switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
switch_channel_set_flag(other_channel, CF_BREAK); switch_channel_set_flag(other_channel, CF_BREAK);
while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && while (switch_channel_ready(channel) && switch_channel_ready(other_channel) &&
@ -2981,15 +2980,29 @@ SWITCH_STANDARD_APP(fifo_function)
} }
switch_channel_answer(channel); 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_assert(cloned_profile);
switch_channel_set_originator_caller_profile(other_channel, 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);
switch_assert(cloned_profile->next == NULL); switch_assert(cloned_profile->next == NULL);
switch_channel_set_originatee_caller_profile(channel, cloned_profile); 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(); ts = switch_micro_time_now();
switch_time_exp_lt(&tm, ts); switch_time_exp_lt(&tm, ts);
epoch_start = (long)switch_epoch_time_now(NULL); epoch_start = (long)switch_epoch_time_now(NULL);

View File

@ -2497,8 +2497,18 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
switch_mutex_unlock(channel->profile_mutex); 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) SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile)
{ {
char *uuid = NULL; char *uuid = NULL;
@ -2561,7 +2571,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(swit
return profile; 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 != NULL);
switch_assert(channel->caller_profile != 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 != NULL);
switch_assert(channel->caller_profile != NULL); switch_assert(channel->caller_profile != NULL);

View File

@ -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_name", originator_cp->caller_id_name);
switch_channel_set_variable(originator_channel, "original_caller_id_number", originator_cp->caller_id_number); 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_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)); 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(originator_channel);
switch_channel_stop_broadcast(originatee_channel); switch_channel_stop_broadcast(originatee_channel);