Asterisk ARI resource not found

Hello! I hope everyone is doing fine
so I am trying to use ARI on asterisk 18
I have enabled the HTTP in http.conf and added user in ari.conf
when I list all the channels its working fine
http://127.0.0.1:8088/ari/channels
[{“id”:“1722159514.1”,“name”:“PJSIP/990099-00000001”,“state”:“Up”,“protocol_id”:“MJIDoX21Lb602GXIm1nJBg…”,“caller”:{“name”:“990099”,“number”:“990099”},“connected”:{“name”:“”,“number”:“”},“accountcode”:“”,“dialplan”:{“context”:“sub-echotest”,“exten”:“s”,“priority”:4,“app_name”:“Playback”,“app_data”:“demo-echotest”},“creationtime”:“2024-07-28T05:38:34.247-0400”,“language”:“en”}]

but when I try to do any operation on the channels like
http://127.0.0.1:8088/ari/channels/PJSIP/990099-00000001/hold
it returns
{“message”:“Resource not found”}

I tried to enable debud mode to see if I can fine any info
this is what its shows
[2024-07-28 05:43:48] DEBUG[1594964]: http.c:1417 handle_uri: HTTP Request URI is /ari/channels/PJSIP/990099-00000001/hold
[2024-07-28 05:43:48] DEBUG[1594964]: http.c:1472 handle_uri: match request [ari/channels/PJSIP/990099-00000001/hold] with handler [httpstatus] len 10
[2024-07-28 05:43:48] DEBUG[1594964]: http.c:1472 handle_uri: match request [ari/channels/PJSIP/990099-00000001/hold] with handler [ari] len 3
[2024-07-28 05:43:48] DEBUG[1594964]: http.c:1488 handle_uri: Match made with [ari]
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:507 ast_ari_invoke: Finding handler for channels/PJSIP/990099-00000001/hold
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:514 ast_ari_invoke: Finding handler for channels
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking ari events: Didn’t match channels
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking ari endpoints: Didn’t match channels
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking ari recordings: Didn’t match channels
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:529 ast_ari_invoke: Checking ari channels: Explicit match with channels
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:514 ast_ari_invoke: Finding handler for PJSIP
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channels create: Didn’t match PJSIP
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:525 ast_ari_invoke: Checking channels channelId: Matched wildcard.
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channels externalMedia: Didn’t match PJSIP
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:536 ast_ari_invoke: No explicit handler found for PJSIP. Using wildcard channelId.
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:514 ast_ari_invoke: Finding handler for 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId continue: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId move: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId redirect: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId answer: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId ring: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId dtmf: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId mute: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId hold: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId moh: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId silence: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId play: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId record: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId variable: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId snoop: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId dial: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:531 ast_ari_invoke: Checking channelId rtp_statistics: Didn’t match 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: res_ari.c:544 ast_ari_invoke: Handler not found for 990099-00000001
[2024-07-28 05:43:48] DEBUG[1594964]: http.c:568 ast_http_send: HTTP keeping session open. status_code:404

I have looked around and people had issues because there modules were not loaded so I checked again and again all the related modules are there but still not able to make it work

The channel id is the unique id of the channel (1722159514.1 in the output you gave), not the name of the channel. You also can’t arbitrarily do things on channels using ARI that are elsewhere - they generally need to be in ARI.

sorry
thank you for pointing out my idiotic mistake.
what I am trying to do is when even the user presses #9 during the call I need to put both the caller and the call on hold.
now when I use channels id
http://127.0.0.1:8088/ari/channels/1722167346.28/hold
(its a new call so the channel id might be changed)
it says the invalid method

[{“id”:“1722167346.28”,“name”:“PJSIP/990099-0000001c”,“state”:“Up”,“protocol_id”:“DQKCgyG1bZM5vhGxbq4vsg…”,“caller”:{“name”:“uCinema LLC”,“number”:“13078888860”},“connected”:{“name”:“”,“number”:“15163865143”},“accountcode”:“”,“dialplan”:{“context”:“trk-1-dial”,“exten”:“15163865143”,“priority”:42,“app_name”:“Dial”,“app_data”:“PJSIP/15163865143@telnyx,90,kKtrb(sub-set-crm-headers^s^1)U(sub-before-bridging-call^526c393ab4ca41c9^990099^15163865143^yes)”},“creationtime”:“2024-07-28T07:49:06.087-0400”,“language”:“en”},{“id”:“1722167346.29”,“name”:“PJSIP/telnyx-0000001d”,“state”:“Up”,“protocol_id”:“0f543890-6710-4db6-b088-d7cc751f796d”,“caller”:{“name”:“”,“number”:“15163865143”},“connected”:{“name”:“uCinema LLC”,“number”:“13078888860”},“accountcode”:“”,“dialplan”:{“context”:“trk-1-in”,“exten”:“”,“priority”:1,“app_name”:“AppDial”,“app_data”:“(Outgoing Line)”},“creationtime”:“2024-07-28T07:49:06.109-0400”,“language”:“en”}]

this is the new output can you please guide how can I put this channel on hold/unhold

As I said, you can’t arbitrarily do things on channels using ARI if they aren’t in ARI. If you want third party control like that, then that is done using AMI which may or may not have the functionality/capability you want.

yeah, I understand it now. on further improvements in code, I was able to put that channel on hold which invokes the stasis. Still, If I try to do it on some other channel or bridge(I thought of putting the bridge on hold instead of the channel), ARI responds with ‘resource is not in stasis’.
there seem to be limitations on what we can do.

I tried to use channel redirection and then bridge them together later using dialplan application . that’s also not working. The caller channel hangs up after the redirection sub-routine returns.

if you can provide a link or an example on how to redirect a channel and then bridge it again with the current channel. that will be so kind of you.

The basic procedure for using ARI to set up a call is

  • Register a listener for a custom “application” name. This name will be used to filter events related to the channels you create.
  • Create a “mixing” bridge to attach channels to
  • Create the two channels for the two ends of the call, specifying appropriate endpoint specs
  • When you receive the respective ChannelCreated events, attach the channels to the bridge.

For a more detailed example, see the track_call_ari_bridged_async script in my Seaskirt examples repo.

can I add existing channels to the stasis bridge or only channels created inside the stasis can only be bridged together in the stasis bridge? As far as I have experienced now, any channel or bridge that is not part of the stasis or created by stasis can not be manipulated

that’s why I think ARI may not be appropriate for the flow I am trying to achieve.
that’s why I switched to channel redirect and channel bridge application.
I defined a feature map in feature. conf. now when agent and customer are on a call and I press #9 the callee is redirected to the context, extent, and priority play hold music but when the subroutine Returuns caller channel hangsup

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