[asterisk-dev] Issue 18768: Agi streamfile and MOH

Tilghman Lesher tilghman at meg.abyt.es
Tue Feb 8 11:13:43 CST 2011


On Tuesday 08 February 2011 10:05:55 Olle E. Johansson wrote:
> Friends,
> 
> Today I realized that AGI streamfile turns off MOH before playing, but
> doesn't turn MOH on after streaming of the file is done.
> 
> I do consider this a bug. But it seems to have been that way for a long
> time. Fixing it so MOH turns on automatically might break applications
> out there.  I do need MOH to turn back on, otherwise my Asterisk
> doesn't send any RTP packets at all in IVRs.
> 
> Please go to Mantis and help me figure out how we can proceed!
> 
> https://issues.asterisk.org/view.php?id=18768

Actually, I don't think that's a bug, but rather a corrective measure meant
to ensure that the file is streamed immediately.  When you stream a file, it
merely means that you've queued up the packets from the file to be played.
But Asterisk prefers a generator, if one is available, and MOH is
implemented with a generator.  So to ensure that your file is played
correctly, all generators must be stopped first.  If you want the generator
to continue afterwards, you must start the generator once again.  And
really, you should have stopped the generator (MOH) before playing the file.

Asterisk does some similar corrective measures.  For example, if you forget
to close a file stream when queuing another, Asterisk also does this for
you, to avoid a memory and descriptor leak.  Don't blame Asterisk for fixing
potential issues at runtime; blame yourself for not turning resources off
when you're finished with them.

-- 
Tilghman



More information about the asterisk-dev mailing list