Toys For app_rpt (acid)

Well, it is about time for me to begin posting some of the toys I have built for app_rpt.

I have quite a few so I shall show them in a way that they will be organized as a whole.

You may take from what I have done and change them to work your purpose in your own way but I will cation you, when I have posted them all, you will wish you had some organization to it all.

I will only be posting one at a time. I will post as much info as I can but offer no support. Please get/use a copy of the asterisk manual to understand more about how many of the things here are accomplished.

Some of you more familiar with asterisk might ask why I did not do things in other ways and the short answer to that is that app_rpt has a interfering control over some asterisk functions. Work-a-rounds were needed. You are welcome to take what I have done here and make it better.

In time, I will post how to do your own message recording through your system and eventually add voice recognition and tie that to artificial intelligence for a siri like interface I call “Peater-Stein” (rePeater einStein) .  But all in time (I don’t seem to have enough of that)

Use at you own risk. Make back-ups of your config files before editing them.

So here we go…

The first thing you will need to do to keep all of these organized is keep them all in a separate command  file.

We shall do this by adding a statement to the bottom of our extensions.conf file like this:

#includeifexists custom/ivr.conf

This means we will need to create a directory in/under asterisk called “custom” and create a file named “ivr.conf” in that sub-directory – So the full path of the new file would look like this:

/etc/asterisk/custom/ivr.conf

We will begin to build out all of our custom toys in this file. But first, we need a command prefix we will use in routing what we do in this file exclusively so you should not be using *97 or the context ivrmenu anywhere else.

So in rpt.conf  – add a line like this or change the command to something else totally unique.

97=autopatchup,context=ivrmenu,noct=1,farenddisconnect=1,dialtime=90000,quiet=1

This will direct app_rpt to seek extentions starting with *97xxxx and handle them like a autopatch with no CT or dialtone following the” ivrmenu” context and we shall answer all of them all in ivr.conf because that is where the context “ivrmenu” will be found.

At a command line, you can proceed to the directory

/etc/asterisk/custom/  and type

nano ivr.conf

place the following line first in the file… and the rest to follow…

[ivrmenu] ; 1st line.  *97 cmd uses context  ivrmenu – brings *97 cmds to this page/stanza.

; the beginning menu sorts and routes extension to a new stanza

; pre-evaluate – first extensions to prevent extension read-back for certain commands
; format of commands in this quite spot must be cmd,1 (first instruction)
;- this ends quite mode
exten =>_X.,1,SayAlpha(${EXTEN})       ; Readback Dialed Number
; format of commands in this spot must be cmd, (second instruction)
; Error trap – If command fell through, speak an error
exten =_X.,2,Playback(option-is-invalid&silence/1&please-contact-tech-supt)
exten =_X.,n,Playback(silence/1&vm-goodbye)
exten =_X.,n,Hangup
; this ends pre-evaluate in routing to new stanza

Save and exit. You have created the file we will use.

Here are some of the toys we will put in there (links will show when pages are done)

IP address readback via command

ID and Tail MSGs Recorder via app_rpt

EchoNode lookup/readback live by command

Voice recognition via app_rpt

Word speller via voice recognition (not useful but example of concept)

System command via voice recognition

Artificial Intelligence for your repeater – Peater-Stein

 

App-rpt resources on the web

These are a list of helpful resources on the web.

I’ll add to it from time to time.

System Admin Guide   http://kd3su.us/allStar/acid-sysadmin.pdf

Most important link for info for reference is  – http://ohnosec.org/drupal/

For help with app_rpt, jump onto the email reflector.

– http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users

 

Download the centos/app_rpt package   https://allstarlink.org/

Source Code SVN:

Source Asterisk http://svn.ohnosec.org/svn/projects/allstar/astsrc-1.4.23-pre/trunk

Source Limey http://svn.ohnosec.org/svn/projects/allstar/limey-linux/trunk/

Source ACID http://svn.ohnosec.org/svn/projects/allstar/acid/trunk/

 

App_Rpt for Beagle Board Black ( BBB ) by WA3DSP-Doug

http://www.crompton.com/hamradio/BeagleBoneBlackAllstar/BeagleBoneBlack.pdf

 

ADD-ON Toys and Apps

A WX Alert Script  for ACID http://wxscript.byrg.net/installation

A collection of apps by K0KN http://www.qsl.net/k0kn/scripts.html

 

Sometime by winter 2014, I will post many apps/toys I have built for app_rpt

Writing the how-to’s can take some time.   …73

COP iLink Status and Remote Command List

A Internal Command list For app_rpt (incomplete)
More is added from time to time. Some,not all default assignments shown.

An important note that I’m going to repeat for those that stumbled on this page without having read the others:

It is important to “organize” your commands so that you do not partially “dupe” a command.

I suggest keeping them in numerical order so it can be easily seen. Here is a example:

8900=cop,24   ; cancel localplay stream +/- telemetry

8901=localplay,/var/lib/asterisk/sounds/wx/wxfc    ;my custom wx script player example

8902=localplay,/var/lib/asterisk/sounds/wx/wxalert    ;my custom wx alert script player example

90=cop,1          ;warm boot
91=cop,2           ; System enable – you should not comment these out in a live system
92=cop,3        ; System disable

99=cop,6          ; Remote sip/telephone PTT key command  (# to unkey)

If I were to assign a command of *89 to anything, the above 4 digit 8901, 8902 would never execute. Unlike conventional controllers, asterisk will run with and execute the first match it gets.  So if there were a command created for *89,  *89 would always execute and” never ” execute a 3 or four digit command starting with *89.

So if you find yourself in this dilemma, make all *89 commands 3 or 4 digit commands to avoid it. Keeping them in order on your command list helps avoid the problem in the first place.

Saying that,  here is my list of assignable commands I have compiled over time.

Status Commands

80=status,1       ; Force id global
81=status,2       ; Time
82=status,3       ; Give Software ver Global

=status,11   ; Force ID (local only)
=status,12   ; Give Time of Day (local only)

87=status,15    ; global node query (reads back all nodes connected in the network

iLink Commands

=ilink,1 – Disconnect specified link
=ilink,2 – Connect specified link — monitor only
=ilink,3 – Connect specified link — transceive
=ilink,4 – Enter command mode on specified link

70=ilink,5        ; Link Status (long)
71=ilink,6        ; Disconnect All Links
72=ilink,7
75=ilink,8

=ilink,11 – Disconnect a previously permanently connected link
=ilink,12 – Permanently connect specified link — monitor only
=ilink,13 – Permanently connect specified link — transceive

73=ilink,15       ; Full Sys Status (all nodes)
74=ilink,16       ; Reconnect Links (that were disconnected by command)

=ilink,200 thru 215 – (Send DTMF 0-9,*,#,A-D) (200=0, 201=1, 210=*, etc)

Control Operator ( COP ) Commands
Keep in mind, some commands only valid under certain configurations.

=cop,1       ;warm boot
=cop,2       ; System enable
=cop,3       ; System disable
=cop,4        ; Test tone on/off – or # to end
=cop,5        ; Dump system variables on console (debug use only)
=cop,6          ; Remote base telephone tx cntl key
=cop,7        ; Time out timer enable
=cop,8        ; Time out timer disable
=cop,9        ; Autopatch enable
=cop,10        ; Autopatch disable
=cop,11        ; User linking functions enable
=cop,12            ; User linking functions disable
=cop,13        ; Query system control state
=cop,14        ; Set system control state
=cop,15        ; Scheduler enable
=cop,16        ; Scheduler disable
=cop,17        ; User functions enable (time, id, etc)
=cop,18        ; User functions disable
=cop,19        ; Select alternate hang time (althangtime)
=cop,20        ; Select standard hangtime (hangtime)
=cop,21     ; Enable Parrot
=cop,22     ; Disable Parrot
=cop,23     ; Bird Bath – Clean Residual stream  -also see cop 55
=cop,24     ; flush all pending telemetry in the buffer
=cop,25 ; return last node which unkeyed from any connected node (directly or indirectly)
=cop,26 ; Query all nodes which keyed or unkeyed from any connected node (directly or indirectly)

=cop,27   ; Reset DAQ minimum on a pin
=cop,28   ; Reset DAQ maximum on a pin
=cop,30   ; Recall Memory Setting in Attached Xcvr
=cop,31   ; Channel Selector for Parallel Programmed Xcvr

=cop,32     ; DTMF Pad test – end with #
=cop,33     ; Local Telemetry Output Enable
=cop,34     ; Local Telemetry Output Disable
=cop,35     ; Local Telemetry Output on demand

=cop,36     ; Foreign Link Local Output Path Enable
=cop,37     ; Foreign Link Local Output Path Disable
=cop,38     ; Foreign Link Local Output Path Follows Local Telemetry Selection (above)
=cop,39     ; Foreign Link Local Output Path Timed

=cop,40     ; IRLP announce Enable
=cop,41     ; IRLP announce Disable
=cop,42     ; Echolink announce node # only
=cop,43     ; Echolink announce node Callsign only
=cop,44     ; Echolink announce node # & Callsign
=cop,45     ; Link Activity timer enable        -LATENA
=cop,46     ; Link Activity timer disable        -LATDIS
=cop,47 ; Reset”Link Config Changed”Flag -none -change link state without arming activity timer

=cop,48 – Send Page Tone (Tone specs separated by parenthesis)
=cop,49 – Disable incoming connections (control state noice)
=cop,50 – Enable incoming connections (control state noicd)

=cop,51  ; Enable Sleep Mode
=cop,52  ; Disable Sleep Mode
=cop,53  ; Awaken from Sleep
=cop,54  ; Go back to sleep when the TX carrier drops
=cop,55     ; Parrot Once Command
=cop,58        ;Tx CTCSS On Input only Enable (also see itxctcss=1)
=cop,59        ;Tx CTCSS On Input only Disable

=cop,61,pp3=0 ; parallel port control: pp+pin number + 0 or 1 for on/off

=cop,80     ; Change Default Squelch Code (Xelatec)

Remote Base – default assignments shown

0=remote,1          ; Retrieve Memory
1=remote,2          ; Set freq.
2=remote,3          ; Set tx PL tone
3=remote,4          ; Set rx PL tone
40=remote,100       ; Rx PL off
41=remote,101       ; Rx PL on
42=remote,102       ; Tx PL off
43=remote,103       ; Tx PL on
44=remote,104       ; Low Power
45=remote,105       ; Medium Power
46=remote,106       ; High Power
711=remote,107      ; Bump -20
714=remote,108      ; Bump -100
717=remote,109      ; Bump -500
713=remote,110      ; Bump +20
716=remote,111      ; Bump +100
719=remote,112      ; Bump +500
721=remote,113      ; Scan – slow
724=remote,114      ; Scan – quick
727=remote,115      ; Scan – fast
723=remote,116      ; Scan + slow
726=remote,117      ; Scan + quick
729=remote,118      ; Scan + fast
79=remote,119       ; Tune (brief AM transmission for automatic antenna tuner)
51=remote,5         ; Long status query
52=remote,140        ; Short status query
67=remote,210       ; Send a *
69=remote,211       ; Send a #

91=remote,99,CALLSIGN,LICENSETAG
; Remote base login.
; Define a different dtmf sequence for each user which is
; authorized to use the remote base to control access to it.
; For examble 9139583=remote,99,WB6NIL,G would grant access to
; the remote base and announce WB6NIL as being logged in.
; Another entry, 9148351=remote,99,WA6ZFT,E would grant access to
; the remote base and announce WA6ZFT as being logged in.
; When the remote base is disconnected from the originating node, the
; user will be logged out. The LICENSETAG argument is used to enforce
; tx frequency limits. See [txlimits] below.

200 thru 215 – (Send DTMF 0-9,*,#,A-D) (200=0, 201=1, 210=*, etc)

Other

Here is handy command to run any script calling system commands that you can later call from a macro/scheduler.

XXX=cmd,/some/were/in/your/filesystem.sh  ;example to call a script by dtmf command

app_rpt COS and PTT through Parallel Port

This skinny direction set is only for the ACID distribution of app_rpt. (may be valid for other distros ?)

Using the Parallel port for radio COS / PTT is the cheapest and easiest route to go unless you want to hack-up a USB sound dongle that we will not talk about here. If you wish to do that see this link / PDF.

When using parallel port pins for any logic connections most especially experimental ones, I always suggest using something to buffer the lines in the printer/parallel port so that you do not do more damage than to just the port of your PC if higher voltage gets to one of the pins.

Parallel Port Breakout card with Opto-Coupled Transisters on output.

Parallel Port Breakout card with Opto-Coupled Transisters on output.

When I had built a DOS box repeater in the 90’s, I used a opto-coupled transistors to isolate the pins. Now-A-Days you can save yourself a bunch of time and money by buying parallel port cards already made with opto-couplers for cnc driving/controlling on eBay for $30 or less. They even have screw terminals for easy wiring ! The benefit I had back then is I could change the Parallel port card if I damaged it. Now they are built-in. Easy to damage more than just the port.

Just some “experience” talking here. And you know our moto definition of that word ( or see our home page )

 

 

 

 

First, you need to include a line like this for your  node in RPT.CONF :

iobase = 0x378      ; Parallel port address (using for cor/ptt & switches +dh-rbi )

The address is the parallel port address in hex. Normally 378, 278, 3bc are common addresses for the 1st, 2nd and 3rd ports.

OH… for those that do not know…

PTT is for “push to talk”. A TX line that normally goes to ground when active but not all are like this.

COS/COR is “carrier operated signal” or “carrier operated relay”. The logic on this line varies widely depending on where you can get the signal in the receiver. If your radio has a “s-meter”, that would be a good area to find a appropriate signal.

A short description of the pins we use on a parallel port.

We have:

8 data output lines starting with pin 2 as output 1 (pp1) to pin 9 as output 8 (pp8). These can be used for PTT on multiple nodes as defined in usbradio.conf . I would suggest starting from Output 8 (pin 9 / pp9) and work backwards to reserve the first three for a DH-RBI-1 or future devices. You can also use these to control other devices using relays (out of scope with this page).

5 data input lines  Pins 10,11,12,13 & 15 can be used for COS detections across multiple nodes. You can also use these from other sensors to trigger events in software (off topic, not going there in this page).

Changing the logic in/out with the software:

Parallel Port pins are defined in app_rpt software as “pp1”, “pp2”, “pp3″…etc

Setting them in USBRADIO.CONF

[usb29285]
pp6=ptt
pp11=cor

; carrierfrom=no      ;  available options for COS/COR type – Uncomment what’s needed.
; carrierfrom=dsp              ; use a valid signal decoded in DSP (internal)
; carrierfrom=pp                ; states we use pp for COS w/normal logic
carrierfrom=ppinvert     ; this option inverts the logic for cor on the chosen pp
; carrierfrom=usb              ; for hacking usb dongle method
; carrierfrom=usbinvert  ; same as above but inverted
; carrierfrom=vox              ; use vox for COS ( useful for a HF remote base )

ctcssfrom=dsp
rxdemod=flat
txprelim=yes
txlimonly=no

txtoctype=notone    ; Transmit tone control type: no,phase,notone
; no – CTCSS tone encoding with no hang time
; phase – encode CTCSS and reverse phase  AKA (“reverse burst”) before unkeying TX
; notone – encode CTCSS and stop sending tone before unkeying TX  AKA (“chicken burst”)

plfilter=yes      ; Filter PL tones/don’t pass to transmitter

txmixa=composite
txmixb=no
invertptt=0     ; use this to invert the normal logic state of the line
duplex=1
rxondelay=20
rxnoisefiltype=0
eeprom=0

#includeifexists custom/usbradio.conf

Some important notes:

The example above is a no-tone with carrier signal (COS) inverted. A simple set-up.

If you lack the ability to set-up a COS circuit, your best option is to set cos as tone/dsp and use that tone to signal a active receiver. Yes that makes your machine a PL’d repeater that you can not turn off the tone. But perhaps it will get you up and running for now.

You may need to invert the logic of pins manually with hardware/transistor to prevent transmitter “key-up” while booting your asterisk machine or it is powered off in certain circumstances where that initial transmitter hang would be disruptive until you get it turned on or booted.

As parallel port outputs (from PC) will only sink about 150 -250 ma of current and about 250-450 ma if you are using the opto-coupled board, you may need to use the line to toggle a external transistor or relay to achieve higher currents to switch the PTT or other devices. If in doubt, use a low current fast relay or transistor to buffer the signal. Save your port and/or machine.

EchoLink Configuration for app_rpt

As with all our “skinny” guides on app_rpt, we speak only of the ACID distribution.

In your /etc/asterisk directory you will find a echolink.conf file.

This is the only file you need to edit for a working system to enable echolink connections via one of your allstar defined (or private defined) nodes. You “can” configure this to a node that is not your repeater node. When you want echolink connectivity, just connect your node to it or use a startup macro to maintain it from startup. The reason one might want to do it this way is that you will have the ability to disconnect from echolink connectivity. It can be desirable in some situations. You can not disconnect it from the assigned node.

File contents:

[el0]                                                  ; echolink definition 1 (computer logic 0=1)
confmode=yes                             ; enable conference mode yes or no – allows multi-connections
call=YOURelCALL-r                  ; Your echolink callsign, include the -r or -l or/as per your setup
pwd=YOURelPASSWORD      ; your echolink password
name=Mike                                    ; your firstname or club name
qth=City,State
email=email@domain.com   ; your listed email as per echolink setup
maxstns=20                                 ; max connections on this port
rtcptimeout=10
node=804396                               ; your echolink ode number
recfile=/tmp/recorded.gsm   ;  file and location to record audio
astnode=50444                           ; your allstar node number to attach echolink to
context=radio-secure               ; context of asterisk connection

freq=147.210                               ; not mandatory
tone=114.8                                    ; not mandatory CTCSS Tone (0 for none)

lat=0                     ; lat & long (profile) of site – not mandatory but suguested
lon=0
power=0 ; 0=0W, 1=1W, 2=4W, 3=9W, 4=16W, 5=25W, 6=36W, 7=49W, 8=64W, 9=81W (Power in Watts)

height=0 ;0=10 1=20 2=40 3=80 4=160 5=320 6=640 7=1280 8=2560 9=5120 AMSL in Feet

gain=0 ; Gain in db (0-9)
dir=0 ; 0=omni 1=45deg 2=90deg 3=135deg 4=180deg 5=225deg 6=270deg 7=315deg 8=360deg

server1=naeast.echolink.org             ; you have 3 defined servers of 6 or more
server2=nasouth.echolink.org         ; use what works for you.
server3=servers.echolink.org          ; sometimes, some servers not working

; server1.echolink.org
; server5.echolink.org
; server3.echolink.org
; backup.echolink.org

deny=a1ass  ; deny access to station(s) –  state one line at a time:  deny = callsign
deny=n8wow
deny=no2ass

Notes:

You do have a echolink audio gain control in rpt.conf file if/as needed.

You can have a second echolink definition [el1] and more but keep in mind that echolink will only allow one echonode per IP address ( could change someday).

app_rpt Macro and Scheduler

First I should lightly define this for those that do not understand.

A MACRO is a single or multiple set of commands to be executed by a single simple command.

You could use it to have a user command that executes a string of commands making the entire function easy to preform for any user. An example would be to make several link connections with just a 4 digit macro command. It is all about what you put in the MACRO.

To my knowledge, you can not make a macro do anything you could not do with a command directly because you are entering actual commands to be executed. Need more… You can  execute a system/asterisk command line that would make just about anything possible within a script file but it has to be defines as a command first. Use your macro to call that command

Set-up for these are in rpt.conf

They are programed in this fashion,

A number for the macro (will be the executing command #)

A equals sign =

each command as you might issue to it from the keypad but separated by a space

after the last command in the string, end with a pound sign # (space#)

The format looks like this for a macro number of 10:

10=*81 *229285 #

So if you were to enter *5 10 ,  it would execute macro 10 (*5 is the command to execute a macro and the 10 is the macro we are executing). Our example here macro 10- plays the time (*81) and then makes a link connection for monitor (*2) on node (29285)

This can be a powerful way to make complex functions work in a simple way. Use your imagination and you can dream up some pretty snazzy stuff.

What makes this even more powerful, The scheduler.

The scheduler allows you to automatically “EXECUTE A MACRO” at a given time of day and/or date. A macro is the only thing the scheduler can execute. So if you want to automate, start with the macro.

Here is the format (like system cron for those familiar with linux)

First item in the string is the macro number we are going to execute at the chosen time. It must be a macro number you have defined in MACROS

After the macro number, a equal sign, then the time of execution in this format.

Minutes, Hour, DayofTheMonth, Month, DayOfTheWeek (seperated by a space) and use a STAR “*” for a wildcard, meaning it could match anything in that position.

Example:

10=00 * * * *

This will execute macro 10 on the top of the hour (at 00 minutes of any hour , any day of the month, any month, any day of the week)

1=05 * * * 0

This will execute “macro 1” at 5 minutes into any/every hour but only on Sunday (0=sunday 6=saturday…    computer logic numbers)

2=30 12 * * * ; execute macro 2 at 12:30 everyday

3=15 18 25 12 * ; execute macro 3 at 6:15pm christmas day

Remember you must “specify all 5 time parameters”. If it does not matter, it is a * -wildcard or it might not work.

Be certain to think your scheduler and macros through. Understand the implications of what you are doing. Test the macros out for functionality before setting them on a schedule (*5xx).

Handy functions for this are things like the hourly time announcement, disconnecting links after late hours, playing voice announcements, disabling functions for late at night and turning them back on in daytime. etc.

THIS PAGE NOT YET COMPLETE !