How to schedule an autoconnect/disconnect in hamvoip build

So, I needed/wanted to have one of my nodes built on 1.6 of hamvoip, to automatically connect to another node programmatically (with out user intervention).

Been a seasoned Linux user I searched and when not finding an answer I sent a direct message to one of our admins (Tim WD6AWP) and asked if there was a way to do this.

Well you guessed it, that not longer after hitting send, my brain stopped thinking Linux and started thinking asterisk that I found my answer and perhaps yours.

If you are used to how Linux works, you too may wonder how to add a crontab entry to call a node at some time/date, then disconnect at some time/date.
Linux or better in this case archlinux, cannot make direct calls to asterisk like: "rpt fun <3 remote node>. So what to do.
Well it turns out that like so many other wonderful features built into allstarlink, the answer lies in rpt.conf (as with me read the documentation carefully before making a full of one self).

There is a STANZA (still getting used to what the H… that means) called SCHEDULE STANZA or a simply a block area in rpt.conf prefixed by [schedule].
In where one can place commands as a (IMPORTANT) macro entry/call to perform an action.

As an example
[schedule]
5 = 01 01 * * M-F
6 = 01 04 * * M-F

In the above example macros 5 and 6 (left of =) followed by Crontab syntax to the right of the equal. Macro number 5 in this case be executed at 1 minute after 1am monday-friday. and macro 6 at 1 minute after 4am monday-friday.

In the MACRO STANZA add the macro component (in this case the macro number will be 5 and 6)

[macro]
5 = 3200032001 ; connect to nodes 2000 and 2001
6 = 132000132001 ; disconnect nodes 2000 and 2001

Hope this will be of help to someone else out-here as well as thank you Tim WD6AWP for the prompt answer to my help call,

73,
Adriano KV7D

4 Likes

You can run asterisk commands from cron or a script:

asterisk -rx "rpt fun <your node> *5"

You likely have to be root and/or specify the full path to asterisk (ie /usr/sbin/asterisk or where ever it is on Arch).

But, yeah. Using the scheduler is perfectly fine, that’s what it’s there for.

P. S. Thanks for posting this here.

My pleasure,
hanks for all the support you give.

Adriano

Create Script File Named: ConDis.sh make sure to place it in /usr/sbin/asterisk directory and use chmod 755 ConDis.sh or it will not run.

in the file put the following

/usr/sbin/asterisk -rx “rpt fun yournode# $1”

then in Crontab -e create 2 entries one for connect the other for disconnect like so

50 20 * * 2 /etc/asterisk/local/ConDis.sh *33039154 <connects to AmateurLogic.tv shout out net on echolink
05 00 * * 3 /etc/asterisk/local/ConDis.sh *13039154 <disconnects AmateurLogic.tv shout out net

The first numbers are the minutes then hour of when you want the event to run the 2 is the day of the week 0=Sunday, 6=Saturday. Then the path to the file and name. then at the last is the command used to either connect or disconnect. this is how I control all my nets to run automatically. works perfect

Cron examples - Crontab.guru <to set your time of when you want to connect and disconnect these are examples

Thank you Bradford for your insightful input,

Wonder how we can get some of this useful information in the allstar wiki or in the documentation.

73 all,
Adriano

Google will find it here on Community of course, but if you’d like something in the wiki feel free to write up what you’ve learned and I’ll add it to the wiki.

Try Here on the following

Hamvoip forums
https://www.hamvoip.org/#maillist
or on groups.io
supermon2@groups.io | Home
for Supermon2

http://www.crompton.com/hamradio/hamvoip-howto/