Asterisk 18.x AMI SetVar with no channel for functions like DEVICE_STATE()


I’m attempting to set DEVICE_STATE() with AMI’s SetVar action after receiving the AMI Hangup event.

The channel that triggered the Hangup is no longer available to use with SetVar, however, I don’t need to actual channel to set the device state.

Is there a trick that I’m missing? Perhaps a pseudo channel of some kind that can be used to run functions through AMI?

Thanks for any advice :smiley:


The channel name isn’t required[1]. If not set then it is considered global, and will run the dialplan function without a channel. The implementation of DEVICE_STATE itself also does not require a channel.

If you don’t specify a channel, is it not working?

[1] Asterisk 20 ManagerAction_Setvar - Asterisk Project - Asterisk Project Wiki

1 Like

Just checked again and to my chagrin, it is working with no channel … I did test that but must have had a bug as I was getting a “channel not found” response.

Thanks for taking the time to reply on a Saturday morning, it’s much appreciated, sorry to bother :frowning:


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