[Freeswitch-svn] [commit] r9526 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Thu Sep 11 13:29:09 EDT 2008


Author: anthm
Date: Thu Sep 11 13:29:08 2008
New Revision: 9526

Modified:
   freeswitch/trunk/src/switch_core_io.c

Log:
add last_dtmf_duration variable

Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c	(original)
+++ freeswitch/trunk/src/switch_core_io.c	Thu Sep 11 13:29:08 2008
@@ -1028,6 +1028,7 @@
 	char *string;
 	int i, argc;
 	char *argv[256];
+	int dur_total = 0;
 
 	switch_assert(session != NULL);
 
@@ -1078,10 +1079,17 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
 									  switch_channel_get_name(session->channel), dtmf.digit, dur, dtmf.duration);
 					sent++;
+					dur_total += dtmf.duration + 2000; /* account for 250ms pause */
 				}
 			}
 		}
 
+		if (dur_total) {
+			char tmp[32] = "";
+			switch_snprintf(tmp, sizeof(tmp), "%d", dur_total / 8);
+			switch_channel_set_variable(session->channel, "last_dtmf_duration", tmp);
+		}
+
 	}
 	return sent ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
 }



More information about the Freeswitch-svn mailing list