Author: anthm Date: Sat Nov 24 16:09:52 2007 New Revision: 6394 Modified: freeswitch/trunk/conf/autoload_configs/voicemail.conf.xml freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Log: solution for MODAPP-52 Modified: freeswitch/trunk/conf/autoload_configs/voicemail.conf.xml ============================================================================== --- freeswitch/trunk/conf/autoload_configs/voicemail.conf.xml (original) +++ freeswitch/trunk/conf/autoload_configs/voicemail.conf.xml Sat Nov 24 16:09:52 2007 @@ -29,6 +29,8 @@ <param name="restart-key" value="1"/> <param name="ff-key" value="6"/> <param name="rew-key" value="4"/> + <param name="record-silence-threshold" value="200"/> + <param name="record-silence-hits" value="2"/> <!-- the next two both must be set for this to be enabled the extension is in the format of <dest> [<dialplan>] [<context>] --> Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c ============================================================================== --- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original) +++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Sat Nov 24 16:09:52 2007 @@ -93,6 +93,8 @@ uint32_t max_login_attempts; uint32_t max_record_len; switch_mutex_t *mutex; + uint32_t record_threshold; + uint32_t record_silence_hits; #ifdef SWITCH_HAVE_ODBC switch_odbc_handle_t *master_odbc; #else @@ -297,6 +299,8 @@ char *email_headers = ""; char *email_from = ""; char *date_fmt = "%A, %B %d %Y, %I %M %p"; + uint32_t record_threshold = 200; + uint32_t record_silence_hits = 2; switch_core_db_t *db; uint32_t timeout = 10000, max_login_attempts = 3, max_record_len = 300; @@ -384,6 +388,26 @@ callback_context = val; } else if (!strcasecmp(var, "file-extension")) { file_ext = val; + } else if (!strcasecmp(var, "record-silence-threshold")) { + int tmp = 0; + if (!switch_strlen_zero(val)) { + tmp = atoi(val); + } + if (tmp >= 0 && tmp <= 10000) { + record_threshold = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid threshold value [%s] must be between 0 and 10000 ms\n", val); + } + } else if (!strcasecmp(var, "record-silence-hits")) { + int tmp = 0; + if (!switch_strlen_zero(val)) { + tmp = atoi(val); + } + if (tmp >= 0 && tmp <= 1000) { + record_silence_hits = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid threshold value [%s] must be between 0 and 1000 ms\n", val); + } } else if (!strcasecmp(var, "tone-spec")) { tone_spec = val; } else if (!strcasecmp(var, "digit-timeout")) { @@ -501,7 +525,8 @@ *profile->rew_key = *rew_key; *profile->urgent_key = *urgent_key; *profile->operator_key = *operator_key; - + profile->record_threshold = record_threshold; + profile->record_silence_hits = record_silence_hits; profile->operator_ext = switch_core_strdup(globals.pool, operator_ext); profile->storage_dir = switch_core_strdup(globals.pool, storage_dir); @@ -793,8 +818,8 @@ TRY_CODE(switch_ivr_gentones(session, profile->tone_spec, 0, NULL)); memset(&fh, 0, sizeof(fh)); - fh.thresh = 200; - fh.silence_hits = 2; + fh.thresh = profile->record_threshold; + fh.silence_hits = profile->record_silence_hits; switch_ivr_record_file(session, &fh, file_path, &args, profile->max_record_len);