[Asterisk-Dev] Issue with playing audio on channel

Prashant Jois pjois at ualberta.ca
Mon Jul 5 13:21:47 MST 2004


Hi,

I'm trying to write an app that plays a message to a person waiting in the 
call queue.  I want to write this app such that the message is interrupted if 
someone picks up the line.  
I initially tried to use the play_file() function in app_queue.c to perform 
this, but I found that the asterisk ast_streamfile() and associated functions 
are not interrupted when the line is picked up.  
I then tried to use a method similar to that used in musiconhold.  I spawn an 
mp3 player, redirect the output to stdout and read the bytes into the channel.
 This works for the most part, but I'm encountering the problem where the 
message sometimes starts partway through.  
As I understand it, musiconhold does the same thing, except it starts 
streaming from wherever the file is playing, so it doesn't matter where it 
plays from.  
How can I ensure that the file plays from the beginning? Is there a way to use 
ast_streamfile() to have this same functionality?

Thanks for any help,

Prashant





More information about the asterisk-dev mailing list