Quickest way to set custom devstate by script/commandline?

Trying to de-ugly something for a client. Essentially they have a gate the status of which can be polled for open/closed status with a PHP script. Somewhere along the line someone morphed that into a page on their webserver that they can keep refreshing in a browser to see if the gate is open or closed. I’m sure it seemed like a good idea at the time but in practice not optimal because either the browser gets closed, buried, etc.

What I’d like to do is dump that status into a custom devstate on their FreePBX box so we can just set up a BLF button to monitor it on a couple of phones.

What is the easiest way to update a custom devstate on FreePBX by an external script (or commandline). Obviously PHP would be cleanest end result because I can just merge that into the polling script they already have… but I can easily pass off to another script if PHP isn’t the optimal choice for talking to Asterisk. I just don’t want to churn out 100 lines of code to do something that could be handled with 2 lines of shell script and a cron job.

Thanks!

You could modify this script to suit your purpose:

Awesome, thanks Lorne I will give that a try.

1 Like

Please share when you’re done. It could be useful for others.

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