MP3Player() link with headers

I need to stream mp3 from link like
but it will not open link without’s authorization headers.
sending authorization credentials as get params doesn’t work either
how do I
and send headers?

Whenever I see a multimedia-related question, my instinct is to respond “use FFmpeg”. One of the tools in that suite is ffplay, which can play all kinds of streams, not just files. Its HTTP protocol handler has options for setting custom headers and cookies, which should let you do what you want.

It works from terminal in my local machine

Now, how I should include it in my remote PBX’s dialplan?
like that?
exten => s,n,System(ffplay -headers $'AUTHORIZATION: YOUR_API_KEY\r\nX-USER-ID: YOUR_USER_ID_KEY\r\n' -i

It does not work.

OK, actually I think you want to put the stream through the ffmpeg command to convert it to something Asterisk can play, rather than use ffplay to play it directly.

In my seaskirt_examples repo, there is an example script called ami+agi_audio_player_async. This is an “Async AGI” script which spawns a subprocess running an ffmpeg command to do this sort of conversion.

In order to do real-time playback, I have ffmpeg feeding its output to a named pipe. I give the pipe a name ending in .gsm. Then, when I tell Asterisk to playback by reading from this pipe, I give it the name without the .gsm extension, which Asterisk should automatically add back. Asterisk (at least version 20) will complain about it being nonseekable and a zero-length file, but otherwise it seemed to work.

Lawrence, I’ve checked gitlab repo, bitbucket repo, ami+agi_audio_player_async file, and I’ve no idea what I should do

I’ve noticed example dialplan

exten => _X.,1,Verbose(entering audio player)
exten => _X.,n,AGI(agi:async,audio-player)
exten => _X.,n,Verbose(exiting audio player)
exten => _X.,n,Hangup()

I suppose it’s for opening agi connection

I do not know how to use seaskrit nor how to feed
to seaskrit

I would love to get more explanation

I don’t think you can do what you want to do purely within the dialplan; it’s going to need some scripting, like the examples I linked to.

Ok, I’m a noob at AMI.
What exactly does AGI(agi:async,audio-player)?

exten => _X.,1,Verbose(entering audio player)
exten => _X.,n,AGI(agi:async,audio-player)
exten => _X.,n,Verbose(exiting audio player)
exten => _X.,n,Hangup()

where do I place the scipt ami+agi_audio_player_async and how do I make that AGI(agi:async,audio-player) executes script?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.