ARI/http server log

I am trying to debug a problem which my ARI calls /ari/asterisk/info and fails with “invalid method” message. But only when called from my C code, but works fine called from command line with curl. When my C program runs it generates the output below in the Asterisk CLI. It would appear that the ARI is correctly parsing the URL to find the info command. Does anyone see a problem below?

[2024-03-17 16:28:52] DEBUG[1538019]: http.c:1958 httpd_helper_thread: HTTP opening session.  Top level
[2024-03-17 16:28:52] DEBUG[1538019]: http.c:1417 handle_uri: HTTP Request URI is /ari/asterisk/info
[2024-03-17 16:28:52] DEBUG[1538019]: http.c:1472 handle_uri: match request [ari/asterisk/info] with handler [httpstatus] len 10
[2024-03-17 16:28:52] DEBUG[1538019]: http.c:1472 handle_uri: match request [ari/asterisk/info] with handler [metrics] len 7
[2024-03-17 16:28:52] DEBUG[1538019]: http.c:1472 handle_uri: match request [ari/asterisk/info] with handler [ari] len 3
[2024-03-17 16:28:52] DEBUG[1538019]: http.c:1488 handle_uri: Match made with [ari]
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:507 ast_ari_invoke: Finding handler for asterisk/info
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:514 ast_ari_invoke:   Finding handler for asterisk
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:531 ast_ari_invoke:         Checking ari applications:  Didn't match asterisk
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:531 ast_ari_invoke:         Checking ari events:  Didn't match asterisk
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:531 ast_ari_invoke:         Checking ari recordings:  Didn't match asterisk
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:531 ast_ari_invoke:         Checking ari playbacks:  Didn't match asterisk
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:531 ast_ari_invoke:         Checking ari endpoints:  Didn't match asterisk
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:531 ast_ari_invoke:         Checking ari sounds:  Didn't match asterisk
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:529 ast_ari_invoke:         Checking ari asterisk:  Explicit match with asterisk
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:514 ast_ari_invoke:   Finding handler for info
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:531 ast_ari_invoke:         Checking asterisk config:  Didn't match info
[2024-03-17 16:28:52] DEBUG[1538019]: res_ari.c:529 ast_ari_invoke:         Checking asterisk info:  Explicit match with info
[2024-03-17 16:28:52] DEBUG[1538019]: http.c:568 ast_http_send: HTTP keeping session open.  status_code:405

So why is Asterisk returning “invalid method” ? One clue…when I use curl the last line above is replaced with:

[2024-03-17 16:33:55] DEBUG[1538427]: http.c:568 ast_http_send: HTTP keeping session open.  status_code:200
[2024-03-17 16:33:55] DEBUG[1538427]: http.c:2015 httpd_helper_thread: HTTP closing session.  Top level

Notice the 200 instead of 405 code!? I’m sending the correct credentials…so 405 error (method not allowed) doesn’t make sense. I’m confused about what Asterisk is trying to tell me.

Method not allowed indicates it isn’t a credentials problem.

I didnt think so…but I’m left scratching my head. I print out the URL and it exactly matches what I pass to CURL.

The curl command is:

curl -v -u myun:mypw "http://172.31.254.14:8088/mycommand"

Is there some header I need to add to the post?

Ok solved it…simple yet not obvious from the error message.

I was using POST method, I should have been using GET method.

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