Hello Everyone, Does anyone know how to use DTMF tones to run a command, to execute external script?
···
–
Thanks, David
“Laws that forbid the carrying of arms…disarm only those who are neither inclined nor determined to commit crimes. Such laws make things worse for the assaulted and better for the assailants; they serve rather to encourage than prevent homicides, for an unarmed man may be attacked with greater confidence than an armed one.”
write the bash script or program (you can execute programs too; I
suggest creating a subdirectory in the /etc/asterisk
directory…doug calls it ‘local’, I usually call it ‘scripts’),
debug it, make sure to ‘chmod 755 scriptname’.
Edit /etc/asterisk/rpt.conf.
Go to the [functionsxxxx] stanza for the node you’re working
with. Of, if you have just one function stanza, go there.
Insert a line, for instance:
85=cmd,/fully/qualified/path/to/script
save rpt.conf, restart asterisk.
Now, when you key up the node, and use *85, that script will run.
It should be noted that functions are decoded using the least number
of digits. So, if you have:
8=cmd,somescript
81=cmd,somescript
811=cmd,somescript
which script gets executed is left as an exercise. Really very simple and flexible. BB
wb0yle/w2fuv
···
On 1/17/2018 6:41 PM, David Shaw wrote:
Hello Everyone, Does anyone know how to use DTMF
tones to run a command, to execute external script?
tones to run a command, to execute external script?
1. write the bash script or program (you can execute programs too; I
suggest creating a subdirectory in the /etc/asterisk
directory…doug calls it ‘local’, I usually call it ‘scripts’),
debug it, make sure to ‘chmod 755 scriptname’.
2. Edit /etc/asterisk/rpt.conf.
3. Go to the [functionsxxxx] stanza for the node you're working
with. Of, if you have just one function stanza, go there.
4. Insert a line, for instance:
85=cmd,/fully/qualified/path/to/script
5. save rpt.conf, restart asterisk.
Now, when you key up the node, and use *85, that script will run.
It should be noted that functions are decoded using the least number
of digits. So, if you have:
8=cmd,somescript
81=cmd,somescript
811=cmd,somescript
which script gets executed is left as an exercise.
Really very simple and flexible.
BB
wb0yle/w2fuv
You do not need a password to unsubscribe, you can do it via email confirmation. If you have trouble unsubscribing, please send a message to the list detailing the problem.
–
Thanks, David
“Laws that forbid the carrying of arms…disarm only those who are neither inclined nor determined to commit crimes. Such laws make things worse for the assaulted and better for the assailants; they serve rather to encourage than prevent homicides, for an unarmed man may be attacked with greater confidence than an armed one.”
Looking at this reply and trying to get it to work with DTMF, Not very good at Linux but stumbling through and managing. Just need some clarification on some of the steps
So in rpt.conf
[functions]
80=cmd,/etc/asterisk/scripts.conf Or should it be something else?
81=cmd,/etc/asterisk/scripts.conf
So then I would in /etc/asterisk/ make a file scripts ? or a directory?
trying to run two scripts: sudo systemctl stop mmdvm_bridge
sudo systemctl start mmdvm_bridge
Then in /etc/asterisk/scripts.conf I have:
80=cmd,/sudo systemctl stop mmdvm_bridge
81=cmd,/sudo systemctl start mmdvm_bridge
Like I said not a Linux guru but I am trying
In CLI I get this error:
NOTICE[598]: app_rpt.c:4084 function_cmd: cmd param = /etc/asterisk/scripts.conf, digitbuf =
press your esc (escape) key, you will see a “:” at the bottom of the screen.
enter “wq!” without the " " to write out and quit .
type “chmod 755 start_bridge.sh” without the " ".
type “cd …” to go back up to /etc/asterisk
In your functions stanza, the command, say for 80, would be:
80=cmd,/etc/asterisk/scripts/start_bridge.sh
After you edit your rpt.conf, don’t forget to restart asterisk either from the command line or in the asterisk CLI by typing “rpt reload”.
Basically. No guarantee this will work, but it’s what I’ve done for over a decade and works fine. You can call other scripts from within scripts, so, one command can end up reconfiguring your entire asterisk instance.
How to reverse the above is left as an exercise for you to explore.