Prevent custom device states from persisting across restarts

I have some custom device states and BLF lights that are set using hints in dialplan.

However, if Asterisk restarts for some reason, the device state gets stuck as the device state is in disagreement with the real state (which, obviously after a asterisk restart, always is NOT_INUSE).

How can I tell asterisk to clear certain device states at bootup?

Custom device state has no such functionality built in, it preserves the state using the Asterisk database. Without code modifications the only thing that comes to mind is using cli.conf to execute CLI commands at startup for each device state to set it back to what you consider its default state.

1 Like

Tried with:

[startup_commands]
devstate change Custom:Service03 NOT_INUSE
devstate change Custom:Service04 NOT_INUSE
devstate change Custom:Service05 NOT_INUSE

in cli.conf but it wont clear the status. Guess the commands are executed too early or similiar. The above commands works perfectly if I run them in the cli when not running it in background.

It likely has to be:

devstate change Custom:Service03 NOT_INUSE = yes
1 Like

That worked perfectly. Tought the " = yes" was part of the command in the .sample file and not required unless the command requires it.

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