Summary:ASTERISK-02000: [post-1.0][patch] Custom command line for musiconhold software execution
Reporter:gryn (gryn)Labels:
Date Opened:2004-07-12 18:37:32Date Closed:2008-01-15 15:02:48.000-0600
Versions:Frequency of
Environment:Attachments:( 0) moh-customcommand_mode-1.diff
( 1) moh-customcommand_mode-2.diff
Description:Asterisk does not work with anything but mpg123-0.59r.  It doesn't even work with 0.59s.

With regards to 0.59s support the problem has to do with the -f command line option.  Apparantly only passing a -f 1 works correctly.

Asterisk passes -f 32768 and -r 8000. I have not tested to see if the -r 8000 parameter is part of the problem or not.

Asterisk has no current way to change the -f parameter to 1, besides a source code change. I could not find out where the problem lay in mpg123-0.59s, as the changes (between 0.59s and 0.59r) that I spotted seemed benign.

What seems to grate me, though, is that asterisk does not let you choose the command line option (even if it's at your own risk).  Support for 0.59s would be available then, and in addition supporting wav files or ogg files or whatever would be possible (though the collection would probably still need to be homogeneous).


I would like to submit (or request) a patch to allow one to specify the entire command line for running MOH.  Alot of other solutions could be presented, but I feel this is the most straight-forward one.
Comments:By: Mark Spencer (markster) 2004-07-12 21:10:18

Maybe we need another program?  It is not clear that mpg123's license would allow us to bring it into Asterisk CVS.

By: gryn (gryn) 2004-07-12 21:45:00

libmad is not pretty (code-wise) but it is functional, fast and an accurate decoder, if you are looking for -integrating- mp3 support into Asterisk.

edited on: 07-12-04 22:34

By: Mark Spencer (markster) 2004-07-12 22:07:25

It has to support volume and resampling rate.  does it?

By: gryn (gryn) 2004-07-12 22:42:02

I'm not suggesting we should integrate support, though feel free to.  libmad does not support resampling to my knowledge and volume control is a fairly simple thing to do (mpg123 just coverts the sample to a float, does a multiply and then converts back to integer).

I'd be willing to write or find some downsampling code if that's an avenue you want to pursue.

In the meantime here is a patch that I think solves most problems, at least temporarily.  It adds a 'customcommand' mode to the music on hold functionality.  The miscellaneous args section is then used as the command to execute, instead of "mpg123 -f 8128 -r 8000 etc...".  With this you can play back ogg files (untested) use mpg123 version 0.59s (the newest) (untested).  And just run mpg123 version 0.59r the same way as always (tested).

edited on: 07-12-04 22:29

By: Mark Spencer (markster) 2004-07-12 22:52:55

How about just "custom" instead of "customcommand", otherwise looks fine.

By: Mark Spencer (markster) 2004-07-12 22:53:15

oh, and maybe an example using ogg123 if it's possible.

By: gryn (gryn) 2004-07-12 23:01:31

I can't give an example of ogg123 without using a shell script wrapper.  ogg123 does not support resampling, so you'd have to pipe it though sox.  I can do that if you'd like (need to include the shell script as well as the configuration line calling it).

By: Olle Johansson (oej) 2004-07-13 01:44:23

Changed Summary line to better reflect current status of this bug report

By: Mark Spencer (markster) 2004-07-16 01:06:15

Also, we need to have a disclaimer on file.

By: gryn (gryn) 2004-07-16 08:45:41


By: Mark Spencer (markster) 2004-07-17 16:27:39

Merged in CVS

By: Digium Subversion (svnbot) 2008-01-15 15:02:48.000-0600

Repository: asterisk
Revision: 3460

U   trunk/apps/Makefile
D   trunk/apps/app_agi.c
U   trunk/configs/musiconhold.conf.sample
A   trunk/include/asterisk/agi.h
U   trunk/res/Makefile
A   trunk/res/res_agi.c
U   trunk/res/res_musiconhold.c

r3460 | markster | 2008-01-15 15:02:48 -0600 (Tue, 15 Jan 2008) | 2 lines

Merge musiconhold stuff (bug ASTERISK-2000), restructure AGI to eventually support registration