I am using AMI to redirect a channel to a dialplan application that plays an MP3 file from a remote URL using the MP3Player app. It works fine when I have the file location hard coded but when I try to pass the location as a variable it is not picking up the value.
Here is the dialplan code that works when hard coded. I replaced the actual domain name with xxxxx.
Does it work if you define the variable in your dialplan and then pass it to MP3Player?
[app-dropMessage]
exten => s,1,Answer()
same => n,Set(Location=http://xxxxx.net/dss/sounds/users/29/Track2.mp3)
same => n,MP3Player($Llocation})
same => n,Hangup()
If it does then you may want to add in something like a NoOP to echo what the variable is or a Dumpchan() to show all variables and see what you are getting variable wise from AMI.
[app-dropMessage]
exten => s,1,Answer()
same => n,Dumpchan()
same => n,MP3Player(${location})
same => n,Hangup()
Thanks for the reply but setting the variable in the dialplan didn’t work either. It would appear that the MP3Player application is not accepting a variable for the location.
I’m testing with an old version but it looked like the application accepts the variable here.
-- Executing [9503@kiniston-intern:2] Answer("SIP/7124kiniston-00106ab1", "") in new stack
-- Executing [9503@kiniston-intern:3] Set("SIP/7124kiniston-00106ab1", "Location=https://archive.org/download/testmp3testfile/mpthreetest.mp3") in new stack
-- Executing [9503@Kiniston-intern:4] MP3Player("SIP/7124kiniston-00106ab1", "https://archive.org/download/testmp3testfile/mpthreetest.mp3") in new stack
[Dec 13 15:19:47] NOTICE[5794]: app_mp3.c:133 timed_read: Poll timed out/errored out with 0
I’m not sure if the the application handles https streams and I don’t have a working http stream to try, unfortunately your stream url is obfuscated so I can’t test with live data.
Works just fine in my environment being passed as a variable.
exten => 9503,1,NoOP()
same => n,Answer()
same => n,Set(Location=http://digitalspeech.net/dss/sounds/users/29/Track2.mp3)
same => n,MP3Player(${Location})
same => n,Hangup()
I got it to work by setting the variable in the Dial Plan but not when it is being passed by the ami command. I added a NoOp command to show the variable value but it is not showing anything.
Yes, I’m sure that is the problem. Maybe I can send two AMI commands? One using SetVar to set the variable of the app and then send the redirect command.
I got confused, I didnt read you were using redirect, there is no variable parameter on the redirect action, instead you can use origiante action to a local channel with the redirect command