ARI | DeviceState

I subscribed endpoints to an application.
Now i get noticed about a changing DeviceState.
Is it possible to get the actual DeviceState of the endpoint without waiting for the ChangeEvent? What do I have to do?

There is a route[1] which allows getting the device state whenever you want.

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Devicestates+REST+API#Asterisk13DevicestatesRESTAPI-get

I already tried that, but i always get an empty list back, like there would be no devices. Do you have any suggestions?

What exactly are you requesting? If you are doing GET /deviceStates then that only shows ARI controlled device states, not every device state on the system. You have to request each individually for those.

1 Like

Ah ok that was my problem. Thank you.

I tried to use this route to get the device state of a resource, but the response was “resource not found”. I did get the resource somehow using the get Channel Variables endpoint and calling the DEVICE_STATE Dialplan function. But is there any way to get the device state using ARI when no call is made? I want to show availability of the users before placing call

The route does work, so if it’s not working you’d need to actually show what you tried.

Yes. It’s working the mistake was on my side. While providing the device name “technology/resource” we need to encode the “/” sign. Replacing “technology/resource” with “technology%2Fresource” worked.

Thank you