Ahhh…I see what you’re looking to do. You just want one or a sequence of buttons. Nice. But, I’m going to make the suggestion here that you use the DTMF decoding functionality in Allstar to accomplish the same thing a lot quicker AND a bit more flexibly.
Less hardware. Just what you have in place now (well, maybe you need a DTMF mic, but that’s a different story…)
So…in your /etc/asterisk/rpt.conf file, there is a stanza called [functions] that calls out the sequences that, once decoded, can Do Stuff. A lot of stuff.
If you look there, you’ll see that (logically, based on experience…we’ve sorted these things out over time), the prefaces have been allocated as:
; Prefix Functions
; *1 Disconnect Link
; *2 Monitor Link
; *3 Connect Link
; *4 Command Mode
; *5 Macros
; *6 User Functions
; *7 Connection Status/Functions
; *8 User Functions
; *9 User Functions
; *0 User Functions
; *A User Functions
; *B User Functions
; *C User Functions
; *D User Functions
which means that we can build command sequences based on the prefix and suffix (to minimal uniqueness, ie a command *80 will be executed in preference to *801 since the match will be the first two and the command processor will go off when a minimal match occurs…) to do what we want.
Second thing is that we can build commands by specifying a command string that calls a bash (or python, or perl, or ?) script that ‘does stuff’.
For instance, I have a function defined as:
981=cmd,/etc/asterisk/scripts/27200up.sh
where 981 is the dtmf sequence (preceeded by a *) followed by a comma
cmd tells asterisk that it’s going to execute something followed by a comma
and /etc/asterisk/scripts/27200up.sh is the shell script that it’s going to run.
That script is a simple, 2 line script in my /etc/asterisk/scripts directory (which I created to hold Stuff):
#!/bin/bash
/usr/sbin/asterisk -rx “rpt cmd xxxxx ilink 3 27200”
to connect me to my friend’s hub.
So, just for instance…let’s create a ‘stack’ of DTMF functions:
x01 =cmd,/etc/asterisk/scripts/node1up.sh
x02 =cmd,/etc/asterisk/scripts/node2up.sh
x03 =cmd,/etc/asterisk/scripts/node3up.sh
x04 =cmd,/etc/asterisk/scripts/node4up.sh
Where a generic nodeXup.sh (replace X with whatever) looks like this in your local scripts directory:
#!/bin/bash
first, disconnect all existing links; will just error out if nothing there
/usr/sbin/asterisk -rx “rpt rpt cmd (your local node) ilink 6”
wait for it to settle down…
sleep 5
now, link to wherever.
/usr/sbin/asterisk -rx “rpt cmd (your local node #) ilink 3 (nodeX allstar extension)”
So, when you restart asterisk…you now have 4 (or however many…) nodes loaded.
Key your mic, replace the x above with your prefix, to make, say 801. You key in *801# into your dtmf mic, and allstar will drop whatever connection you have (if any), sleep for 5 seconds, then connect to the node you programmed in as node 1.
This is, believe it or not, about an hour’s worth of keyboard time…the first half hour to debug, the second to build the stack of commands, copy the files, edit to suit, and a lot more flexible than building hardware to do what programatically is relatively simple.
PM me on my QRZ email if you want a deeper explanation. This is how I’d do it, there are as many other ways, all of them valid, as there are folks on the list…pick what you’re comfortable with, and run with it.
73 bryan wb0yle/w2fuv