[Freeswitch-svn] [commit] r12864 - freeswitch/trunk/src/mod/applications/mod_conference
FreeSWITCH SVN
anthm at freeswitch.org
Wed Apr 1 07:26:57 PDT 2009
Author: anthm
Date: Wed Apr 1 09:26:57 2009
New Revision: 12864
Log:
clean up pin prommpting and make local override stay local
Modified:
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Wed Apr 1 09:26:57 2009
@@ -4715,11 +4715,6 @@
/* Set the minimum number of members (once you go above it you cannot go below it) */
conference->min = 2;
- /* if the dialplan specified a pin, override the profile's value */
- if (dpin) {
- conference->pin = switch_core_strdup(conference->pool, dpin);
- }
-
/* Indicate the conference is dynamic */
switch_set_flag_locked(conference, CFLAG_DYNAMIC);
@@ -4743,11 +4738,6 @@
goto done;
}
- /* if the dialplan specified a pin, override the profile's value */
- if (dpin) {
- conference->pin = switch_core_strdup(conference->pool, dpin);
- }
-
switch_channel_set_variable(channel, "conference_name", conference->name);
/* Set the minimum number of members (once you go above it you cannot go below it) */
@@ -4769,8 +4759,14 @@
}
rl++;
+ if (!dpin && conference->pin) {
+ dpin = conference->pin;
+ }
+
+
+
/* if this is not an outbound call, deal with conference pins */
- if (enforce_security && conference->pin && *(conference->pin)) {
+ if (enforce_security && !switch_strlen_zero(dpin)) {
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;
@@ -4778,28 +4774,47 @@
/* Answer the channel */
switch_channel_answer(channel);
+
+ if (!conference->pin_sound) {
+ conference->pin_sound = switch_core_strdup(conference->pool, "conference/conf-pin.wav");
+ }
- while (!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
+ if (!conference->bad_pin_sound) {
+ conference->bad_pin_sound = switch_core_strdup(conference->pool, "conference/conf-bad-pin.wav");
+ }
+ while (!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
+ switch_status_t pstatus = SWITCH_STATUS_FALSE;
+
/* be friendly */
if (conference->pin_sound) {
- conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
+ 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_LOG, SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call");
+ switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+ }
+
/* wait for them if neccessary */
- if (strlen(pin_buf) < strlen(conference->pin)) {
+ if (strlen(pin_buf) < strlen(dpin)) {
char *buf = pin_buf + strlen(pin_buf);
char term = '\0';
-
+
status = switch_ivr_collect_digits_count(session,
buf,
sizeof(pin_buf) - strlen(pin_buf),
- strlen(conference->pin) - strlen(pin_buf), "#", &term, 10000, 0, 0);
+ strlen(dpin) - strlen(pin_buf), "#", &term, 10000, 0, 0);
if (status == SWITCH_STATUS_TIMEOUT) {
status = SWITCH_STATUS_SUCCESS;
}
}
- pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, conference->pin) == 0);
+ pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, dpin) == 0);
if (!pin_valid) {
/* zero the collected pin */
memset(pin_buf, 0, sizeof(pin_buf));
More information about the Freeswitch-svn
mailing list