[arm-allstar] Commanding nodes via scripting

Doug Crompton doug at crompton.com
Tue Oct 20 13:10:40 EST 2015


Pete,

 Although you can do this entirely inside rpt.conf I like to script outside with Linux bash scripts calling Asterisk to do the task. Here is an example of connecting to the alaska net. This example is in /etc/asterisk/local in the distribution.

cat alaska_connect

#! /bin/bash
# Example Script showing connect to Alaska Morning Net
# Change the 'connect from node' to your node
# and the 'connect to' node to where you want to connect
# omit the < and >
# Run from a cron job that specifies the connect time
#
# This cron example shows how to enter into cron
# type crontab -e  and add the line, change as needed
#
# The example shows at 12:44 (times are 24 hour) on
# Monday through Saturday run the alaska_connect
# script in the /etc/asterisk/local directory
#
# Modify this script to your needs
#
# This cron example shows a 12:44 PM connect time Monday through Saturday.
#
# 44 12 * * 1-6 /etc/asterisk/wa3dsp/alaska_connect
#
/usr/sbin/asterisk -rx "rpt fun 27225 *7327133"
# end of script

When you create a script like this to do asterisk tasks it must be made executable. If the script was called  alaska_connect.sh then -  chmod 750 alaska_connect.sh

Then you can actually call it from Linux to see if it works properly.

./alaska_connect.sh    - from the same directory it is in. 

Then you have two options. You can create a cron job to execute it on a schedule or execute it with a DTMF command. Here is my cron entry to execute this script at at 12:50 on Wedneadays

# Weekly at Wed 12:50 PM Alaska Net
50 12 * * 3 /etc/asterisk/local/alaska_connect.sh

You would make a corresponding disconnect script (alaska_disconnect.sh) like above then add the disconnect cron entry. This shows a disconnect at 2 PM on Wednesdays

00 14 * * 3 /etc/asterisk/local/alaska_disconnect.sh

To list all cron jobs do   -  crontab -l

To edit or add a cron  -  crontab -e

Now if all you want to do is have a DTMF sequence (the cron is optional) run the scripts then add this to the funtions section of rpt.conf    [functions]  probably has your primary node number after it   EX: [funtions27225]

[functions]

.....

A4=cmd,/etc/asterisk/local/alaska_connect.sh
A5=cmd,/etc/asterisk/local/alsaka_disconnect.sh

In this example *A4 would run the alaska connect script and *A5 the disconnect. The DTMF code can be anything that does not conflict with what is already defined.  8XX is usually safe and all the extended prefix  A, B , C , D  are not used but make sure the handheld or radio you are controlling with has those tones available. Not all do.

The scripts can do anything legal in Linux and you can call Asterisk multiple times to do anything you could normally do in the client.

I hope that helps. 

73 Doug
WA3DSP
http://www.crompton.com/hamradio


Date: Tue, 20 Oct 2015 13:17:13 -0400
From: mrpjf150 at gmail.com
To: arm-allstar at hamvoip.org
Subject: [arm-allstar] Commanding nodes via scripting

     Hi all
     How do you command a node to connect/disconnect using scripting? Sometimes I'm outta range of my node to command DTMF.An example would be say,there is a net on at such& such a time,would like to script something to command my node to link up.Is there something in Doug's software to do this?

73,

Pete

KD2ARB

_______________________________________________

arm-allstar mailing list
arm-allstar at hamvoip.org
http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar

Visit the BBB and RPi2 web page - http://hamvoip.org 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hamvoip.org/pipermail/arm-allstar/attachments/20151020/e2048370/attachment.html>


More information about the arm-allstar mailing list