At 15:53 14/06/2015, mike@midnighteng.com wrote:
Barry,
I wrote a little script to do what you want.
macro you want to call to turn it off after the timer has elapsed. Thanks...
The script works fine on its own I can run it on the UNIX Cmd Line> thats fine. I dont think the cmd, ... is being executed from inside asterisk I have added this to the rpt.conf maybe I put the call in the wrong place.? [functions28203] 1=ilink,1 2=ilink,2 3=ilink,3 4=ilink,4 5=macro,1 70=ilink,5 71=ilink,6 72=ilink,7 73=ilink,15 74=ilink,16 75=ilink,8 80=status,1 81=status,2 ; ; Control GPIO Port 1 on URI FOB db25.Pin2 C90=cop,61,GPIO1=1 ; Turn on GPIO 1 C91=localplay,/var/lib/asterisk/sounds/enabled C92=cop,61,GPIO1=0 ; Turn off GPIO 1 C93=localplay,/var/lib/asterisk/sounds/disabled ; C94=cmd,/etc/asterisk/myscripts/macro-timer.sh ; ; 6=autopatchup,noct=1,farenddisconnect=1,dialtime=20000 ; Autopatch up 0=autopatchdn ; Autopatch down ;989=cop,4 980=status,3 99=cop,6 ; Place command macros here [macro28203] 1 = *C90*C91*C94# 2 = *C92*C93# macro *51 will call *C90*C91*C94# and do the GPIO + Announce enabled + runs script however the script does not run? when called.? macro *52 will call the GPIO + Announce disabled and is called from the script correctly when run on the cmd line out side asterisk Thoughts Barry
Timer is in seconds.
...Let me know how it works for you.
...mike/kb8jnm
I ran this and it works for me... Copy it into a file. directions included... #!/bin/bash # Timed script for GPIO Control # k8sn@k8sn.org # filename: /etc:asterisk/local/gpio_pusle.sh # After saving the file, make sure the file is able to be executed: #chmod 0755 /etc/asterisk/local/gio4_pulse.sh # Replace xxxx with your node number #use any TT command in your rpt.conf file to start the timed output for example: #9681= cmd,/etc/asterisk/local/gpio_pulse.sh # This is the actual file: # First we turn on the gpio4 and announce to the users: /usr/bin/asterisk "rpt cmd xxxx cop 61,gpio4=1 0" sleep 5 /usr/bin/asterisk "rpt localplay xxxx /etc/asterisk/local/gpio4_on" # Now we wait for 30 minutes: sleep 30m # Now we shut it back off and announce to the users: /usr/bin/asterisk "rpt cmd xxxx cop 61,gpio4=0 0" sleep 5 /usr/bin/asterisk "rpt localplay xxxx /etc/asterisk/local/gpio4_off" exit 0 # Works good for me. however, your mileage may vary.. contents may be HOT! On Sun, Jun 14, 2015 at 11:26 AM, Barry <g8sau@sidx.org.uk> wrote:
At 15:53 14/06/2015, mike@midnighteng.com wrote:
Barry,
I wrote a little script to do what you want.
macro you want to call to turn it off after the timer has elapsed.
Thanks...
The script works fine on its own I can run it on the UNIX Cmd Line> thats fine. I dont think the cmd, ... is being executed from inside asterisk I have added this to the rpt.conf
maybe I put the call in the wrong place.?
[functions28203] 1=ilink,1 2=ilink,2 3=ilink,3 4=ilink,4 5=macro,1 70=ilink,5 71=ilink,6 72=ilink,7 73=ilink,15 74=ilink,16 75=ilink,8
80=status,1 81=status,2
; ; Control GPIO Port 1 on URI FOB db25.Pin2 C90=cop,61,GPIO1=1 ; Turn on GPIO 1 C91=localplay,/var/lib/asterisk/sounds/enabled C92=cop,61,GPIO1=0 ; Turn off GPIO 1 C93=localplay,/var/lib/asterisk/sounds/disabled ; C94=cmd,/etc/asterisk/myscripts/macro-timer.sh ; ; 6=autopatchup,noct=1,farenddisconnect=1,dialtime=20000 ; Autopatch up 0=autopatchdn ; Autopatch down
;989=cop,4 980=status,3 99=cop,6
; Place command macros here
[macro28203]
1 = *C90*C91*C94# 2 = *C92*C93#
macro *51 will call *C90*C91*C94# and do the GPIO + Announce enabled + runs script however the script does not run? when called.?
macro *52 will call the GPIO + Announce disabled and is called from the script correctly when run on the cmd line out side asterisk
Thoughts Barry
Timer is in seconds.
...Let me know how it works for you.
...mike/kb8jnm
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
To unsubscribe from this list please visit http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users and scroll down to the bottom of the page. Enter your email address and press the "Unsubscribe or edit options button" 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.
participants (2)
-
Barry -
Sam Nabkey