[asterisk-users] play remote file

Atis Lezdins atis at iq-labs.net
Tue Sep 2 11:24:05 CDT 2008


On Tue, Sep 2, 2008 at 11:44 AM, Pezhman Lali <pezhman_lali at yahoo.com> wrote:
> Dear,
> do u have any idea to playback a remote file (with url address) ?
> for example :
> exten => _X.,1,playback("http://www.test.com/test.gsm");
> best
> Mani
>

No direct way, however you can always download and play then (assuming
file is not huge and on other side of world):

exten => _X.,1,System(wget -o /tmp/test-${UNIQUEID}.gsm
http://www.test.com/test.gsm)
exten => _X.,2,Playback(/tmp/test-${UNIQUEID}.gsm)

I placed ${UNIQUEID} so that other call don't start to overwrite while
first one is playing (altough this should probably be well handled by
filesystem).

You may also try downloading in background, but this is a bit tricky,
you have to assume that download will go faster than playback, and i'm
not completely sure that it will work at all - you're welcome to test:

exten => _X.,1,System((wget -o /tmp/test-${UNIQUEID}.gsm
http://www.test.com/test.gsm)&)
exten => _X.,2,Playback(/tmp/test-${UNIQUEID}.gsm)

This will place wget on background executing and return immediately,
so playback can try handle it.

However more stable would be just mounting remote directory to local
with NFS, or even better push file from web server to Asterisk server.

Regards,
Atis

-- 
Atis Lezdins,
VoIP Project Manager / Developer,
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835



More information about the asterisk-users mailing list