I am trying to use ARI to get Asterisk to play a media file from a URL, but it doesn’t play and according to the debug log, Asterisk adds a “file extension” at the end of the URL. I’m sending a pre-signed S3 download URL, which is pretty big, and of course adding the “file extension” breaks the URL.
Here is my request from ARI debug log:
VERBOSE[12238]: res_ari.c:1015 in ast_ari_callback: <--- ARI request received from: 172.17.0.3:44078 --->
Host: localhost
Connection: close
api_key: app:app
media: sound:https://that-bucket-1k156onx1jtz9.s3.us-east-2.amazonaws.com/b/a/8c/a4ddfd0d9f8e0672c485af83ffda8f308e.wav?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEO7%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMiJHMEUCIQDAY3xWoYV%2FTXov9ONtnVybDq7JLUBHQiG1qJhzYnlU%2FwIgN10zZzNwB%2BeT212Jr6Ja0inygaoUPWMcf5tYfjHEWL4qvQMImP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARACGgw3NTY2NDU2NTgzMTQiDNQBslg33la%2F40l2GyqRA94iY4jizTKdQXikTGQ6Ivcw8%2F%2BnnHmuEYwN%2FLenCCdS8OILimw3wsF7LrqgC073l7xgQ1rWTyZYMEWYQa9W6XswTn9SJtmNZRdjp0mRL5rYgXcLGHpzfPE8WpMDseVrw9%2FojuM2NXieYQY6a7xMof5fzf4eqZq8luRq9VWaOeZ5dqRj85NoC22nYvBqIg7mKacCRDKrWnQihLymaP75pikCb7LZMt69YNzivkoIrrvQgrHybyN1puV4aDfdAHe67KwpFnTRzADkJ5ZB9I0KgCIK0qYXchIZ9Rbz%2Fwjiek0HWuS37AadRCbXsxaaluEDHX5c2Koyo2UkG21OJKbVt5XTAD%2BGzkI1v71D1aMXZpqyxtiemcxEf%2BvmrP1tv780Zek56aUStslJHiDOSP19IrgP6qBuWkvdTcQ8rGKME6qhaJekmOg%2B%2B1aFCoVtUVGhg5%2FHEqu%2FN4U1igguhf5Zm0yALHCQ1kewfyi9jO%2F%2BVVnLd0F0BgBzFZ7mGZx%2FUJ14NfNOJCq2yNjQgW4i58uaPluLMOSB7fEFOusBfexPvnCQgZpjAUvyitO0VGK3LBK4wlvojhxP%2Fh5KF4AVj0lY5udR7Tzc%2FTHvoV%2BRBv%2BtEhoh%2BFR2gJ%2B3y5%2FLajAed0HkSMOVP19rBpHO7kkALBJMy%2FvQk3gn4c30sMGyvyTnMEHupV3StPOqIoN3TX089uZufdNuKDwjhPUSa7Ya6gF8HfxXfVYOY1NiLoeYEp6WGoWE5oMz%2B5iVKYgK0sQHdo9BFD4IWRl5C2pPxfqbqoiQzMuYMey3TOJthlcrRT5O1CofdApk3p4adRUKj0QKbL0RfRwHUjtefFCN96WZ2gE3Ywcw%2BikzXA%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20200205T225611Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=ASIA3AK4YP3FNTODOWC5%2F20200205%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Signature=f088ab244b03610317f2bddcf869240ab155c6a68e590a55d494e5ceae42834d
lang: en
offsetms: 0
skipms: 0
playbackId: 71758956-403a-4758-a14e-3f2887759b6d
body:
[1.8K blob data]
And here’s the “playback started” event sent from ARI:
VERBOSE[9418]: ari/resource_events.c:130 in stasis_app_message_handler: <--- Sending ARI event to 172.17.0.3:40118 --->
{
"type": "PlaybackStarted",
"timestamp": "2020-02-05T22:56:11.398+0000",
"playback": {
"id": "71758956-403a-4758-a14e-3f2887759b6d",
"media_uri": "sound:https://that-bucket-1k156onx1jtz9.s3.us-east-2.amazonaws.com/b/a/8c/a4ddfd0d9f8e0672c485af83ffda8f308e.wav?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEO7%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMiJHMEUCIQDAY3xWoYV%2FTXov9ONtnVybDq7JLUBHQiG1qJhzYnlU%2FwIgN10zZzNwB%2BeT212Jr6Ja0inygaoUPWMcf5tYfjHEWL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=ASIA3AK4YP3FNTODOWC5%2F20200205%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Signature=f088ab244b03610317f2bddcf869240ab155c6a68e590a55d494e5ceae42834d",
"target_uri": "channel:1580943369.6",
"language": "en",
"state": "playing"
},
"asterisk_id": "06:72:0c:52:7c:b0",
"application": "app"
}
Then I get these two lines in the asterisk core debug log - I’m not sure what the first means and whether it is related at all, but the second one shows an obvious problem:
WARNING[12215][C-00000004]: db.c:334 in ast_db_put: Family and key length must be less than 253 bytes
VERBOSE[12215][C-00000004]: file.c:1295 in ast_streamfile: <SIP/my.domain-00000003> Playing 'https://that-bucket-1k156onx1jtz9.s3.us-east-2.amazonaws.com/b/a/8c/a4ddfd0d9f8e0672c485af83ffda8f308e.wav?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEO7%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMiJHMEUCIQDAY3xWoYV%2FTXov9ONtnVybDq7JLUBHQiG1qJhzYnlU%2FwIgN10zZzNwB%2BeT212Jr6Ja0inygaoUPWMcf5tYfjHEWL4qvQMImP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARACGgw3NTY2NDU2NTgzMTQiDNQBslg33la%2F40l2GyqRA94iY4jizTKdQXikTGQ6Ivcw8%2F%2BnnHmuEYwN%2FLenCCdS8OILimw3wsF7LrqgC073l7xgQ1rWTyZYMEWYQa9W6XswTn9SJtmNZRdjp0mRL5rYgXcLGHpzfPE8WpMDseVrw9%2FojuM2NXieYQY6a7xMof5fzf4eqZq8luRq9VWaOeZ5dqRj85NoC22nYvBqIg7mKacCRDKrWnQihLymaP75pikCb7LZMt69YNzivkoIrrvQgrHybyN1puV4aDfdAHe67KwpFnTRzADkJ5ZB9I0KgCIK0qYXchIZ9Rbz%2Fwjiek0HWuS37AadRCbXsxaaluEDHX5c2Koyo2UkG21OJKbVt5XTAD%2BGzkI1v71D1aMXZpqyxtiemcxEf%2BvmrP1tv780Zek56aUStslJHiDOSP19IrgP6qBuWkvdTcQ8rGKME6qhaJekmOg%2B%2B1aFCoVtUVGhg5%2FHEqu%2FN4U1igguhf5Zm0yALHCQ1kewfyi9jO%2F%2BVVnLd0F0BgBzFZ7mGZx%2FUJ14NfNOJCq2yNjQgW4i58uaPluLMOSB7fEFOusBfexPvnCQgZpjAUvyitO0VGK3LBK4wlvojhxP%2Fh5KF4AVj0lY5udR7Tzc%2FTHvoV%2BRBv%2BtEhoh%2BFR2gJ%2B3y5%2FLajAed0HkSMOVP19rBpHO7kkALBJMy%2FvQk3gn4c30sMGyvyTnMEHupV3StPOqIoN3TX089uZufdNuKDwjhPUSa7Ya6gF8HfxXfVYOY1NiLoeYEp6WGoWE5oMz%2B5iVKYgK0sQHdo9BFD4IWRl5C2pPxfqbqoiQzMuYMey3TOJthlcrRT5O1CofdApk3p4adRUKj0QKbL0RfRwHUjtefFCN96WZ2gE3Ywcw%2BikzXA%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20200205T225611Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=ASIA3AK4YP3FNTODOWC5%2F20200205%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Signature=f088ab244b03610317f2bddcf869240ab155c6a68e590a55d494e5ceae42834d.slin' (language 'en')
This used to work for me on Asterisk 14, I believe. I upgraded recently to Asterisk 16.7.0, and haven’t tested this feature up until now and now I can’t get it to work.
BTW - if I submit a URL that is broken (happened by mistake), Asterisk correctly reports that it got a 403 error. If I encode WAV file differently from 16 bit signed linear 1 channel 8Khz, then Asterisk complains that its the wrong format - for example:
WARNING[13940][C-00000005]: format_wav.c:111 in check_header_fmt: Unexpected frequency mismatch 24000 (expecting 8000)
WARNING[13940][C-00000005]: file.c:473 in fn_wrapper: Unable to open format wav
WARNING[13940][C-00000005]: file.c:1255 in ast_streamfile: Unable to open https://that-bucket-1k156onx1jtz9.s3.us-east-2.amazonaws.com/b/a/8c/a4ddfd0d9f8e0672c485af83ffda8f308e.wav?X-Amz-Security-Token...7e92 (format (g722)): No such file or directory
WARNING[13940][C-00000005]: res_stasis_playback.c:276 in playback_final_update: 1580944186.8: Playback failed for sound:https://that-bucket-1k156onx1jtz9.s3.us-east-2.amazonaws.com/b/a/8c/a4ddfd0d9f8e0672c485af83ffda8f308e.wav?X-Amz-Security-Token=...7e92
(not sure what it means by (format (g722))
- it most definetly isn’t), but if the URL is correct - and I can put it my browser and hear the wav playing - Asterisk doesn’t play: not only do I not hear the sound, even if the audio is pretty long, Asterisk terminates the playback almost immediately - so I know it doesn’t actually plays anything.
What am I missing?