]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge script <automerge@asterisk.org>
Wed, 1 Nov 2006 19:03:30 +0000 (19:03 +0000)
committerAutomerge script <automerge@asterisk.org>
Wed, 1 Nov 2006 19:03:30 +0000 (19:03 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@46800 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_monitor.c

index 642114a1369ce74b9f89aa62a475c1ac1316edce..b64b5c7997921c6dda44beaa9e622210853db2ba 100644 (file)
@@ -209,6 +209,23 @@ int ast_monitor_start(     struct ast_channel *chan, const char *format_spec,
        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)
 {
@@ -257,7 +274,7 @@ int ast_monitor_stop(struct ast_channel *chan, int need_lock)
                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;
@@ -266,6 +283,7 @@ int ast_monitor_stop(struct ast_channel *chan, int need_lock)
                        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");