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.
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.
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.