Revision
15825
Author
mikej
Date
2009-12-07 09:04:58 -0600 (Mon, 07 Dec 2009)

Log Message

mod_vmd: make MIN_TIME configurable via channel variables(MODAPP-372)

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/applications/mod_vmd/mod_vmd.c (15824 => 15825)


--- freeswitch/trunk/src/mod/applications/mod_vmd/mod_vmd.c	2009-12-07 13:35:30 UTC (rev 15824)
+++ freeswitch/trunk/src/mod/applications/mod_vmd/mod_vmd.c	2009-12-07 15:04:58 UTC (rev 15825)
@@ -162,6 +162,8 @@
     /*! A count of how long a distinct beep was detected
      *  by the discreet energy separation algorithm. */
     switch_size_t timestamp;
+	/*! The MIN_TIME to use for this call */
+	int minTime;
 } vmd_session_info_t;
 
 static switch_bool_t process_data(vmd_session_info_t * vmd_info, switch_frame_t * frame);
@@ -312,7 +314,7 @@
 
         if (c < (POINTS - MAX_CHIRP)) {
             vmd_info->state = BEEP_NOT_DETECTED;
-            if (vmd_info->timestamp < MIN_TIME) {
+            if (vmd_info->timestamp < vmd_info->minTime) {
                 break;
             }
 
@@ -541,6 +543,8 @@
     switch_channel_t *channel;
     vmd_session_info_t *vmd_info;
     int i;
+	const char *minTimeString;
+	int mintime = 0;
 
     if (session == NULL)
         return;
@@ -588,6 +592,13 @@
 
     switch_channel_set_private(channel, "_vmd_", bug);
 
+	if ((minTimeString = switch_channel_get_variable(channel, "vmd_min_time")) && (mintime = atoi(minTimeString))) {
+		vmd_info->minTime = mintime;
+	} else {
+		vmd_info->minTime = MIN_TIME;
+	}
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "MIN_TIME for call: %d\n",vmd_info->minTime);
 }
 
 /*! \brief Called when the module shuts down