diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 6db5f8a2cd..fcf89a6845 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -25,7 +25,7 @@ * * Marc Olivier Chouinard * Emmanuel Schmidbauer - * + * Ítalo Rossi * * mod_callcenter.c -- Call Center Module * @@ -2518,6 +2518,7 @@ SWITCH_STANDARD_APP(callcenter_function) const char *cc_base_score = switch_channel_get_variable(member_channel, "cc_base_score"); int cc_base_score_int = 0; const char *cur_moh = NULL; + char *moh_expanded = NULL; char start_epoch[64]; switch_event_t *event; switch_time_t t_member_called = local_epoch_time_now(NULL); @@ -2679,6 +2680,7 @@ SWITCH_STANDARD_APP(callcenter_function) cur_moh = switch_core_session_strdup(member_session, queue->moh); } queue_rwunlock(queue); + moh_expanded = switch_channel_expand_variables(member_channel, cur_moh); while (switch_channel_ready(member_channel)) { switch_input_args_t args = { 0 }; @@ -2701,9 +2703,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_core_session_flush_private_events(member_session); - if (moh_valid && cur_moh) { - switch_status_t status = switch_ivr_play_file(member_session, NULL, cur_moh, &args); - + if (moh_valid && moh_expanded) { + switch_status_t status = switch_ivr_play_file(member_session, NULL, moh_expanded, &args); if (status == SWITCH_STATUS_FALSE /* Invalid Recording */ && SWITCH_READ_ACCEPTABLE(status)) { /* Sadly, there doesn't seem to be a return to switch_ivr_play_file that tell you the file wasn't found. FALSE also mean that the channel got switch to BRAKE state, so we check for read acceptable */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_WARNING, "Couldn't play file '%s', continuing wait with no audio\n", cur_moh); @@ -2724,6 +2725,9 @@ SWITCH_STANDARD_APP(callcenter_function) } switch_yield(1000); } + if (moh_expanded != cur_moh) { + switch_safe_free(moh_expanded); + } /* Make sure an agent was found, as we might break above without setting it */ if (!agent_found && (p = switch_channel_get_variable(member_channel, "cc_agent_found"))) {