[arm-allstar] macro question

Doug Crompton doug at crompton.com
Fri Sep 4 09:29:00 EST 2015


Neil,

 There is currently no way I know of without using a dialplan to capture and pass DTMF. That is why I showed an example for a reasonable amount of channels, say 10 to 20 using function statements. Technically there is no reason why you cold not have a hundred functions defined but it would get very cumbersome. You could start at 800 and go up through 899.  BTW in your example you can't use *5x, that is reserved for macros.  

Another way you could do this is to have an up/down memory function which would go to the next or previous memory location. This would only take two function codes.

I am thinking this could be done with a dialplan via the autopatch link but it would require some thought and programming and may not be as flexible as you would want. Right now Allstar, via the radio, processes the DTMF sequences. There is no way to split off entries like  *8278 -  having Allstar respond to *82 then pass 78 somewhere else as a channel number. This would be a good update to the code being able to parse from an entered DTMF string but it does not exist now directly in Allstar.

For now if you must have this I would setup a reasonable number of function definitions that each pass a parameter to a script that calls hamlib directly and does what you want to do.
73 Doug
WA3DSP
http://www.crompton.com/hamradio


From: k8it at cac.net
To: arm-allstar at hamvoip.org
Date: Fri, 4 Sep 2015 00:51:09 -0400
Subject: Re: [arm-allstar] macro question








some very interesting ideas.
What I might try is to create a total of 11  scripts. Say *50 to 
*59, *60 
 
Using your ideas, I can use the first ten scripts to enter digits 0- 9 to a 
temporary variable, use localplay to echo the digit and exit. (Assume that 
the variable is equal to null at the beginning) Each of these scripts will test 
the    variable for    a length of 3 digits. When 
this occurs  another  script  will be called.  . This 
script will process the 3 DTMF  digits and call the HAMLIB  with 
the proper commands. .  The *60 macro  will call a disconnect 
script. Doing it this way I can get 1000 memories with only a few simple 
scripts. Also the temporary variable will be cleared to null once the memory 
connect command is issued.  What do you think of this idea?
 
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: Thursday, September 03, 2015 10:57 PM
To: ARM Allstar 
Subject: Re: [arm-allstar] macro question


Neil,

 You 
could define multiple functions that called the same script with different 
parameters or channels. In this case *D1 through *D3 would set channels 1-3. You 
can add more as you wish and even process additional parameters.
D1=cmd,/etc/asterisk/local/set_channel 1 
D2=cmd,/etc/asterisk/local/set_channel 
2
D3=cmd,/etc/asterisk/local/set_channel 
3
etc....

Then in the script test the parameter and 
execute the proper command or just use the parameter in the 
call to the command.

# !/bin/bash

if [ -z $1 
]
 then
   echo "No channel given (1-16)"
   
exit 0
fi

case "$1" in

  1) Echo "Channel 
1"
     # command for channel 1 to asterisk put 
here
     ;;

  2) echo "Channel 
2"
    # command for channel 2 to asterisk put 
here
     ;;

  3) echo "Channel 
3"
     # command for channel 3 to asterisk put 
here
     ;;
#etc.... add 
channels

esac

exit

By the way 
Dave, KB4FXC commented to me that you could use the dialplan in extensions .conf 
to do this and that is exactly what I did years ago in a script to control my 
X10 system from the phone in Asterisk.

Here is an example -

[controlx10]
exten => 
s,1,background(doug/enter_x10)
exten => s,n,Set(TIMEOUT(response)=4)
exten => 
s,n,Set(TIMEOUT(digit)=1)
exten => s,n,WaitExten()
exten => 
s,n,Goto(s,1)

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

exten => 
_0.,1,System(/usr/local/bin/x10 off ${EXTEN:1})
exten => 
_0.,n,SayNumber(${EXTEN:1})
exten => _0.,n,Playback(off)
exten => 
_0.,n,Goto(s,1)

exten => _3.,1,System(/usr/local/bin/x10 dim 
${EXTEN:1})
;exten => _3.,1,noop(${EXTEN:1})
exten => 
_3.,n,Goto(s,1)

exten => _4.,1,System(/usr/local/bin/x10 bright 
${EXTEN:1})
exten => _4.,n,Goto(s,1)

exten => 
_5.,1,System(/usr/local/bin/x10 allon ${EXTEN:1})
exten => 
_5.,n,Goto(s,1)

exten => _6.,1,System(/usr/local/bin/x10 alloff 
${EXTEN:1})
exten => _6.,n,Goto(s,1)

;exten => 
4,1,Playback(goodbye)
;exten => 4,n,Hangup()

exten => 
*,1,Return()
exten => #,1,Hangup()

This would need to be 
setup in Allstar but could work. I think for now an easier and more 
straightforward way would be to use the script method I proposed above if it 
works for you.

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





From: k8it at cac.net
To: arm-allstar at hamvoip.org
Date: Thu, 3 Sep 2015 
21:47:33 -0400
Subject: Re: [arm-allstar] macro question




Thanks Doug. And yes I agree with using scripts. What I am trying to do is 
respond to a users DTMF digits for a remote base application. I now have written 
script code using hamlib to control my TMV71A radio. it works good but only has 
a few preprogrammed memories based on which macro you use.
I would like to instead receive three DTMF digits and process them before 
passing them to the radio via hamlib. Somehow there is a way!
If I call a script
is it possible to call an asterisk function from within the script  to 
receive three DTMF digits directly to the script for more processing?
 
 
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: Thursday, September 03, 2015 8:53 PM
To: ARM Allstar 
Subject: Re: [arm-allstar] macro question


Neil,

 I 
don't think you can pass parameters to a macro. There would be no way to test 
for vlaues. Why not call a script and pass parameters there. here is an example 
from rpt.conf. This is defined in the [functions] section. *A1 would call this 
and execute sayip.sh.  27225 is the passed 
parameter.

A1=cmd,/usr/local/sbin/sayip.sh 27225 

The in the 
sayip.sh script $1 is then defined as 27225.  You can have multiple 
parameters so if it were -

A1=cmd,/usr/local/sbin/sayip.sh 1 2 
3

Then in the script $1 would =1, $2 would = 2, and $3 would 
=3.

This yet again shows the power of using scripts over built-in 
code.

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



> From: k8it at cac.net
> To: arm-allstar at hamvoip.org
> Date: 
Thu, 3 Sep 2015 19:00:20 -0400
> Subject: [arm-allstar] macro 
question
> 
> using a macro say for example
> *52 which can 
call a bash script
> How can I pass say the next three DTMF digits to the 
script to be processed?
> For example if a user enters *52123 where 123 is 
three random dtmf digits 
> how can I pass the 123 digits to the bash 
script?
> 
> 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
> 

> 
> _______________________________________________
> 

> 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 




No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.6125 
/ Virus Database: 4409/10570 - Release Date: 
09/03/15
_______________________________________________ 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 






No virus found in this 
message.
Checked by AVG - www.avg.com
Version: 2015.0.6125 / Virus 
Database: 4409/10570 - Release Date: 09/03/15

_______________________________________________

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/20150904/65f711c9/attachment-0001.html>


More information about the arm-allstar mailing list