[asterisk-dev] Channel stream status

Sean Kelly keenskelly at gmail.com
Thu Sep 27 09:34:28 CDT 2012


Hi,

I'm migrating an application module from asterisk 1.2 to 1.8. So far it's
been a fairly straightforward process, but I've run into one behavioral
difference in Asterisk that I'm hoping someone here can either vet or make
a suggestion for a better approach.

Our app is an IVR-type machine detection setup where the module plays a
stream specified in the calling arguments while at the same time listening
to the inbound channel audio for various ques. We want the module to clean
up and exit either when it receives a que that it's looking for, or when
the remote hangs up, or when the stream has finished playing out. The first
two work fine, but a working method for detecting the end of the playing
stream seems to have changed between 1.2.x and 1.8.x.

In 1.2 we basically had a big while {} loop and if (! chan->stream) we
would break the loop. At the end of the stream, chan->stream would go null
and this would break just fine. But in 1.8, chan->stream no longer goes
null upon completion. i have been searching for a viable substitute, and so
far what I have come up with is using ast_stream_tell() to watch for the
advancing stream position and when it stops advancing, we have reached the
end, at which point we can break.

Is there a better way? This feels kind of hack-y...

Thanks!
- Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120927/daf2a4a5/attachment.htm>


More information about the asterisk-dev mailing list