Asterisk event registration device

Hello, i want to get event when there are device that registration to asterisk. I using python to get that event, but it is not working. I already using client.on_device_state_event('DeviceStateChanged') but it not working. Anybody can help?

You might get what you want using the Manager event ContactStatus

Assuming the python library is working fine you should try the event proposed by @johnkiniston, device state needs some sip settings like callcounter=yes for chan_sip and it has nothing to do with sip registration at least not for what you re trying to achieve

Possible Device States

  • BUSY

Registration will take the device out of the UNKNOWN state as I recall.

Thank for your suggestion. But from there event using ARI like :

  • ContactStatusChange
  • DeviceStateChanged
  • EndpointStateChange
  • PeerStatusChange

Anybody have example for the event using ARI ???

What exactly are you trying to do? And note that in ARI you have to explicitly subscribe to receive some things, such as endpoint or device state.

I trying to get event when new device registered. The client my code refer to ARI url localhost:8088. From the documentation, there event EndpointStateChange that can use to get what I want. In the documentation there no example where I should subscribe the event. Do i use ari event, or ari device state event, or endpoint event ? I not find example of this event.

There is a specific route[1] for subscribing an application to an endpoint or for receiving device state for it.


Thank all for your answer. It solved by post subscription to my application with eventsource endpoint:PJSIP like @jcolp suggestion, then I use ari endpoint event :
client.on_endpoint_event("EndpointStateChange",handler) and this one working. Thank you very much all…

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