TJNII
February 16, 2024, 7:02am
1
I’m attempting to follow Overview - Asterisk Documentation to get started with ARI and it’s not going well.
I’ve matched my Asterisk 20.6.0 config to the guide exactly:
$ cat http.conf
[general]
enabled = yes
bindaddr = 0.0.0.0
$ cat ari.conf
[general]
enabled = yes
pretty = yes
[asterisk]
type = user
read_only = no
password = asterisk
The guide gives the following example:
$ wscat -c "ws://localhost:8088/ari/events?api_key=asterisk:asterisk&app=hello-world"
connected (press CTRL+C to quit)
>
However I get 404:
$ wscat -c "ws://127.0.0.1:8088/ari/events?api_key=asterisk:asterisk&app=hello-world"
error: Unexpected server response: 404
[Feb 16 01:53:31] DEBUG[112]: http.c:1958 httpd_helper_thread: HTTP opening session. Top level
[Feb 16 01:53:31] DEBUG[112]: http.c:1417 handle_uri: HTTP Request URI is /ari/events?api_key=asterisk:asterisk&app=hello-world
[Feb 16 01:53:31] DEBUG[112]: http.c:1472 handle_uri: match request [ari/events] with handler [httpstatus] len 10
[Feb 16 01:53:31] DEBUG[112]: http.c:1472 handle_uri: match request [ari/events] with handler [ari] len 3
[Feb 16 01:53:31] DEBUG[112]: http.c:1488 handle_uri: Match made with [ari]
[Feb 16 01:53:31] DEBUG[112]: res_ari.c:507 ast_ari_invoke: Finding handler for events
[Feb 16 01:53:31] DEBUG[112]: res_ari.c:514 ast_ari_invoke: Finding handler for events
[Feb 16 01:53:31] DEBUG[112]: res_ari.c:544 ast_ari_invoke: Handler not found for events
[Feb 16 01:53:31] DEBUG[112]: http.c:568 ast_http_send: HTTP keeping session open. status_code:404
[Feb 16 01:53:31] DEBUG[112]: http.c:2015 httpd_helper_thread: HTTP closing session. Top level
I’ve enabled all modules in modules.conf. I don’t know this API or websockets well enough to do deep dive troubleshooting. Please advise.
TJNII
February 16, 2024, 7:54am
2
This is a config issue. If I start Asterisk after running make samples
with absolutely 0 modifications beyond what’s required to enable ari it works. But I’m struggling to figure out what it’s missing in my real install.
[astvarlibdir]/rest-api/events.json
exists. I’m unable to determine what it’s looking for with core set verbose 4
, core set debug 4
, ari set debug all on
, or even strace on the faulted install.
[pid 4101026] write(1, "[Feb 16 02:26:38] \33[1;32mDEBUG\33[0m[182]: \33[1;37mres_ari.c\33[0m:\33[1;37m507\33[0m \33[1;37mast_ari_invoke\33[0m: Finding handler for events\n", 131) = 131
[pid 4101026] rt_sigprocmask(SIG_BLOCK, ~[], <unfinished ...>
[pid 4101026] <... rt_sigprocmask resumed>[HUP INT PIPE TERM WINCH], 8) = 0
[pid 4101026] getpid( <unfinished ...>
[pid 4101026] <... getpid resumed>) = 36
[pid 4101026] tgkill(36, 36, SIGURG <unfinished ...>
[pid 4101026] <... tgkill resumed>) = 0
[pid 4101026] rt_sigprocmask(SIG_SETMASK, [HUP INT PIPE TERM WINCH], <unfinished ...>
[pid 4101026] <... rt_sigprocmask resumed>NULL, 8) = 0
[pid 4101026] write(1, "[Feb 16 02:26:38] \33[1;32mDEBUG\33[0m[182]: \33[1;37mres_ari.c\33[0m:\33[1;37m514\33[0m \33[1;37mast_ari_invoke\33[0m: Finding handler for events\n", 133 <unfinished ...>
[pid 4101026] <... write resumed>) = 133
[pid 4101026] rt_sigprocmask(SIG_BLOCK, ~[], <unfinished ...>
[pid 4101026] <... rt_sigprocmask resumed>[HUP INT PIPE TERM WINCH], 8) = 0
[pid 4101026] getpid( <unfinished ...>
[pid 4101026] <... getpid resumed>) = 36
[pid 4101026] tgkill(36, 36, SIGURG <unfinished ...>
[pid 4101026] <... tgkill resumed>) = 0
[pid 4101026] rt_sigprocmask(SIG_SETMASK, [HUP INT PIPE TERM WINCH], <unfinished ...>
[pid 4101026] <... rt_sigprocmask resumed>NULL, 8) = 0
[pid 4101026] write(1, "[Feb 16 02:26:38] \33[1;32mDEBUG\33[0m[182]: \33[1;37mres_ari.c\33[0m:\33[1;37m544\33[0m \33[1;37mast_ari_invoke\33[0m: Handler not found for events\n", 135 <unfinished ...>
TJNII
February 16, 2024, 8:21am
3
It’s a module loading issue.
TJNII
February 16, 2024, 8:38am
4
Figured it out. I need these modules in this order:
load = res_http_websocket
load = app_stasis.so
load = res_stasis.so
load = res_stasis_answer.so
load = res_stasis_device_state.so
load = res_stasis_playback.so
load = res_stasis_recording.so
load = res_stasis_snoop.so ; for res_ari_channels.so
load = res_ari.so
load = res_ari_model.so
load = res_ari_playbacks.so
load = res_ari_channels.so
load = res_ari_bridges.so
load = res_ari_endpoints.so
load = res_ari_events.so
load = res_ari_applications.so
load = res_ari_device_states.so
load = res_ari_model.so
load = res_ari_asterisk.so
load = res_ari_sounds.so
load = res_ari_recordings.so
1 Like
VijoyV
March 1, 2024, 11:30am
5
This is a life saver for me. The last “module.conf” entries got the same problem solved!
1 Like
system
Closed
March 31, 2024, 11:30am
6
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.