[App_rpt-users] Calling a shell script
Bryan D. Boyle
bdboyle at bdboyle.com
Tue Feb 28 19:10:18 UTC 2012
On 2/28/12 1:47 PM, Robert A. Poff WB3AWJ wrote:
> I have a need to call a shell script from a DTMF function.
>
> An internet search finds this message in the archive : Calling a script message
> So based on what I found there I did this:
>
> Added to extensions.conf:
> [call-bash-script]
> exten => 1,1,System(/etc/W3SBA/utils/drillactive) ; Configure for EmComm Drill
>
> And in rpt.conf:
> 8495=autopatchup,context=call-bash-script,farenddisconnect=1 ;84951 - Set up for EmComm Drill
> It works as is.
> But, is this still the way to do this? Or is there a "better" way to make a call to the system?
What are you trying to do?
I don't usually add anything to extensions.conf; just a dtmf command in
rpt.conf that calls a script using
DTMF=cmd,/etc/asterisk/scripts/blah.sh
where blah.sh may be something as simple as
#!/bin/bash
/usr/sbin/asterisk -rx "rpt cmd xxxxx ilink 1 yyyyy"
so...keying up and doing a *DTMF# sequence will call my blah.sh script,
execute it, and do what it says (in this case, send a command to xxxxx
to disconnect node yyyyy.
Of course, you have to watch for command length matching...
99=cmd,/x/y/huh.sh
991=cmd,/a/b/c.sh will never get executed, since there will be a match
on 99 and huh.sh will get executed when the minimal match is made...
better to have 990...;) Found that the hard way.
I know there are other ways...but, this seems to work the least
painfully at least for me so far.
--
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.
Sent from my MacBook Pro.
More information about the App_rpt-users
mailing list