aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_monitor.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-01 18:29:05 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-11-01 18:29:05 +0000
commit15bdb1a680f44358128474f6c1bc63c97d260eca (patch)
treefd6b72b9db19dbe858a9244c074a7c9f23eb413f /res/res_monitor.c
parentabf2e713d20bf7e01c2e9d7b7a2e038a0011b9c3 (diff)
Merged revisions 46778 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r46778 | russell | 2006-11-01 13:26:35 -0500 (Wed, 01 Nov 2006) | 17 lines 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) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46779 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_monitor.c')
-rw-r--r--res/res_monitor.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/res/res_monitor.c b/res/res_monitor.c
index 9d7399934..934356aa7 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -233,6 +233,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)
{
@@ -275,7 +292,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;
@@ -285,6 +302,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");