simonp22 Posted July 31, 2019 Report Posted July 31, 2019 According to https://github.com/2600hz/kazoo/blob/master/applications/crossbar/doc/media.md You can PUT system media files at the endpoint http://server.com:8000/v2/media How do I reference these using crossbar from an account, say, when creating a menu and I want to use some system media as a menu greeting? "data": { "name": "Test menu 2", "record_pin": "1234", "retries": 3, "suppress_media": false, "timeout": 10000, "interdigit_timeout": 2000, "max_extension_length": 4, "allow_record_from_offnet": true, "hunt": true, "media": { "exit_media": true, "greeting": "{SYSTEM_MEDIA_ID}", "invalid_media": true, "transfer_media": true }, The above doesn't work, what am I missing?
2600Hz Employees ming Posted July 31, 2019 2600Hz Employees Report Posted July 31, 2019 Did you add account id in the url? Next time, it might be helpful to post the error message as well. thanks Here is the link to create a media file. I hope that helps. PUT /v2/accounts/{ACCOUNT_ID}/media https://github.com/2600hz/kazoo/blob/master/applications/crossbar/doc/media.md#create-a-new-media-object-required-before-uploading-the-actual-media-data
simonp22 Posted July 31, 2019 Author Report Posted July 31, 2019 I think you misunderstood the question or didn't read the documentation I attached. I am trying to upload new system media that can be accessed by all accounts. Quote Kazoo provides some default system media files for common things like voicemail prompts. These are accessible via the media Crossbar endpoint as well, if your user has super duper admin privileges. To manipulate those resources, simply omit the /accounts/{ACCOUNT_ID} from the URI. For example, to get a listing of all system media files: curl -v -X GET -H "X-Auth-Token: {AUTH_TOKEN}" http://server.com:8000/v2/media
2600Hz Employees ming Posted July 31, 2019 2600Hz Employees Report Posted July 31, 2019 ok ok. The exact payload seems missing an opening and two closing brackets. I used this payload and was able to load by a super duper account. $ cat media3.json {"data": { "name": "Test menu 2", "record_pin": "1234", "retries": 3, "suppress_media": false, "timeout": 10000, "interdigit_timeout": 2000, "max_extension_length": 4, "allow_record_from_offnet": true, "hunt": true, "media": { "exit_media": true, "greeting": "someformofid", "invalid_media": true, "transfer_media": true }}} -- $ curl -X PUT -d@media3.json -H "X-Auth-Token: $AUTH_TOKEN" http://localhost:8000/v2/media | python -mjson.tool ^ which gives me success status code.
simonp22 Posted July 31, 2019 Author Report Posted July 31, 2019 I also get the success code, but when I put the menu into a callflow and use it, the greeting doesn't play, I just hear whitenoise.
Administrators mc_ Posted July 31, 2019 Administrators Report Posted July 31, 2019 The system_media prompts are intended for the pre-built callflow actions, such as the voicemail prompts, and aren't generally meant for account-level usage. Does that make sense? Instead, you would upload a media file to the account (or a reseller/master account) and reference it with `{ACCOUNT_ID}/{MEDIA_ID}`. You can also try `"greeting":"/system_media/{PROMPT_ID}"` in the JSON if you really want to use a system prompt in a menu callflow action. I think it might work but buyer beware!
simonp22 Posted August 1, 2019 Author Report Posted August 1, 2019 Thankyou for that, however I can still not seem to get it working. I've tried `{ACCOUNT_ID}/{MEDIA_ID}` and `/{ACCOUNT_ID}/{MEDIA_ID}` after putting media under both master and reseller accounts, however all I am hearing is white noise on the line when I enter the menu. I have confirmed that I can play each media through /accounts/{ACCOUNT_ID}/media/{MEDIA_ID}/raw successfully Any ideas?
Administrators mc_ Posted August 1, 2019 Administrators Report Posted August 1, 2019 Can you pull debug kazoo logs of a call attempt? Would be helpful to see what was tried.
simonp22 Posted August 5, 2019 Author Report Posted August 5, 2019 HI, have managed to pull some logs of a couple of things I have tried so far. For reference, the IDs relate as follows: ac1544069b777dc7df4eaa3e244dfa53 - master account ca22586acf157026711a369233f6d2c1 - sub account 141c0020c0642bbccdaeba00c28c8179 - media ID under the master account Proof the media exists in the correct place GET /v2/accounts/ac1544069b777dc7df4eaa3e244dfa53/media { "page_size": 1, "data": [ { "id": "141c0020c0642bbccdaeba00c28c8179", "name": "Inspirational Ideas", "media_source": "upload", "language": "en-us", "is_prompt": false } ], "status": "success" } Menu Referencing GET /v2/accounts/ca22586acf157026711a369233f6d2c1/menus/76df8ec523c8a9b30665557e4cbb1805 { "data": { "name": "Test menu 2", "record_pin": "1234", "retries": 3, "suppress_media": false, "timeout": 10000, "interdigit_timeout": 2000, "max_extension_length": 4, "allow_record_from_offnet": true, "hunt": true, "media": { "exit_media": true, "greeting": "ac1544069b777dc7df4eaa3e244dfa53/141c0020c0642bbccdaeba00c28c8179", "invalid_media": true, "transfer_media": true }, "id": "76df8ec523c8a9b30665557e4cbb1805" }, "status": "success" } Logs when calling the menu 2019-08-05T09:44:43.161906+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_media_url:48(<0.23547.94>) lookup media url for /account%2Fca%2F22%2F5 86acf157026711a369233f6d2c1/ac1544069b777dc7df4eaa3e244dfa53/141c0020c0642bbccdaeba00c28c8179 2019-08-05T09:44:43.162730+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_util:243(<0.23547.94>) raw account id doesn't process '<<"ca/22/586acf157026711a369233f6d2c1">>' 2019-08-05T09:44:43.163552+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_media_file:68(<0.23547.94>) fetching attachment url for '<<"account%2Fca%2F/2%2F2/586acf157026711a369233f6d2c1">>' , '<<"ac1544069b777dc7df4eaa3e244dfa53">>', '<<"141c0020c0642bbccdaeba00c28c8179">>' 2019-08-05T09:44:43.164372+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kzs_util:83(<0.23547.94>) unknown type for database account%2Fca%2F/2%2F2/586acf157026711a369233f6d2c1 2019-08-05T09:44:43.165147+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_util:114(<0.23547.94>) stacktrace: 2019-08-05T09:44:43.178058+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_util:121(<0.23547.94>) st: kzs_util:db_classification/1 at (84) 2019-08-05T09:44:43.195081+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_util:121(<0.23547.94>) st: kzs_plan:get_dataplan/1 at (68) 2019-08-05T09:44:43.212294+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_util:121(<0.23547.94>) st: kzs_plan:plan/2 at (45) 2019-08-05T09:44:43.229812+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_util:121(<0.23547.94>) st: kz_datamgr:attachment_url/4 at (1095) 2019-08-05T09:44:43.247122+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_util:121(<0.23547.94>) st: kz_media_file:maybe_proxy/2 at (70) 2019-08-05T09:44:43.264174+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_util:121(<0.23547.94>) st: media_listener:handle_media_req/2 at (55) 2019-08-05T09:44:43.281600+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_media_file:72(<0.23547.94>) no attachment URL found 2019-08-05T09:44:43.282307+01:00 kazoo-dev-1 2600hz[394]: |1b7b3066-3200-1238-4c8e-0242ac110004|media_listener:147(<0.23547.94>) media stream URL: 2019-08-05T09:44:45.158544+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_amqp_worker:898(<0.489.0>) req timeout for call_collect 2019-08-05T09:44:45.159424+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_util:1303(<0.153.51>) timeout when getting media url from amqp 2019-08-05T09:44:45.160266+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_util:1165(<0.153.51>) failed to get media path for /account%2Fca%2F22%2F586acf157026711a369233f6d2c1/ac1544069b777dc7df4eaa3e244dfa53/141c0020c0642bbccdaeba00c28c8179: timeout 2019-08-05T09:44:45.161132+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_fs_channel:164(<0.153.51>) channel is not bridged 2019-08-05T09:44:45.165851+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_fs_channel:729(<0.192.51>) channel has ecallmgr ecallmgr@{DOMAIN_NAME} (we are ecallmgr@{DOMAIN_NAME}) 2019-08-05T09:44:45.359488+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_util:157(<0.153.51>) execute on node freeswitch@{DOMAIN_NAME}(1b7b3066-3200-1238-4c8e-0242ac110004) kz_multiset(playback_terminators=#*0123456789): ok 2019-08-05T09:44:45.366259+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_call_events:690(<0.147.51>) publishing call event channel_execute_complete 'play(/account/ca/22/586acf157026711a369233f6d2c1/ac1544069b777dc7df4eaa3e244dfa53/141c0020c0642bbccdaeba00c28c8179)' result: file not found 2019-08-05T09:44:45.367171+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_amqp_channel:234(<0.481.0>) published to callevt(direct) exchange (routing key call.CHANNEL_EXECUTE_COMPLETE.1b7b3066-3200-1238-4c8e-0242ac110004) via <0.439.0> 2019-08-05T09:44:45.368014+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|kz_amqp_worker:659(<0.481.0>) published message 1564994685345133 for <0.147.51> 2019-08-05T09:44:45.560315+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_util:157(<0.153.51>) execute on node freeswitch@{DOMAIN_NAME}(1b7b3066-3200-1238-4c8e-0242ac110004) playback(/account%2Fca%2F22%2F586acf157026711a369233f6d2c1/ac1544069b777dc7df4eaa3e244dfa53/141c0020c0642bbccdaeba00c28c8179): ok 2019-08-05T09:44:45.562073+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_call_control:589(<0.153.51>) play finished, checking for group-id/DTMF termination 2019-08-05T09:44:45.562935+01:00 kazoo-dev-1 2600hz[393]: |1b7b3066-3200-1238-4c8e-0242ac110004|ecallmgr_call_control:615(<0.153.51>) media finished playing, advancing control queue
Administrators mc_ Posted August 5, 2019 Administrators Report Posted August 5, 2019 I just checked and I'm pretty sure `/{ACCOUNT_ID}/{MEDIA_ID}` will work (at least in my tests of the underlying code paths). Add the preceding slash and you should be good to go.
simonp22 Posted August 6, 2019 Author Report Posted August 6, 2019 Hi, Also tried that yesterday with the preceding slash and got the following: 2019-08-05T10:25:10.426615+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_media_url:48(<0.12982.95>) lookup media url for /account%2Fca%2F22%2F586acf157026711a369233f6d2c1//ac1544069b777dc7df4eaa3e244dfa53/141c0020c0642bbccdaeba00c28c8179 2019-08-05T10:25:10.427446+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_util:243(<0.12982.95>) raw account id doesn't process '<<"ca/22/586acf157026711a369233f6d2c1">>' 2019-08-05T10:25:10.428272+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_media_file:68(<0.12982.95>) fetching attachment url for '<<"account%2Fca%2F/2%2F2/586acf157026711a369233f6d2c1">>' , '<<"ac1544069b777dc7df4eaa3e244dfa53">>', '<<"141c0020c0642bbccdaeba00c28c8179">>' 2019-08-05T10:25:10.429105+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kzs_util:83(<0.12982.95>) unknown type for database account%2Fca%2F/2%2F2/586acf157026711a369233f6d2c1 2019-08-05T10:25:10.429602+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_util:114(<0.12982.95>) stacktrace: 2019-08-05T10:25:10.434656+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_util:121(<0.12982.95>) st: kzs_util:db_classification/1 at (84) 2019-08-05T10:25:10.459945+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_util:121(<0.12982.95>) st: kzs_plan:get_dataplan/1 at (68) 2019-08-05T10:25:10.477266+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_util:121(<0.12982.95>) st: kzs_plan:plan/2 at (45) 2019-08-05T10:25:10.494397+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_util:121(<0.12982.95>) st: kz_datamgr:attachment_url/4 at (1095) 2019-08-05T10:25:10.511515+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_util:121(<0.12982.95>) st: kz_media_file:maybe_proxy/2 at (70) 2019-08-05T10:25:10.528779+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_util:121(<0.12982.95>) st: media_listener:handle_media_req/2 at (55) 2019-08-05T10:25:10.545937+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|kz_media_file:72(<0.12982.95>) no attachment URL found 2019-08-05T10:25:10.546815+01:00 kazoo-dev-1 2600hz[394]: |c2448444-3205-1238-4c8e-0242ac110004|media_listener:147(<0.12982.95>) media stream URL: 2019-08-05T10:25:12.422576+01:00 kazoo-dev-1 2600hz[393]: |c2448444-3205-1238-4c8e-0242ac110004|kz_amqp_worker:898(<0.543.0>) req timeout for call_collect 2019-08-05T10:25:12.423505+01:00 kazoo-dev-1 2600hz[393]: |c2448444-3205-1238-4c8e-0242ac110004|ecallmgr_util:1303(<0.5274.51>) timeout when getting media url from amqp 2019-08-05T10:25:12.424365+01:00 kazoo-dev-1 2600hz[393]: |c2448444-3205-1238-4c8e-0242ac110004|ecallmgr_util:1165(<0.5274.51>) failed to get media path for /account%2Fca%2F22%2F586acf157026711a369233f6d2c1//ac1544069b777dc7df4eaa3e244dfa53/141c0020c0642bbccdaeba00c28c8179: timeout
Administrators mc_ Posted August 27, 2019 Administrators Report Posted August 27, 2019 @simonp22 no haven't had a chance to try it myself. Let me see how my day goes; I may have a couple minutes this afternoon to setup a test. Thanks for the reminder.
Administrators mc_ Posted August 28, 2019 Administrators Report Posted August 28, 2019 @simonp22 all tests work in my environment. What version of KAZOO are you running? I recommend updating to the latest 4.3 and trying again.
simonp22 Posted August 29, 2019 Author Report Posted August 29, 2019 Hi @mc_ We are currently using 4.2-50. We've done some further testing and media plays from the master account if I add it to a "Play media" node in a callflow. As follows: { "data": { "id": "ac1544069b777dc7df4eaa3e244dfa53/e2e6701e37b23d7ee549763f7d8510a6", "endless_playback": false, "terminators": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#" ] }, "module": "play", "children": {} } But not if I put the same reference in a menu definition in data.media.greeting We will try it on 4.3 to see if it works
Administrators mc_ Posted August 29, 2019 Administrators Report Posted August 29, 2019 Just checked the 4.2 code and indeed, the menu callflow action does not construct the URL in the same way that 4.3/master do. Sorry, I should have asked your version at the start. So this will definitely work when you upgrade to 4.3
Recommended Posts