From 17b446305e9cde489350dfcf6d4e58146cb1f172 Mon Sep 17 00:00:00 2001 From: George Niculae Date: Fri, 21 Jan 2011 01:25:20 +0200 Subject: [PATCH] Conference pin --- .../applications/mod_conference/mod_conference.c | 37 +++++++++++++------ 1 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 53ce82b..f2f236d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -5530,6 +5530,7 @@ SWITCH_STANDARD_APP(conference_function) char pin_buf[80] = ""; int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */ int pin_valid = 0; + int be_friendly = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; char *supplied_pin_value; @@ -5564,20 +5565,32 @@ SWITCH_STANDARD_APP(conference_function) switch_status_t pstatus = SWITCH_STATUS_FALSE; /* be friendly */ - if (conference->pin_sound) { - pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf)); - } else if (conference->tts_engine && conference->tts_voice) { - pstatus = - switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL); - } else { - pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL); - } + if (!be_friendly) { + if (conference->pin_sound) { + pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf)); + } else if (conference->tts_engine && conference->tts_voice) { + pstatus = + switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL); + } else { + pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL); + } - if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } } + // play "please enter the conference pin number" prompt just one time, if wrong pin play only "try again" + be_friendly = 1; + // clear remaining pin without decrementing pin_retries as this was already performed before + if (strlen(pin_buf) > 0) { + memset(pin_buf, 0, sizeof(pin_buf)); + if (conference->bad_pin_sound) { + conference_local_play_file(conference, session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf)); + } + continue; + } /* wait for them if neccessary */ if (strlen(pin_buf) < strlen(dpin)) { char *buf = pin_buf + strlen(pin_buf); -- 1.7.2.3