Search code examples
mp3wavasterisk

How to play mp3 or wav from http | https | ftp in asterisk 11


I facing difficulties playing mp3 or wav files remove remore url in asterisk.

I have tried Mp3player, it's working fine for playing but it is not working accepting inputs.

Please somebody tell me any alternate method to play remote files and accept user input.


Solution

  • I think you have read some books about asterisk dialplan.

    You need put your file(for example test.mp3) into /var/lib/asterisk/sounds/

    After that you can do something like this

    exten => _X.,1,Read(temp,test,,,5)
    exten => _X.,2,Set(CDR(userfield)=${temp})
    

    Now you will have in variable temp and in cdr database user output.

    If you need play REMOTE files, you have download that files first. You can do that using something like this:

    exten => _X.,1,Set(/var/lib/asterisk/sounds/temp/${CDR(uniqueid)}.mp3)
    exten => _X.,2,System(wget http://myurl/myfile.mp3 -o /dev/null -O $file)
    exten => _X.,n,Read(temp,${CDR(uniqueid)},,,5)
    exten => _X.,n,Set(CDR(userfield)=${temp})
    

    Sure you have remove old file and also have do somethign with pre-cache/partialy file download etc.

    Other option is put user into conference,force conference gather input and play into conference using mp3player/streamer.

    There are no simple solution for this, you have write alot of code or hire expert.

    As excelent option you can create you own app using c/c++ to work for you scenario.