[arm-allstar] scripting - last dtmf digit received in client display

Neil k8it k8it at cac.net
Tue Dec 8 17:11:32 EST 2015


Doug
THANK YOU
You have just opened the door to many script possibilities. You should write the book
Scripting in Asterisk"
Thanks again and I will let you know my results in a week or so

Thanks
73 Neil Sablatzky  K8IT
Allstar Node 41838 KITLINK
Allstar Node 42087 KITLINK HUB
IRLP Node exp0068
Echolink K8IT-L
WIRES-X K8IT 11479 Room 21479


From: Doug Crompton 
Sent: Tuesday, December 08, 2015 4:22 PM
To: ARM Allstar 
Subject: Re: [arm-allstar] scripting - last dtmf digit received in client display


Neil,

 A couple of more points on my last message. You should comment or delete the line that plays - "please enter the"  It is redundant the digits have already been passed. With that line removed if you enter  *61114300 it will playback  - Frequency 14300.

You could enter a line after the SayDigits line like this -

exten => _1xxxxx,n,Playback(megahertz)

Then it would say - Frequency 14300 megahertz

hertz, kilohertz, and gigahertz are also available.

The reason to enter the second "1" - 611 - is that it points it to the first context. In that way you can have 10 sections 0-9  or  *610 thru *619  with parameters after that. Each section could do something else. If you wanted more you could add a third digit. Each context could have as many DTMF characters passed to it as desire or it could be none if none are needed.

Asterisk can make system calls so anything that would run under Linux can be executed and parameters can be passed. Here is an example of how I call x10 control from my phone -

exten => _1.,1,System(/usr/local/bin/x10 on ${EXTEN:1})

In this case I execute the x10 program in /usr/local/bin and pass it the parameters "on" and one digit of the extension.

So if you wanted to pass the frequency to hamlib (I don't know hamlib parameters so this is JUST and example)

exten => _1.,1,System(/directory-location/hamlib <freq-command> ${EXTEN})

The digits can be formatted either in the extensions file with asterisk commands or sent to an external script for formatting. 

Also note that any playback in asterisk would be global. That is if you are connected to other nodes they would hear "Frequency 14300"  There are ways to get around this by using system calls either in the dial plan or in a script that directly calls asterisk and executes rpt commands. You can execute rpt commands from the dialplan but there is no SayDigit command in Allstar so you would have to use a script to say the individual digits. An example is in the script that says the IP address which calls speaktext.sh. If this is an issue then you could go to the extra trouble but if not it would greatly simplify things.

While the example I show uses the current default *61 to enter the patch you could leave that line intact if you are using it to actually do patch things and enter a new line with the same parameter except with the "context=" changed and a different function code defined. So as an example entering -

871=autopatchup,context=command_radio,noct=1,farenddisconnect=1,dialtime=20000,quiet=1  

and leaving the 61 function alone would mean that you would enter

*8711xxxxx  to enter a five digit frequency. Of course the number of frequency digits could be any lenght defined by the x's indicating a digit.

73 Doug
WA3DSP
http://www.crompton.com/hamradio




--------------------------------------------------------------------------------
From: doug at crompton.com
To: arm-allstar at hamvoip.org
Date: Tue, 8 Dec 2015 13:46:44 -0500
Subject: Re: [arm-allstar] scripting - last dtmf digit received in client display


Neil,

 OK here is a way to do this at least here are the clues to do it. I have not done it completely for you but what I show here does work.

First in rpt.conf find the phone patch function - 61

change the context=  to context=command_radio

then in extensions.conf add the following context at the end -

[command_radio]
exten => _1xxxxx,1,Playback(please-enter-the)
exten => _1xxxxx,n,Playback(frequency)
exten => _1xxxxx,n,SayDigits(${EXTEN})
exten => _1xxxxx,n,Wait(2)
exten => _1xxxxx,n,Hangup()

You need to understand asterisk dial plans in order to understand this but basically the way this is setup if you enter at the radio  *611xxxxx  the last 5 digits will be passed as the EXTEN variable in Asterisk. At that point you could do whatever you wanted with it - like pass to a script that sent it to hamlib for execution. Of course the number of digits could be changed and other functions could be added.

When changing either file you need to either reload then in the client or restart Allstar.

The Asterisk diaplan is very powerful but you need to hone up on the commands and syntax!!!

This is the (more) right way to do this rather than adding stuff to Allstar.

73 Doug
WA3DSP
http://www.crompton.com/hamradio




_______________________________________________ arm-allstar mailing list arm-allstar at hamvoip.org http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar Visit the BBB and RPi2 web page - http://hamvoip.org


--------------------------------------------------------------------------------


_______________________________________________

arm-allstar mailing list
arm-allstar at hamvoip.org
http://lists.hamvoip.org/cgi-bin/mailman/listinfo/arm-allstar

Visit the BBB and RPi2 web page - http://hamvoip.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hamvoip.org/pipermail/arm-allstar/attachments/20151208/cddd3776/attachment-0001.html>


More information about the arm-allstar mailing list