DialPlan For DVSwitch Tune
This is a example asterisk/app_rpt dialplan for tuning the DVSwitch MMDVM system. Please note that there is no perfect way to tune dvs in all modes with dtmf... YET ! This is a workaround.
We make use of a modified autopatch entry. Please read this page before you start. / How To Pass DTMF To Shell Scripts
Assuming you have created the special autopatch context dialer command as described in that page and given it a unique context to dial into, that we will use here as
[dvs-set] ; this context needs to be unique in the system & match your dialing context.
Use Format:
- (AP command prefix) + (dvs mode 1-5) + (dvs tg)
- Requires that you set dvs mode each time with the leading digit 1-5.
- So, a command here of *97 1 3100 would set dmr 3100
- And *97 2*2xxx would tune dstar dcsxxx
- 2xxxx tunes dstar adhoc number only
- 2*1xxx tunes dstar REFxxx
- 2*2xxx tunes dstar DCSxxx
- 2*3xxx tunes dstar XLSxxx
- 2*4xxx tunes dstar XRFxxx
- 2*5x tunes dstar mem # or ## from file
- ** disconnects from any mode
The DialPlan
In extensions.conf
[dvs-set] ; this context needs to be unique in the system and match the dialing context
exten = _1.,1,Wait,1 ; The following for dmr
exten = _1.,2,NoOp() ; room for you to insert a command without renumbering anything
exten = _1.,3,SayAlpha(dmr,${EXTEN:1}) ; speak dmr tg before execution
exten = _1.,4,Wait,4 ; wait with time to cancel (autopatchdn)
exten = _1.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode DMR) ; set mode
exten = _1.,6,Wait,1 ; allow some time to return from the shell
exten = _1.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune ${EXTEN:1}) ; set TG
exten = _1.,8,Hangup ; done/hangup
exten = _2x.,1,Wait,1 ;The following for dstar-XLX
exten = _2x.,2,NoOp()
exten = _2x.,3,SayAlpha(d*,${EXTEN:1}) ; speak dstar & tg before execution
exten = _2x.,4,Wait,4
exten = _2x.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode DSTAR)
exten = _2x.,6,Wait,1
exten = _2x.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune ${EXTEN:1})
exten = _2x.,8,Hangup
exten = _2*1.,1,Wait,1 ;The following for dstar-REF
exten = _2*1.,2,NoOp()
exten = _2*1.,3,SayAlpha(d*,ref${EXTEN:2}) ; speak dstar & tg before execution
exten = _2*1.,4,Wait,4
exten = _2*1.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode DSTAR)
exten = _2*1.,6,Wait,1
exten = _2*1.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune ref${EXTEN:2})
exten = _2*1.,8,Hangup
exten = _2*2.,1,Wait,1 ;The following for dstar-DCS
exten = _2*2.,2,NoOp()
exten = _2*2.,3,SayAlpha(d*,dcs${EXTEN:2}) ; speak dstar & tg before execution
exten = _2*2.,4,Wait,4
exten = _2*2.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode DSTAR)
exten = _2*2.,6,Wait,1
exten = _2*2.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune dcs${EXTEN:2})
exten = _2*2.,8,Hangup
exten = _2*3.,1,Wait,1 ;The following for dstar-XLS
exten = _2*3.,2,NoOp()
exten = _2*3.,3,SayAlpha(d*,xlx${EXTEN:2}) ; speak dstar & tg before execution
exten = _2*3.,4,Wait,4
exten = _2*3.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode DSTAR)
exten = _2*3.,6,Wait,1
exten = _2*3.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune xls${EXTEN:2})
exten = _2*3.,8,Hangup
exten = _2*4.,1,Wait,1 ;The following for dstar-XRF
exten = _2*4.,2,NoOp()
exten = _2*4.,3,SayAlpha(d*,xrf${EXTEN:2}) ; speak dstar & tg before execution
exten = _2*4.,4,Wait,4
exten = _2*4.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode DSTAR)
exten = _2*4.,6,Wait,1
exten = _2*4.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune xrf${EXTEN:2})
exten = _2*4.,8,Hangup
exten = _2*5.,1,Wait,1 ;The following for dstar memory file /opt/mmdvm/dstar.mem
exten = _2*5.,2,NoOp()
exten = _2*5.,3,SayAlpha(d*,m${EXTEN:3}), ; speak dstar & mem# before execution
exten = _2*5.,4,Wait,3
exten = _2*5.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode DSTAR)
exten = _2*5.,6,Wait,1
exten = _2*5.,7,System(/opt/MMDVM_Bridge/dstarmem.sh ${EXTEN:3}) ; calls a secondary shell that hands off info to dvs tune
exten = _2*5.,8,Hangup
exten = _3.,1,Wait,1
exten = _3.,2,NoOp()
exten = _3.,3,SayAlpha(ysf,${EXTEN:1}) ; speak YSF & tg before execution
exten = _3.,4,Wait,4
exten = _3.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode YSF)
exten = _3.,6,Wait,1
exten = _3.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune ${EXTEN:1})
exten = _3.,8,Hangup
exten = _4.,1,Wait,1
exten = _4.,2,NoOp()
exten = _4.,3,SayAlpha(p25,${EXTEN:1}) ; speak p25 & tg before execution
exten = _4.,4,Wait,4
exten = _4.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode P25)
exten = _4.,6,Wait,1
exten = _4.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune ${EXTEN:1})
exten = _4.,8,Hangup
exten = _5.,1,Wait,1
exten = _5.,2,NoOp()
exten = _5.,3,SayAlpha(nxdn,${EXTEN:1}) ; speak nxdn & tg before execution
exten = _5.,4,Wait,4
exten = _5.,5,System(/opt/MMDVM_Bridge/dvswitch.sh mode NXDN)
exten = _5.,6,Wait,1
exten = _5.,7,System(/opt/MMDVM_Bridge/dvswitch.sh tune ${EXTEN:1})
exten = _5.,8,Hangup
exten = _**.,1,Wait,1
exten = _**.,2,NoOp()
exten = _**.,3,SayAlpha(disc)
exten = _**.,4,Wait,3
exten = _**.,5,,System(/opt/MMDVM_Bridge/dvswitch.sh tune disconnect) ; set TG dis
exten = _**.,6,Hangup
DStar Memory File
- The intention here was just a method to connect systems that can not be entered into a 15 usable dtmf digit string reasonably. But you could just store your favorite 10 for ease of dialing.
- To use dstar memory calls, you need to create a file in /opt/MMDVM_Bridge/dstar.mem
- and populate it one dstar connection of any valid call that can be made through DVS per line
- Do not put anything else in the file as it begins reading from line 1 (no comments or blank lines)
- A extra command in the dialplan of " 2*5 xx " will call the line# of the memory file.
- EXAMPLE
- dcs006f
- DCSSAT
- DCSUS1
- DCSUS2
- DCSUS4
- Requires one additional batch file in the /opt/mmdvm_bridge/ directory called dstarmem.sh with these contents
- !/bin/bash
- /opt/MMDVM_Bridge/dvswitch.sh tune $(sed "$1q;d" /opt/MMDVM_Bridge/dstar.mem)
- (for some reason I could not execute this inside the dialplan and suspect it's our older version of asterisk or some bad syntax... so, using alt method)
- Don't forget to set ownership and permissions of the dstarmem.sh file
Summary
While this is not a perfect model of operation, it is a functional example for which allows you to develop your own methods beyond it using methods and principles you see.
The intention here was the old KISS rule and to keep it all in one place as much as possible for easy understanding. Obviously, this will challenge your memory if you do not use it often.
For those of you who require such functionality, make a cheat sheet to carry with you mobile/portable etc.
Perhaps you will devise something better we can post here ?
Since we are dialing by context, and to keep my extensions.conf file a bit cleaner (it's big),
I set this in a file in /etc/asterisk/custom named dvs.conf and call it at the end of extensions.conf
'#includeifexists custom/dvs.conf' .