[asterisk-commits] russell: branch 1.4 r46778 - in /branches/1.4: ./ res/res_monitor.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Nov 1 11:26:35 MST 2006


Author: russell
Date: Wed Nov  1 12:26:35 2006
New Revision: 46778

URL: http://svn.digium.com/view/asterisk?rev=46778&view=rev
Log:
Merged revisions 46776 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r46776 | russell | 2006-11-01 13:24:17 -0500 (Wed, 01 Nov 2006) | 9 lines

soxmix and Asterisk expect different file extensions for certain formats.  This
was already handled for the wav49 format.  However, it was not handled for
ulaw and alaw.  I fixed this in such a way that using the alternate extensions
for ulaw and alaw will only happen if we know we're calling soxmix, and not a
custom script defined using the MONITOR_EXEC variable.  The wav49 processing
was left alone so that external scripts will see no behavior change.
(issue #7550, reported by mnicholson, proposed patch by junky, committed fix
is a bit different)

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/res/res_monitor.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/res/res_monitor.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/res/res_monitor.c?rev=46778&r1=46777&r2=46778&view=diff
==============================================================================
--- branches/1.4/res/res_monitor.c (original)
+++ branches/1.4/res/res_monitor.c Wed Nov  1 12:26:35 2006
@@ -231,6 +231,23 @@
 	return res;
 }
 
+/*
+ * The file format extensions that Asterisk uses are not all the same as that
+ * which soxmix expects.  This function ensures that the format used as the
+ * extension on the filename is something soxmix will understand.
+ */
+static const char *get_soxmix_format(const char *format)
+{
+	const char *res = format;
+
+	if (!strcasecmp(format,"ulaw"))
+		res = "ul";
+	if (!strcasecmp(format,"alaw"))
+		res = "al";
+	
+	return res;
+}
+
 /* Stop monitoring a channel */
 int ast_monitor_stop(struct ast_channel *chan, int need_lock)
 {
@@ -273,7 +290,7 @@
 		if (chan->monitor->joinfiles && !ast_strlen_zero(chan->monitor->filename_base)) {
 			char tmp[1024];
 			char tmp2[1024];
-			char *format = !strcasecmp(chan->monitor->format,"wav49") ? "WAV" : chan->monitor->format;
+			const char *format = !strcasecmp(chan->monitor->format,"wav49") ? "WAV" : chan->monitor->format;
 			char *name = chan->monitor->filename_base;
 			int directory = strchr(name, '/') ? 1 : 0;
 			char *dir = directory ? "" : ast_config_AST_MONITOR_DIR;
@@ -283,6 +300,7 @@
 			execute = pbx_builtin_getvar_helper(chan, "MONITOR_EXEC");
 			if (ast_strlen_zero(execute)) { 
 				execute = "nice -n 19 soxmix";
+				format = get_soxmix_format(format);
 				delfiles = 1;
 			} 
 			execute_args = pbx_builtin_getvar_helper(chan, "MONITOR_EXEC_ARGS");



More information about the asterisk-commits mailing list