All, I use macro's so that users can perform connects/disconnects etc via DTMF. The existing macros perform a bunch of 'tests' such as 'Am I already connected to something' and then use conditional statements to perform any actions based on the current status. So for example, if the node is already connected to an AllStar hub then do nothing. If the user firstly sends the disconnect DTMF sequence, the node will then connect to any new hub requested by any subsequent DTMF command. So far so good. But I also have an hourly cron job running to connect the node to the default hub. Therefore I now need to set a state so that if somebody has moved the node to another hub, or even disconnected it so that it standalone, the hourly cron job should NOT try to reconnect to any default room. I looked at using variables but I can't seem to change these dynamically. [environment/profile]. Then I considered writing the state to a file. Has anybody come up with a good solution for this?
Tom, I think your only option is to use 'ON EVENT' programming.
It's the only way to use 'conditional' arguments..
It may be possible to do that inside of a shell script with stats I think.
Thanks. This looks useful. I can see a setvar function but I wish there was also a getvar function to read the value of a single variable. Looks like I will have to use showvars which returns all the variables and their values. I can then search that output with grep.
from a Bash shell, /usr/sbin/asterisk -rx "rpt nodes " will give you a list of connected nodes that you can pipe to grep.
Thanks for this. My existing scripts, which sit behind the macro calls, currently use the 'rpt nodes' functionality. I then search the output with grep and match on '' to indicate when the repeater/node is not connected to anything. The scheduled re-connect script will then run and re-connect to any default hub. What I needed was a special case where a local user wants to disconnect the repeater to use it in standalone mode. The scheduler should not run in this case even though the repeater is not connected to another node/hub. I have now solved this problem by using a 'simple' variable and this seems to be working. But I am now looking at some of the other functionality available in event management programming guide. I was wondering if I could do something with the Keyed states.
That should read... "and match on '<NONE>' "
I keep forgetting to escape the Less than / Greater than characters on this WiKi.