Summary:ASTERISK-04783: [patch] new musiconhold.conf parser, allow source format to be other than signed linear
Reporter:Russell Bryant (russell)Labels:
Date Opened:2005-08-05 12:55:50Date Closed:2008-01-15 15:44:43.000-0600
Versions:Frequency of
Environment:Attachments:( 0) moh.rev0.patch
( 1) streamplayer.c
Description:1) This updates the musiconhold.conf parser so that classes are defined as a context, and options related to it are set on individual lines.  This will make it so new options are much easier to add.  This also allows musiconhold.conf to be mapped to static realtime.

2) This also allows the non-files based musiconhold to accept source formats other than signed linear.  This can be used to play a stream in a format such as ulaw.

3) I have also included my attempt at writing a simple stream player to be included in contrib/utils/.  However, I'm having some problems with it ...

I was trying to use select to make sure that I would never be making a blocking call to write().  It works great on my FC4 box (2.6 kernel) but when I tested this on a RHEL3 box (2.4 kernel), it does not work as I expected.  It ends up throwing away a lot of the audio and the caller will hear very broken up musiconhold while Asterisk complains about not being able to read enough audio from the pipe.  I commented out all of the select stuff and it appeared to work, but that seems like to me that it could make it so the stream may not get serviced if write() blocks.
Comments:By: Russell Bryant (russell) 2005-08-05 16:14:01

The new configuration still needs testing for the various modes of musiconhold.

By: Russell Bryant (russell) 2005-08-15 02:26:37

MikeJ: stop changing the summary on this to post 1.2.  It needs to go in 1.2.  Kevin knows the history on this.

By: Olle Johansson (oej) 2005-08-15 06:54:29

Is this backwards compatible?

By: Russell Bryant (russell) 2005-08-19 02:36:18

Yes.  If the category is "classes" or "moh_files", then the configuration will be parsed as it was done originally.

By: Kevin P. Fleming (kpfleming) 2005-08-22 15:28:03

Committed to CVS HEAD with minor mods. Thanks!

By: Clod Patry (junky) 2005-08-22 19:27:49

Darwin35 has trouble with that one.

By: Clod Patry (junky) 2005-08-22 19:28:33

this is he just pasted me:
[20:25:42] <Darwin35> streamplayer.c: In function `main':
[20:25:42] <Darwin35> streamplayer.c:26: error: storage size of 'sin' isn't known
[20:25:42] <Darwin35> streamplayer.c:48: warning: implicit declaration of function `htons'
[20:25:42] <Darwin35> streamplayer.c:26: warning: unused variable `sin'
[20:25:42] <Darwin35> gmake[1]: *** [streamplayer.o] Error 1
[20:25:43] <Darwin35> gmake[1]: Leaving directory `/usr/home/projects/asterisk/asterisk/utils'

He's on FreeBSD.

By: Kevin P. Fleming (kpfleming) 2005-08-22 20:38:34

If streamplayer won't compile on FreeBSD then someone with FreeBSD experience will have to help us include the right header files...

By: bsdtech (bsdtech) 2005-08-23 11:17:31

add these #includelines lines to the streamplayer.c and it will compile and run on fbsd.

#ifdef linux
#include <netinet/ip.h>
#include <netinet/tcp.h>
#endif /* linux */

#ifdef __FreeBSD__
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
#endif /* FreeBSD */

By: Michael Jerris (mikej) 2005-08-23 11:21:52

This is now a duplicate of ASTERISK-4882

By: Digium Subversion (svnbot) 2008-01-15 15:44:43.000-0600

Repository: asterisk
Revision: 6353

U   trunk/UPGRADE.txt
U   trunk/configs/musiconhold.conf.sample
U   trunk/frame.c
U   trunk/include/asterisk/frame.h
U   trunk/res/res_musiconhold.c
U   trunk/utils/Makefile
A   trunk/utils/streamplayer.c

r6353 | kpfleming | 2008-01-15 15:44:42 -0600 (Tue, 15 Jan 2008) | 4 lines

support new format for musiconhold.conf (issue ASTERISK-4783)
support non-SLINEAR moh streams (issue ASTERISK-4783)
add external app to feed TCP stream into Asterisk for moh (issue ASTERISK-4783)