]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
solution for MODAPP-52
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 24 Nov 2007 21:09:52 +0000 (21:09 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 24 Nov 2007 21:09:52 +0000 (21:09 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6394 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/autoload_configs/voicemail.conf.xml
src/mod/applications/mod_voicemail/mod_voicemail.c

index c91affe6e99fd9ecb1332dcded346da279e0517f..f573d991732d7b03ed09e174b0fd06bada65c467 100644 (file)
@@ -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>]
        -->
index cb1b6b4671d1155e9fc61294470b0edb693c6122..d3544df6d92ecf8c23b19c2e051004e7cb2c952f 100644 (file)
@@ -93,6 +93,8 @@ struct vm_profile {
     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 @@ static switch_status_t load_config(void)
         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 @@ static switch_status_t load_config(void)
                 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 @@ static switch_status_t load_config(void)
             *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 @@ static switch_status_t create_file(switch_core_session_t *session, vm_profile_t
         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);