Summary:ASTERISK-07621: music on hold app apparenlty caches the music when it comes from a stream
Reporter:Raphaël Jacquot (sxpert)Labels:
Date Opened:2006-08-29 10:26:03Date Closed:2011-06-07 14:08:16
Versions:Frequency of
Description:when getting music from an mp3 stream (with mpg123 version s, which works on my amd64, whereas version r doesn't even compile) the following happens

person dials in, gets music on hold
(music on hold starts, and connect to the stream)
person hangs up
(music on hold is stopped, mpg123 continues sending music through the pipe that asterisk stopped reading)

[wait 5 minutes, listening to the stream on some other computer]

person dials in again
(music starts again, reading from the old stuff in the pipe)

[you can notice that it starts playing exactly at the point it was when the last person hanged up]

the proper way to do this of course would be to have a pipe data eating thread that eats up the data while no one needs music on hold so that the stream doesn't get backed up


the moh class:

application=/usr/bin/mpg123 -q -r 8000 -f 8192 -b 2048 --mono -s http://skunk.intuxication.net:9192/

Comments:By: Serge Vecher (serge-v) 2006-08-29 10:32:55

support for mpg123 is completely removed in the upcoming release (1.4), so I am not sure if anybody in the development team will work on this ...

By: Raphaël Jacquot (sxpert) 2006-08-29 10:44:43

is support for reading from an external program via a pipe removed in 1.4 ?
because that's where I think the bug lies.
it appears that asterisk stops reading from the pipe, while the external program does what it is supposed to do and writes to the pipe as long as it can, leaving the OS to store the written data in ram somewhere, then eventually to swap, and then, I guess, the OOM killer kicks in and shoots something down.

By: Russell Bryant (russell) 2006-10-23 20:38:37

There is a reason that version r of mpg123 is the one that is recommended, and this is it.  Asterisk expects that if the program providing the musiconhold source needs to service something like a stream, it will do it even if Asterisk isn't currently reading from the pipe.  mpg123 0.59r does this, and I guess this other version does not.