Swissarmy info and help file, by Kyle Yoksh, K0KN - Last edited May 19, 2022 --------------------------------------------------------------------------------- This file contains sample configurations and information for the Swissarmy script. This script is intended to be used with the ASL app_rpt (Allstar) VOIP system running under the Asterisk PBX. The Debian version of Swissarmy is known to work on the Hamvoip image and/or ssmtp mail package with one change to the script (line 96): original: mail -s "$SUBJECT $TIME_DATE" -a "From: $SENDAS <$SENDAS>" "$SENDTO" < "$TEMP"/estatus$LOCALNODE.a"$SPLITVAR" modified: mail -s "$SUBJECT $TIME_DATE" "$SENDTO" < "$TEMP"/estatus$LOCALNODE.a"$SPLITVAR" Swissarmy is a suite of tools to help you customize and manage your Allstar node(s). It is highly configurable, and can be reconfigured at any time without restarting Asterisk. The swissarmy script itself should not have to be edited. All configuration should be done to the /etc/asterisk/swissarmy.conf file, and/or the other optional configuration files. Features include: * Support for PBX phones (use 3 digit extension number!) * Private node numbers can now be defined with a name and callsign, so that they will appear just like a 'real' Allstar node. * Support for multiple Allstar nodes in a single configuration file * Asterisk text messages can be sent to all connected nodes (useful for Web Transceiver nodes) * Send email/text alert on Allstar node connects * Send email/text alert on Allstar node disconnects * Send email/text alert on Echolink node connects * Send email/text alert on Echolink node disconnects * Audible notification of how many nodes are connected to you after each connect/disconnect. * Output messages can be split into multiple messages of X characters (useful for text messages) * Output messages can be split into a maximum of X messages (adjustable from 1-26 messages per alert) * Output messages can show multimessage number (1/3, 2/3, 3/3 and so on to indicate how many messages to expect) * Each node can output to a different email address / mobile phone number. Each mobile carrier has a different email address that can be used to send text messages to your mobile phone. * Several adjustable levels of output, including global, verbose, Asterisk text, and audible. * Extensive logging of node events * Supports "issue command" when node X connects * Supports "issue command" when node X disconnects * Supports "issue command" when callsign X connects * Supports "issue command" when callsign X disconnects * Supports "issue command" on any Allstar connect * Supports "issue command" on any Allstar disconnect * Supports "issue command" on any Echolink connect * Supports "issue command" on any Echolink disconnect * Supports "issue command" on any 3-digit Extension connect * Supports "issue command" on any 3-digit Extension disconnect * Supports "issue command" when script exits * Welcome audio message can be played to all stations * Welcome audio message can be played on Echolink station connects only * Disallow stations based on callsign * Disallow stations based on node number * Allow only nodes in specifed call sign list * Audio message can be played to disallowed stations before disconnection * Supports "issue command" to disallowed stations before disconnection * Supports alert email when disallowed station attempts to connect * Output can be easily supressed, to prevent email/text during night, etc. * Supports logging of IP address from connecting Allstar nodes * Supports logging of IP address from connecting Echolink nodes * Alert subject can be configured to include date/time * Supports alert email when number of connected nodes is greater than a number you specify * Supports "issue command" when number of connected nodes is greater than a number you specify * Different email address(es) can be used for each type of alert. Separate multiple email addresses with a comma. ----------------------------------------------------------------------------------------------------------------------- To configure app_rpt, each node you want to support needs two lines placed in rpt.conf: connpgm=/home/kyle/swissarmy 1 discpgm=/home/kyle/swissarmy 0 Of course, change the /home/kyle to reflect the location of the swissarmy script on your system. You can use /etc/asterisk or another location of your choosing. Once the above lines are placed in rpt.conf, you'll have to restart Asterisk for the changes to take effect: astres.sh ----------------------------------------------------------------------------------------------------------------------- Important - I recommend using WGET to download swissarmy directly to your Asterisk box, rather than downloading via a Windows box and transferring with WinSCP, etc. Using the former method usually results in line wraps and other issues that break the script. To download the script directly, log into your Asterisk box, via Putty or directly from the console, and cd / the location you want the script to be downloaded, then type: wget http://www.qsl.net/k0kn/swissarmy chmod 750 swissarmy ----------------------------------------------------------------------------------------------------------------------- The main configuration file is swissarmy.conf. The default location for this file is /etc/asterisk. Below is an example configuration. The node number is used at the beginning and end of configuration for that node number. The syntax for the beginning is :nodeno: and at the end of that node's configuration, the syntax is *nodeno* Multiple nodes can be configured in the same way, and using the same file. The following variables are used in swissarmy.conf: SENDTO=TARGET EMAIL ADDRESS (email address to send alerts TO). Multiple recipients can be specified, using a comma between addresses. SENDAS=SENDING EMAIL ADDRESS (email address assigned to your Asterisk box) SUBJECT=Node 2210 Alert (Email / text subject -- omit this altogether to use default subject line -- recommended) SHOW_DATE_TIME=0 (Include date/time of alert in subject line, default is off). This helps avoid emails being grouped together, typically by cell phone or Gmail clients. PRIVATE_LIST=/home/kyle/private_nodelist (Define any private nodes here) Format and spacing should match the below file NODELIST. I suggest editing /dev/shm/allstar_nodelist and adding your private node details in the same spacing and format. Then copy and paste them into the PRIVATE_LIST file. Each time the nodelist is downloaded and processed, the private node details will be added to the bottom of the NODELIST file. NODELIST=/dev/shm/allstar_nodelist (location of local Allstar nodelist, default is /dev/shm/allstar_nodelist) LISTURL=http://stats.allstarlink.org/api/stats/mapData (updated 2021) ALLSTARRPTEXTNODES=/var/lib/asterisk/rpt_extnodes (location of Allstar IP address database - default /var/lib/asterisk/rpt_extnodes) Omit to disable logging of IP Address for connecting Allstar nodes. ECHOLOOKUP=/home/kyle/echolookup (K0KN Echolookup script location - used for extended Echolink node info) Omit to disable logging of IP Address and callsign for connecting Echolink nodes. SOUNDS=/etc/asterisk/sounds (Location where extra sound files are kept) LOGFILE=/var/log/asterisk/connectlog (Logfile path/filename) BANLIST=/home/kyle/banlist.1234 (Allstar Banlist. Leave blank to disable). List of callsigns or node numbers disallowed to connect to your node. One entry per line, plain text file. I suggest using the node number as the file extension, so each node can have a different deny list. BANLIST_DENY_ALERT=1 (Enable a separate email alert if a banned node attempts to connect) BANLIST_DENY_EMAIL= (specify an email address to send alert to. If not specified, the SENDTO email address will be used) BANDELAY=10 (Delay before disconnect command given. Default is 10 seconds) ACCEPTLIST=/home/kyle/acceptlist.1234 (Allstar Acceptlist. Leave blank to disable) List of callsigns allowed to connect to your node. One callsign per line, plain text file. I suggest using the node number as the file extension, so each node can have a different accept list. ACCEPTLIST_DENY_ALERT=1 (Enable a separate email alert if a node attempts to connect, and is not in the accept list) DISABLE=/etc/asterisk/~statusdisable (If this file exists, email/text output will be supressed. You can use a cron job to touch or remove this file at times of the day that you want to supress output) ACCEPTLIST_DENY_EMAIL= (specify an email address to send alert to. If not specified, the SENDTO email address will be used) NODENO_ACTIONFILE=/etc/asterisk/swissarmy_nodeno.2210 (If this file exists, it will be searched for connecting node #s) CALLSIGN_ACTIONFILE=/etc/asterisk/swissarmy_callsign.2210 (If this file exists, it will be searched for connecting callsigns) GLOBALINFO=1 (Include node numbers of ALL connected nodes in output) VERBOSE=1 (Include callsigns of ALL connected nodes in output - MUST BE USED WITH GLOBALINFO=1) ANNOUNCENUMBER=0 ( Speak total number of connected nodes - localplay. If set to 1, the total number of connected nodes will be spoken over the local transmitter only. If 0, no spoken output) WEBTX_TEXT=1 (Send Asterisk text messages to all nodes on connect/disconnects) ANNOUNCEMESSAGE= (Play audio file for all connecting nodes - do not include file extension) ANNOUNCE_EXT=ulaw (file extension for announcemessage) SWISSARMYRANDOMSLEEP=5 (Random sleep period between 1 and X. Omit to disable - Can be helpful when monitoring multiple nodes via text message. Use this feature if messages arrive out of sequence.) ALLSTAR_CONN_ALERTS=1 (Send email/text alerts on Allstar Connects - set to 0 to disable email/text) ALLSTAR_DISC_ALERTS=1 (Send email/text alerts on Allstar Disconnects - set to 0 to disable email/text) ECHO_CONN_ALERTS=1 (Send email/text alerts on Echolink Connects - set to 0 to disable email/text) ECHO_DISC_ALERTS=1 (Send email/text alerts on Echolink Disconnects - set to 0 to disable email/text) TEXTMINCHARS=2 (Ignore emails less than X characters - default 2) TEXTMAXCHARS=125 (Max characters per message depends on mobile carrier, If not using text, leave blank) SHOW_MULTIMESSAGE_NUMBER=0 (Useful if receiving multiple text messages. Will show message 1/3, 2/3, 3/3 etc when alert is split into multiple messages - default 0) MULTIMESSAGE_LIMIT=6 (Useful if receiving text messages rather than email. Alert will be split into a maximum of this number. Note that the upper limit of 26 messages per alert is set by the routine itself, so the valid range is 1-26. Default 4) MULTIMESSAGE_DELAY=7 (Sleep time between multiple text messages. Default 7) ECHOLINK_WELCOME=/etc/asterisk/sounds/welcome_echolink_station (Welcome message played when Echolink nodes connect) ECHOLINK_CONN_CMD= (Command issued on all Echolink connects. Leave blank to disable) ECHOLINK_DISC_CMD= (Command issued on all Echolink Disconnects. Leave blank to disable) ALLSTAR_BAN_CMD= (Command issued when banned Allstar node connects. Leave blank to disable) ALLSTAR_NOTACCEPTED_CMD= (Command issued when node not in accepted list connects. Leave blank to disable) ALLSTAR_CONN_CMD= (Command issued on all Allstar connects. Leave blank to disable) ALLSTAR_DISC_CMD= (Command issued on all Allstar disconnects. Leave blank to disable) EXTENSION_CONN_CMD= (Command issued on all Extension connects. Leave blank to disable) EXTENSION_DISC_CMD= (Command issued on all Extension disconnects. Leave blank to disable) ASTKICK=/etc/asterisk/sounds/automatically_disconnecting (Optional audio file before disconnecting banned node. Leave blank to disable) ASTKICK2 =/etc/asterisk/sounds/automatically_disconnecting (Optional audio file before disconnecting not specifically allowed node. Leave blank to disable) TOTALCOUNT_ALERT=21 (If set, an alert email will be sent when the total number of connected nodes is greater than this number). TOTALCOUNT_EMAIL=TARGET EMAIL ADDRESS (Email will be sent to this address if number of connected nodes is greater than TOTALCOUNT_ALERT. If not specified, the SENDTO email address will be used) TOTALCOUNT_ACTION= (If set, this script or command will be executed if the number of connected nodes is greater than TOTALCOUNT_ALERT) PUSHNOTIFYTEMP=/dev/shm/push.2210 (If set, node connect/disconnect data will be copied to this path/filename) PUSHNOTIFYEXEC=/home/kyle/pushit 2210 (If set, this command will be executed when connect/disconnect status messages occur) EXIT_CMD= (Command issued at script exit. Leave blank to disable) ########################################################################### # # Swissarmy.conf configuration file for Asterisk/app_rpt 7/2013 # # This file is used to configure the swissarmy script for app_rpt. Do # not edit the swissarmy script directly. # ########################################################################### :2210: SENDTO=TARGET EMAIL ADDRESS SENDAS=SENDING EMAIL ADDRESS SHOW_DATE_TIME=0 PRIVATE_LIST=/home/kyle/private_nodelist NODELIST=/dev/shm/allstar_nodelist LISTURL=http://stats.allstarlink.org/api/stats/mapData ALLSTARRPTEXTNODES=/var/lib/asterisk/rpt_extnodes ECHOLOOKUP=/home/kyle/echolookup SOUNDS=/etc/asterisk/sounds LOGFILE=/var/log/asterisk/connectlog BANLIST=/home/kyle/banlist BANLIST_DENY_ALERT=1 BANDELAY=15 BANLIST_DENY_EMAIL=TARGET EMAIL ADDDRESS ACCEPTLIST_DENY_EMAIL=TARGET EMAIL ADDRESS ACCEPTLIST=/home/kyle/acceptlist.2210 ACCEPTLIST_DENY_ALERT=1 DISABLE=/etc/asterisk/~statusdisable NODENO_ACTIONFILE=/etc/asterisk/swissarmy_nodeno.2210 CALLSIGN_ACTIONFILE=/etc/asterisk/swissarmy_callsign.2210 GLOBALINFO=1 VERBOSE=1 ANNOUNCENUMBER=1 WEBTX_TEXT=1 ANNOUNCEMESSAGE= ANNOUNCE_EXT=ulaw SWISSARMYRANDOMSLEEP=5 ALLSTAR_CONN_ALERTS=1 ALLSTAR_DISC_ALERTS=1 ECHO_CONN_ALERTS=1 ECHO_DISC_ALERTS=1 TEXTMINCHARS=2 TEXTMAXCHARS=10000 SHOW_MULTIMESSAGE_NUMBER=0 MULTIMESSAGE_LIMIT=6 MULTIMESSAGE_DELAY=15 ECHOLINK_WELCOME=/etc/asterisk/sounds/welcome_echolink_station ECHOLINK_CONN_CMD= ECHOLINK_DISC_CMD= ALLSTAR_BAN_CMD= ALLSTAR_NOTACCEPTED_CMD= ALLSTAR_BAN_CMD= ALLSTAR_NOTACCEPTED_CMD= ALLSTAR_CONN_CMD= ALLSTAR_DISC_CMD= EXTENSION_CONN_CMD= EXTENSION_DISC_CMD= ASTKICK=/etc/asterisk/sounds/automatically_disconnecting ASTKICK2=/etc/asterisk/sounds/automatically_disconnecting TOTALCOUNT_ALERT=21 TOTALCOUNT_EMAIL=TARGET EMAIL ADDRESS TOTALCOUNT_ACTION=asterisk -rx "rpt fun 2210 *70" PUSHNOTIFYTEMP=/dev/shm/push.2210 PUSHNOTIFYEXEC=/home/kyle/pushit 2210 EXIT_CMD= *2210* ----------------------------------------------------------------------------------------------------------------------- You can use some swissarmy variables in the command portion of the ACTION files: $2 - your local node number $3 - remote node number or callsign $ALLSTARCALL - Remote node callsign as it appears in the local nodelist. Note that K0KN and K0KN/R will be treated differently. The CALLSIGN_ACTIONFILE syntax is as follows: callsign, c or d (connect or disconnect), command ------------------------------------------------- For example: (the 12 tells the localplay script to wait 12 seconds before playing - this helps make sure that telemetry has stopped playing before the custom messages begin) K5TRY,c,/home/kyle/localplay 2210 /etc/asterisk/sounds/tony 12 KA0YIW,c,/home/kyle/localplay 2210 /etc/asterisk/sounds/jim 12 K0GXL/R,c,asterisk -rx "rpt fun $2 *4$3*32219#" (Note: this example will cause the remote node to execute a command elsewhere!) You can also issue multiple commands using ; as shown below: K5TRY,d,sleep 12 ; /home/kyle/localplay 2210 /etc/asterisk/sounds/using Similarly, the NODENO_ACTIONFILE syntax is as follows: node number, c or d (connect or disconnect), command ------------------------------------------------- For example: (the 12 tells the localplay script to wait 12 seconds before playing - this helps make sure that telemetry has stopped playing before the custom messages begin) 28384,c,/home/kyle/localplay 2210 /etc/asterisk/sounds/tony 12 28891,c,/home/kyle/localplay 2210 /etc/asterisk/sounds/jim 12 You can also issue multiple commands using ; as shown below: 28384,d,sleep 12 ; /home/kyle/localplay 2210 /etc/asterisk/sounds/using ----------------------------------------------------------------------------------------------------------------------- The BANLIST syntax is simple. Put a node number OR callsign on each line. Do not include empty lines or whitespaces for best results. ----------------------------------------------------------------------------------------------------------------------- The ACCEPTLIST syntax is simple. Put a callsign on each line. Do not include empty lines or whitespaces for best results. Note that W1AW and W1AW/R are treated as different callsigns. Stations cannot be excluded by node number. If this is desired, I suggest you use the NODENO_ACTIONFILE instead. ----------------------------------------------------------------------------------------------------------------------- ECHOLOOKUP is a helper script used to get more information about Echolink nodes. It can be found at: http://www.qsl.net/k0kn/echolookup or via wget: wget http://www.qsl.net/k0kn/echolookup ----------------------------------------------------------------------------------------------------------------------- To disable email/text alerts between midnight and 7am, you can use CRON to create and remove the DISABLE file: 0 0 * * * root touch /etc/asterisk/~statusdisable > /dev/null 2>&1 0 7 * * * root rm -f /etc/asterisk/~statusdisable > /dev/null 2>&1 -----------------------------------------------------------------------------------------------------------------------