Summary:ASTERISK-07355: [patch] The 'm' flag to Monitor does not have an effect when recording in ulaw
Reporter:Matthew Nicholson (mnicholson)Labels:
Date Opened:2006-07-18 13:33:43Date Closed:2006-11-01 12:29:16.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 7550.diff
( 1) ast2soxmix.sh
Description:The mixing functionality of the Monitor appliction does not work if the format of the file Asterisk uses is different from what soxmix expects.  This is the case for the ulaw format.  soxmix expects ulaw files to have a .ul extension but Asterisk gives them a ulaw extension which causes the mixing to fail.  Asterisk fails to detect this as well because it does not check the command's return code.

This should happen for other formats where Asterisk and sox disagree on what to call them.


One way to hack around this is to write a shell script that translates between asterisk's and sox's file formats and set it as the MONITOR_EXEC variable.  The other way is to use formats that asterisk and sox agree on (gsm is one).

Also this logic could be written into asterisk, perhaps in the ast_monitor_stop() function or in ast_format or something.
Comments:By: Matthew Nicholson (mnicholson) 2006-07-18 17:18:21

I attached the ast2soxmix.sh script that expects three to four arguments (the two files to mix and the out file name, and the format the files are in).

To use it, put it in the path and set MONITOR_EXEC to "ast2soxmix.sh" and set MONITOR_EXEC_ARGS to the format you are recording in.

If the script gets a format it does not understand, or no format is passed on the command line it executes soxmix just as asterisk would have.  It also deletes the old files.  Right now only "ulaw" and "alaw" are supported.

By: Clod Patry (junky) 2006-07-30 02:09:54

Yep, good catch.
ulaw doesnt work, but ul works great.

Let me know what do you think of my patch, this not require to fork any script for the mix,
it just converts any ulaw to ul. So it's flexible for future additions.

By: Serge Vecher (serge-v) 2006-09-06 09:49:56

junky: what's the reason for this change:
int ast_monitor_unpause(struct ast_channel *chan)
return ast_monitor_set_state(chan, AST_MONITOR_RUNNING);
+ return ast_monitor_set_state(chan, AST_MONITOR_RUNNING);

mnicholson: did you give junky's patch a whirl?

By: Clod Patry (junky) 2006-09-06 15:14:29

serge: just a whitespace changed, they will be ignored by diff -w.
What do you think about the rest?

By: Serge Vecher (serge-v) 2006-09-06 15:25:52

junky: the line above is not removed, so wouldn't that produce two return statement?

Everything else in the patch looks good ...

By: Clod Patry (junky) 2006-09-06 15:35:04

2 return isnt possible, so it will do just the 1st one, i will update my patch.
i coded that in few minutse, just to know input from matt n.

By: Matthew Nicholson (mnicholson) 2006-09-06 17:47:30

We switched to recording in wav, so I can't test this any more.

By: jmls (jmls) 2006-11-01 05:54:24.000-0600

is this required in trunk , as mixmonitor takes care of mixing ?

By: Russell Bryant (russell) 2006-11-01 12:29:15.000-0600

This has been fixed in 1.2, 1.4, and the trunk in revisions 46776, 46778,  and 46779