Device and Trunk states using AMI

Hi,
I’m currently already getting in realtime the device states by just listening events from AMI.

Event: DeviceStateChange
Privilege: call,all
Device: PJSIP/Gilles
State: UNAVAILABLE

Event: DeviceStateChange
Privilege: call,all
Device: PJSIP/Gilles
State: NOT_INUSE

Event: DeviceStateChange
Privilege: call,all
Device: PJSIP/Gilles
State: BUSY

“DeviceStateChange” events are sent when the state is updated.
Then, how can I get this state just after establishing the connection to AMI?
Which “Action” do I have to send?

Regarding my trunk, I have the same question:
Which “Action” to I have to send for getting the registration state of my trunk?

Thanks for your help

Using Getvar[1] with the DEVICE_STATE dialplan function[2] is probably easiest. For an outbound registration you’d likely use PJSIPShowRegistrationsOutbound[3]

[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+ManagerAction_Getvar
[2] https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+Function_DEVICE_STATE
[3] https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+ManagerAction_PJSIPShowRegistrationsOutbound

Thanks for these tips - Now, I can get all required info.
Regards

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