[App_rpt-users] Remote commands

Bryan D. Boyle bdboyle at bdboyle.com
Thu Jul 28 14:55:03 UTC 2011


On 7/28/11 10:04 AM, Lu Vencl wrote:
>
> Hi Corey,
>
> Yea, I just thought that I could issue commands to another node 
> without actually connecting to it.. I would have thought there would 
> be a way to do this in the background (short from SSHing into the box) 
> so you would not have to go through the actual connect process, but 
> the current method is just fine.. I just did not understand it for 
> some reason at first that you had to connect.
>
> I suppose I could create some sort of macro to login to the boxes and 
> perform the intended commands, just got to learn how to do all of that 
> when I get some time..
>
> Thanks and 73
>
> Lu, KA4EPS
>
>
That's what the XXX=cmd,/some/were/in/your/filesystem comes in handy, 
where XXX=some DTMF command, and /.... is a script you run.  You can 
have asterisk execute shell commands as the target of a DTMF sequence.

For instance:

in rpt.conf in the functions stanza, I have lines thus: (note, 123/124 
is a placeholder for the purposes of this discussion)

[functions]
...
123=cmd,/etc/asterisk/scripts/nodexup.sh
124=cmd,/etc/asterisk/scripts/nodexdown.sh
...

and in a scripts directory I've created under /etc/asterisk there's a 
shell script called nodexup.sh:

#!/bin/bash
/usr/sbin/asterisk -rx "rpt cmd myhubnode ilink 3 nodex"

with a chmod of 755, owned by whomever owns the asterisk daemon.  To 
write the node down script, cp nodexup.sh nodexdown.sh, change the 3 to 
a 1, save, check the permissions, and restart asterisk.

Now, if you have multiple nodes running on the same instantiation of 
asterisk (as I do), I have them all pointing to a common function stanza 
(I know, I should separate them out...), so, from any of my nodes I can 
DTMF 123 (not really this sequence), and it will link myhubnode to some 
nodex and take it down if I send the complimentary sequence.  I can 
still do the *4myhubnode*3nodex# if I want, but, having *123# to press 
correctly is a lot less liable to fat-fingering or going into brain fade 
on the DTMF pad on the HT or mobile than the extended sequence.

Yeah, it means you have to figure out just what you want to do, but, the 
ability to execute not only macros, but shell scripts from the daemon is 
a powerful (and dangerous) thing. You can still do the long sequence if 
you need something for ad-hoc, but for normal ops, making up a script to 
do it for you is a time/stress/fatfinger prevention/ease of ops 
technique.  By the by, you can also execute the shell script from the 
command line, too...;)

Just my opinion, maybe this answers your question.

However, if you're looking for automatic connect on 
reboot/restart...look at the startup_marcro line in the rpt.conf for the 
node....

-- 
Bryan
In this world, you must be oh so smart or oh so pleasant.
Well, for years I was smart. I recommend pleasant.
You may quote me.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.keekles.org/pipermail/app_rpt-users/attachments/20110728/4ed45b1a/attachment.html>


More information about the App_rpt-users mailing list