[Asterisk-Users] Change in audio file while listening to it

Christoph Rothe asterisk-users at christophrothe.de
Mon May 1 22:47:06 MST 2006


Hi Marco,

this is not an asterisk issue, it is a UNIX/Linux-issue.

If you overwrite a file, asterisk of course plays the data it reads from 
the (at that moment overwritten) file.

I would suggest to delete the file and then write the updated file. On 
UNIX if you delete an opened file, the program reading from the deleted 
file still has access to it, until it closes the file.
The problem with this is, that you have a race condition: If asterisk 
tries to read the file at that moment, where you just deleted the file 
and did not yet create a new one, the caller would hear nothing. 
Probably a thing which can be fixed in your dialplan by re-reading the 
file if it is empty.

HTH,

Christoph

Marco Trucchi schrieb:
> Hello everybody,
> does anybody know how to handle the following problem?
>
> I update some gsm audio files every 10 minutes, by rewriting directly 
> on them.
>
> I've noticed that if the file is being played by asterisk exactly in 
> the moment when I rewrite onto it, who is calling hears a small "jump" 
> and then it is the updated file that starts being played, starting 
> from about the same position of the old one.
> (i.e. if the update arrives after 10 seconds of playing on the old 
> file, the updated file starts after the jump about at its 10 second 
> position).
> I would prefer to end up with the old file without changing the 
> current conversation.
>
> Maybe a parameter handle this?
> Otherwise the only way that I see is to give a different name to each 
> file, then let asterisk read the most up-to-date. But it would be not 
> as easy as it is now.
>
> For information, I use Asterisk 1.2.6 on Linux CentOS. I pay a SIP 
> Gateway to have a geographical number that points to my asterisk 
> (sorry if I do not use the correct terms).
>
>
> Thanks a lot!
> Cheers,
> Marco
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users



More information about the asterisk-users mailing list