ARI Device states response is empty

Hello, Asterisk 18.14 I have success to execute

http://IP:8088/ari/deviceStates/PJSIP%2F3005

RESPONSE:

{
  "name": "PJSIP/3005",
  "state": "NOT_INUSE"
}

but http://ip:8088/ari/deviceStates
response is empty array. The problem is from code and from Swagger
[]

Please help to understand why asterisk REST not response current states of devices?

can you say what is the problem clearly?

чт, 22 дек. 2022 г. в 13:21, ipvinner7 via Asterisk Community <notifications@asterisk.discoursemail.com>:

The problem is REST return correct device state for 1 device, but return empty array when I’m trying to get all devices states. I’d like to get all devices states the same as ARI response for specific PJSIP device.

I think that You should do 1) asterisk -rvvvvv 2) pjsip show registers or endpoints

чт, 22 дек. 2022 г. в 14:03, ipvinner7 via Asterisk Community <notifications@asterisk.discoursemail.com>:

I know how to check state from console. but I’d like to get these info via REST, not via console.

The API call doesn’t do what you want it to do. It returns the list of custom device states created by ARI[1]. Not every device state on the system. The closest thing would be listing all the endpoints[2] which would tell you if they’re available or not, but that’s not device state.

[1] Asterisk 20 Devicestates REST API - Asterisk Project - Asterisk Project Wiki
[2] Asterisk 20 Endpoints REST API - Asterisk Project - Asterisk Project Wiki

Okay I see. But why /deviceStates/{deviceName} works?

Because that functionality DOES allow you to get a single device state. It can ask the channel driver for the device state. Internally there isn’t really a list of all the device states on the system. There’s some caching, but that’s not a guaranteed view of all the device states.

1 Like

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