This Oz, Aussie, Australian Dial Plan was originally configured for NSW Australia, however you can easily update it to reflect the different states, countries and geographic region you use it in. If you do not know how to customise and change it, read the examples in Steps 1 to 3 below.
The purpose of this Topic was to share a highly-functional, yet easy-to-understand and change, dial plan that was specific for Australian users!
I have divided up the Outbound / Outgoing Dial Plan into segments to 'hopefully' make it easier to read and understand how it works. Copy ALL segments below, and paste them either into a blank SIP Sorcery dial plan or Notepad++. Or download the RUBY dial plan at the bottom of the post (advanced users only!).
_______________________________________________________________________________
# STEP ONE #
Where are you located? What state do you call from?
#A. NSW 02 & VIC/TAS 03 Local Calls, as of 2015 ACMA:
All local numbers start with '3', '4','5', '6','7','8','9', after the 02/03.
This would appear as "[3456789]" or simply "[3-9]".
They are split up into designated areas and regions:
- 3, 4, 5, 6 (Regional NSW/VIC/TAS)
- 7, 8, 9 (Sydney/Melbourne Metro)
- NSW/VIC/TAS: 3,4,5,6,7,8,9 = [3-9]
- 2, 3 (Brisbane Metro / Regional QLD)
- 4, 5, 7 (Regional QLD)
- QLD: 2,3,4,5,7 = [2-57]
- 2, 5; (Regional)
- 7; (SA)
- 8; (SA, WA, NT)
- 6, 9; (WA, Islands)
- N.T.: 2,5,8 = [258]
S.A.: 2,5,7,8 = [2578]
W.A.: 2,5,8,9 = [2589]
But if you want to be lazy, you can of course, just use "[2-9]", but this may conflict with other services (or currently inactive services) in some states.
# STEP TWO #
If you use any carrier-specific call services (or VSP-specific services), that I don't, you can add them. For example:
Code: Select all
(0)1 0 xxxxx xxxxxxxxxx [Telstra 8-18 digits]
(0)1 8 01xxxx [Telstra 9 digits]
(0)1 2 xxxxx xxxxxxxxxx [Optus 8-18 digits]
(0)x 5550 / (0)x 0550...
I have some extra space under step two, so will explain what "${EXTEN}" and "${dst}" mean and which you should use.
For example, you can use either "${EXTEN:2}" or "${dst:2}" - in this example, both will trim the first two characters from the input. Some examples online or on the forums will use EXTEN, others DST. They both mean the same thing - i.e. what was entered on the keypad by the caller when dialling. Personally, I use EXTEN, but the choice is yours.
# STEP THREE #
Create a list of your VoIP accounts / Voice Service Providers (VSPs). Once complete, create a list like below:
- NAME - - LABEL # - - CHEAPEST RATES
Example - EXA_1 - Mobile 12c.
PennyTel - PTL_1 - STD 8c, Mobile 7.8c, Int'l.
MyNetFone - MNF_1 - STD 8c, Int'l.
TeleCube - TLC_1 - STD 10c, Mobile 5c.
TeleCube - TLC_2 - STD 1.5c, Mobile 8c.
SIPTalk - STK_1 - STD 7.8c, Mobile 6.5c
Insert the "Label" in the "____" fields below, matching the SIP Provider's call type for the cheapest rates above.
# STEP FOUR #
OUTBOUND RUBY DIAL PLAN
This plan works on all devices I have used connected to SIP Sorcery (SS). I have included some in-line documentation so newb's can learn and get up and running quickly. The code below is RUBY and can be inserted into Notepad++ to display the syntax, making it easier to read.
_______________________________________________________________________________
Diagnostic/Debugging Output & Logic 'Case' Code Snippet. REQUIRED!
Code: Select all
# DIAGNOSTICS & DEBUGGING OUTPUT #
sys.Log("+ - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - +")
sys.Log("+ NEW OUTBOUND CALL INITIATED! OUTBOUND CALL LEG INFORMATION! +")
sys.Log("+ - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - +")
sys.Log("o: req.URI.Host: #{req.URI.Host} // .Host.to_s: #{req.URI.Host.to_s}")
sys.Log("o: req.URI.User: #{req.URI.User} // .User.to_s: #{req.URI.User.to_s}")
sys.Log("o: req.URI.ToString: #{req.URI.ToString}")
sys.Log("o: req.Header.From: #{req.Header.From}")
sys.Log("o: .FromURI.User: #{req.Header.From.FromURI.User} // .FromURI.Host: #{req.Header.From.FromURI.Host}")
sys.Log("o: .FromURI.User.to_s: #{req.Header.from.FromURI.User.to_s} // .FromName: #{req.Header.From.FromName}")
sys.Log("o: .ToString: #{req.Header.From.ToString} /// req.Header.To: #{req.Header.To} /// .to_s: #{req.Header.To.to_s}")
sys.Log("o: .ToURI: #{req.Header.To.ToURI} // .ToName: #{req.Header.To.ToName}")
sys.Log("o: req.Header.Contact[0]: #{req.Header.Contact[0]} /// req.Header.Contact[0].ContactURI: #{req.Header.Contact[0].ContactURI} /// req.Header.Contact[0].ContactName: #{req.Header.Contact[0].ContactName} /// req.Header.CSeq: #{req.Header.CSeq} // req.Header.CallId: #{req.Header.CallId}")
sys.log("+ - - - + - - - + - - - + - - - + - - - + - - - + - - - +")
sys.Log("")
# START CALL LOGIC RULES
case req.URI.User
Code: Select all
# -----------------------------------------------------------------------------
# SPEED DIAL # [INTERNAL VIRTUAL EXTENSIONS]
# -----------------------------------------------------------------------------
# >> VSPs: SIPSorcery, and VSPs supporting SIP URI.
# NOTE: Recommend 3 to 5 digit extensions. Replace "__Name__" fields with the memorable name you wish to assign people; plus "___@" with destinations. E.g. 202 and Alex and 12345@xxx. So you can then use a SoftPhone and enter just "alex" to dial his/her number(s).
when /^211/, "__Name__" then sys.Log("==== __Name__ Speed Dial =====")
sys.Dial("____@local",25) # Fail after no-answer in 23-25 sec.
sys.Dial("__Mobile__@SIP_PROVIDER") # Alternate 'number' if first fails/no answer.
when /^212/, "__Name__" then sys.Log("==== __Name__ Speed Dial =====")
sys.Dial("____@local")
when /^213/, "__Name__" then sys.Log("==== __Name__ Speed Dial =====")
sys.Dial("____@local")
when /^221/, "__Name__" then sys.Log("==== __Name__ Speed Dial =====")
sys.Dial("____@local")
when /^222/, "__Name__" then sys.Log("==== __Name__ Speed Dial =====")
sys.Dial("____@local",25)
sys.Dial("__Mobile__@SIP_PROVIDER") # Alternate 'number' if first fails/no answer.
Code: Select all
# -----------------------------------------------------------------------------
# SPEED DIAL # [CALL HUNT & ROUND ROBIN OF EXTENSIONS - INTERNAL/EXTERNAL]
# -----------------------------------------------------------------------------
# >> VSPs: SIPSorcery, PTL_x MNF_x TLC_x STK_x, and VSPs supporting SIP URI.
# >> CALL HUNT - dials five extensions, first to pickup stops hunt.
when /^____/ then sys.Log("Call Hunt - Sales/Marketing")
sys.Dial("___&___&___&___&___") # If all extensions fail, then continue...
sys.Log("All Call Legs Failed! Diverting to Unavailable Voicemail (VM).")
sys.Dial("1234@voicmail-server...")
# - OR - #
when /^____/ then sys.Log("Call Hunt - Sales/Marketing | Buay Voicemail")
sys.Dial("___&___&___&___|1234@voicmail-server...",23) # Dial for ~20sec; fail and divert to Busy VM.
# - OR - #
when /^____/ then sys.Log("Call Hunt - Sales/Marketing | Reception | Busy Voicemail")
sys.Dial("__1st__&__2nd__[dt=12]&__2nd__[dt=12]&__1st__&__1st__&__1st__&__3rd__[dt=22]&__3rd__[dt=22],33|1234@voicmail-server...") # Dial 4 Ext's AND after ~10sec delay dial 2 MORE Ext's (total 6 being dialled); after TOTAL ~20sec dial 2 MORE Ext's (total 8 being dialled); after total of ~30sec fail/time-out and divert to Voicemail. # ???? <<<< TO DO: TEST DELAYS & DT=x >>>> ???? ***UPDATE*** EACH ___ IS DIALLED SERIALLY. ANY ___ WITH [DT=x] WILL AFFECT ONLY THAT "EXTEN"/____ NUMBER DIALLED.
# >> ROUND ROBIN - bounce between groups of extensions, after pick hunt stops.
when /^____/ then sys.Dial("____&____&____&____&____",18) # Dial Accounts; After ~15sec (18), continue.
sys.Dial("____&____&____&____&____",18) # Dial Finance; After ~15sec (18), continue.
sys.Dial("____&____&____&____&____&____&____",18) # Dial Accounts & Finance; After ~15sec (18), continue.
sys.Dial("____&____|1234@voicmail-server...",18) # Dial Reception for ~15sec; fail and divert to Busy VM.
# - OR - #
when /^____/ then sys.Log("Round Robin - Dial Reception")
sys.Dial("____&____",11) # Dial Reception Exts for ~8sec (11), continue.
sys.Log("Round Robin #2 - Dial Administration")
sys.Dial("____&____&____&____&____",11) # Dial Exts for ~8sec (11), continue.
sys.Log("Round Robin #3 - Dial Marketing"
sys.Dial("____&____&____&____&____",11) # Dial Exts for ~8sec (11), continue.
sys.Log("Round Robin #4 - Dial Support"
sys.Dial("____&____&____&____",11) # Dial Exts for ~8sec (11), continue.
sys.Log("Round Robin #5 - Dial Reception + Administration"
sys.Dial("____&____",11) # Dial Exts for ~8sec (11), continue.
sys.Log("Round Robin #6 - Dial Team Leaders | Fail to Voicemail if not answered!!"
sys.Dial("____&____&____,23|1234@voicmail-server...") # Dial Ext's for ~20sec (23); fail and deiver to Busy VM.
Code: Select all
# -----------------------------------------------------------------------------
# SPEED DIAL # [EXTERNAL SIP URI CALLS]
# -----------------------------------------------------------------------------
# >> VSPs: SIPSorcery, PTL_x MNF_x TLC_x STK_x, and VSPs supporting SIP URI.
# [EXAMPLES + SAMPLES + DEMONSTRATION]
when /^1511/, "Fred" then sys.Dial("frederick.smith@voice-provicer.xyz") # Call via shortcut or name to remote VSP.
when "janet", "jane" then sys.Dial("12346789@SIP_PROVIDER") # Call via shortcut or name to SIP Provider.
# [FAMILY & FRIENDS]
when /^____/, "____" then sys.Dial("____@____")
when "____", "____" then sys.Dial("____@____")
# [WORK & CLIENTS]
when /^____/, "____" then sys.Dial("____@____")
when "____", "____" then sys.Dial("____@____")
# [OTHER RULES]
when /^____/, "____" then sys.Dial("____@____")
when "____", "____" then sys.Dial("____@____")
Code: Select all
# -----------------------------------------------------------------------------
# VSP ACCOUNT OVERRIDE PREFIXES # [BYPASS DEFAULT DIALING RULES]
# -----------------------------------------------------------------------------
# >> VSPs: SIPSorcery, SIP Broker, PTL_x MNF_x TLC_x STK_x, and VSPs supporting SIP URI.
# NOTE: I recommend "/^xx\*/" (xx*) over "/^\*xx/" (*xx) as supports more entries.
# NUMBER + ASTERISK OVERRIDES [Preferred to Avoid Logic Confusion or Hardware Conflicts]
when /^1\*/ then sys.Dial("${EXTEN:2}@____") # MNF Untimed/call
when /^2\*/ then sys.Dial("${EXTEN:2}@____") # MNF Timed Trunk xxxx
when /^3\*/ then sys.Dial("${EXTEN:2}@____") # MNF Mobile Calls 5.8c/min
when /^4\*/ then sys.Dial("${EXTEN:2}@____") # SIPTalk Untimed + Mobile 5c/min
when /^5\*/ then sys.Dial("${EXTEN:2}@____") # SIPTalk Timed + Mobile 8c/min
# when /^__\*/ then sys.Dial("${EXTEN:2}@____") # Trim 2 (TWO) characters from prefix.
# SIPBroker: International Access to 3rd Party VSP Free Calls
# * Int'l PSTN #'s: http://www.sipbroker.com/sipbroker/action/pstnNumbers
# * Supported VSPs: http://www.sipbroker.com/sipbroker/action/providerWhitePages
when /^9\*/, /^\*9/ then sys.Dial("*${EXTEN:2}@sipbroker.com[rm=a]") # *9663. or 9*663. to *663.@sipbroker.com
# SIPSorcery Internal Dialling
when /^0\*/, /^\*0/ then sys.Dial("${EXTEN:2}@local") # 0*... or *0... to ...@sipsorcery.com
when /^10\*/ then sys.Dial("${EXTEN:3}@____") # My Untimed/call Trunk
when /^11\*/ then sys.Dial("${EXTEN:3}@____") # My Timed/min Trunk
# when /^1__\*/ then sys.Dial("${EXTEN:3}@____") # Trim 3 (THREE) characters from prefix.
Code: Select all
# -----------------------------------------------------------------------------
# SPEED DIAL # [VSP & PUBLIC DIAGNOSTIC NUMBERS (MUSIC, ECHO TEST, CLID...)]
# -----------------------------------------------------------------------------
# >> SIPSorcery, SIP Broker, Any VSP SIP URI's.
when /^311/ then sys.Dial("music@iptel.org") # Normal - Media/Music
when /^312/ then sys.Dial("early_music@iptel.org") # Early Media - Media/Music
when /^313/ then sys.Dial("echo@iptel.org") # Echo Test
when /^314/ then sys.Dial("3246@iptel.org") # Echo Test
when /^315/ then sys.Dial("2233435945@sip2sip.info") # LENNY - 2 Way Audio Test ++ Annoy Marketing Calls!!!!
when /^316/ then sys.Dial("wbdemo@conf.zipdx.com") # Wide Band - Media/Music
when /^317/ then sys.Dial("6414539840@podlinez.net") # Parliment Question Time
when /^318/ then sys.Dial("904@mouselike.org") # 1. Echo, 2. VM, 3 Music, 4. Audio quality sweep test, 5. monitor line test.
when /^319/ then sys.Dial("4151595@services.sip.is") # 1. Echo, 2. Hold, 3. Rec + Listen, 4. Read CID. # NOTE: 340ms Latency
when /^320/ then sys.Dial("201@ideasip.com") # Welcome Message
when /^321/ then sys.Dial("301@ideasip.com") # Echo Test
when /^322/ then sys.Dial("411@ideasip.com") # Dial Free Call '411' Numbers & use '*' to connect, IVR AUDIO
when /^323/ then sys.Dial("8355@ideasip.com") # TellMe Information Service
when /^324/ then sys.Dial("8463@ideasip.com") # Time Service (Eastern Time, US)
when /^331/ then sys.Dial("0871271201@____") # Two-way Audio Echo Test.
when /^332/ then sys.Dial("0871271202@____") # Radio Paradise Music.
when /^333/ then sys.Dial("0871271203@____") # Announce CLI / CLID / CID.
when /^334/ then sys.Dial("0871271204@____") # Speaking Day/Date/Time.
when /^335/ then sys.Dial("0871271205@____") # Test DTMF Key Tones.
# when /^3__/ then sys.Dial("____")
=begin - + - - + - - + - - + - - + -
OFFLINE or BROKEN/FAULTY?
9901@qxip.net / 9902@qxip.net / 9999@qxip.net
pirateradio@qxip.net / 13108254321@ucla.edu
telephreak@voip.telephreak.org / info@intertex.se
17622600@projectmf.homelinux.com / lenny@sip.itslenny.com
"775@sip.pennytel.com" # Narrow Band - Media/Music
USA/CA Toll Free: when /^___/ then sys.Dial("____@tollfree.alcazarnetworks.com")
# USA/CA TOLLFREE e.g. 1800 123 1234
Hang Up Causes: when /^___/ then sys.Dial("hangup$____@conference.freeswitch.org")
# https://wiki.freeswitch.org/wiki/Hangup_Causes OR
# http://www.voip-info.org/wiki/view/Asterisk+variable+hangupcause
=end - + - - + - - + - - + - - + -
Code: Select all
# -----------------------------------------------------------------------------
# REGULAR DIALLING RULES [AUSTRALIAN NUMBER PATTERN EXAMPLES]
# -----------------------------------------------------------------------------
# FYI: ${EXTEN:2} = Remove All up to RHS of 2nd Character.
# FYI: EXTEN:X:X (Position, Replace) NOT AVAILABLE! :(
# Get Call URI, Removal 2 Chars and Add '.' ????
sys.Log("Call URI=" + req.URI.User.Substring(2) + ".")
when /^000/, /^106/, /^112/ then sys.Log("---- Trying ${EXTEN} '000, 106, 112' ----") # 000S0| 112S0| 106S0 Emergency Services & Hearing Impaired. NOTE: not all VSPs support emergency services!
sys.Dial("${EXTEN}@____",20) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '000, 106, 112' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '000, 106, 112' ----")
when /^0011/ then sys.Log("---- Trying ${EXTEN} '0011' ----") # 0011xxxxxxxx.S3| Create for specific country prefixes too!
sys.Dial("${EXTEN}@____",25) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '0011' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '0011' ----")
###...... CHECK AND COMPARE YOUR OVERSEAS RATES W/ ALL PROVIDERS ..........###
when "110", "114", "12[45]" "127x." "14x." "17x." then sys.Log("---- Trying ${EXTEN} '110, 114, 12[45]...' ----") # Patterns: 110 114 124/5 127. 14. 17.
sys.Dial("${EXTEN}@____",25)
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} 'PREMIUM SERVICES' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! 'PREMIUM SERVICES' ----")
###.................... NOT YET FINISHED! ................................ ###
###.... WIP! Work In Progress! 110 114 124/5 127. 14. 17. to be blocked ...###
when /^12[34]/, /^1234/, /^12455/, /^12456/, /^124937/ then sys.Log("---- Trying ${EXTEN} '12[34]xxx' ----")
rejectCall(603," ... NO PREMIUM NUMBERS! 12[34]x ...") # 12[34]! 1234!|12455!|12456!|124937!|
when /^122/, /^1223/, /^12245/ then sys.Log("---- Trying ${EXTEN} '122xx, 1223, 12245' ----") # 12x.S0|1223S0|12245S0|
sys.Dial("${EXTEN}@____",25) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '122xx, 1223, 12245' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '122xx, 1223, 12245' ----")
when /^10\d{5}/, /^99[0-9]99/ then sys.Dial("${EXTEN}@____") # SIPTALK 1012345, 99299 (Echo Test), 99599 (Balance), 99799 (Voicemail - BROKEN!!!)
when /^211/, "STK211", /^103____/ then sys.Dial("103____@____") # SIPTalk shortcut via 3 digits, alpha-numeric name, full extension number...
when /^212/, "STK212", /^104____/ then sys.Dial("104____@____") # SIPTalk shortcut (as above)
when /^213/, "STK213", /^105____/ then sys.Dial("105____@____") # SIPTalk shortcut (as above)
# LOCAL CALLS *** CORRECT AS OF 2016.11 ***
# UPDATE "/^[3-9]\d{7}/" BELOW W/ YOUR STATE'S RULE:
# NSW 02 = 02[3-9]xxxxxxx == /^02[3-9]\d{7}/ (Current Default)
# VIC/TAS 03 = 03[3-9]xxxxxxx == /^03[3-9]\d{7}/
# QLD 07 = 07[2-57]xxxxxxx == /^07[2-57]\d{7}/
# N.T. 08 = 08[258]xxxxxxx == /^08[258]\d{7}/
# S.A. 08 = 08[2578]xxxxxxx == /^08[2578]\d{7}/
# W.A. 08 = 08[2589]xxxxxxx == /^08[2589]\d{7}/
when /^[3-9]\d{7}/ then sys.Log("---- Trying ${EXTEN} '[3-9]d{7}' ----")
sys.Dial("${EXTEN}@____",25) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '[3-9]d{7}' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '[3-9]d{7}' ----")
# STD NATIONAL PHONE CALLS *** CORRECT AS OF 2016.11 ***
# OPTIONAL: Expanded for States: NSW/VIC/TAS 0[23][3-9]xxxxxxxS0 + QLD 0[7][2-57]xxxxxxxS0 + NT 0[8][258]xxxxxxxS0 + SA 0[8][2578]xxxxxxxS0 + WA 0[8][2589]xxxxxxxS0 (CORRECT AS OF 2016.11)
# when /^0[2378][2-9]\d{7}/, /^61[2378][2-9]\d{7}/, /^001161[2378][2-9]\d{7}/ then sys.Log("---- Trying ${EXTEN} '0[2378][2-9]d{7}' ----")
# OR #
when /^0[23][3-9]\d{7}/, /^07[2-57]\d{7}/, /^08[25789]\d{7}/, /^61[23][3-9]\d{7}/, /^617[2-57]\d{7}/, /^618[25789]\d{7}/, /^001161[23][3-9]\d{7}/, /^0011617[2-57]\d{7}/, /^0011618[25789]\d{7}/ then sys.Log("---- Trying ${EXTEN} '0[23][3-9]d{7}' '07[2-57]d{7}' '08[25789]d{7}' ----")
sys.Dial("${EXTEN}@____",25) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '0[23][3-9]d{7}' '07[2-57]d{7}' '08[25789]d{7}' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '0[23][3-9]d{7}' '07[2-57]d{7}' '08[25789]d{7}' ----")
when /^0[1569]\d{8}/, /^61[1569]\d{8}/, /^001161[1569]\d{8}/ then sys.Log("---- Trying ${EXTEN} '0[1569]d{8}' ----") # 0[1569]xxxxxxxxS0| e.g. 0198, 0550 services.
sys.Dial("${EXTEN}@____",25) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '0[1569]d{8}' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '0[1569]d{8}' ----")
when /^04\d{8}/, /^614\d{8}/, /^0011614\d{8}/ then sys.Log("---- Trying ${EXTEN} '04d{8}' ----") # 0[4]xxxxxxxxS0|
sys.Dial("${EXTEN}@____",25) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '04d{8}' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '04d{8}' ----")
when /^1[38]0[0-2]\d{6}/, /^611[38]0[0-2]\d{6}/, /^0011611[38]0[0-2]\d{6}/, /^1[38]z\d{3}/, /^611[38]z\d{3}/, /^0011611[38]z\d{3}/ then sys.Log("---- Trying ${EXTEN} '1[38]0[0-2]d{6}, 1[38]zd{3}' ----") # 1[38]00xxxxxxS0|1[38][1-9]xxxS0|
sys.Dial("${EXTEN}@____",25) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '1[38]0[0-2]d{6}, 1[38]zd{3}' ----")
sys.Dial("${EXTEN}@____",20) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '1[38]0[0-2]d{6}, 1[38]zd{3}' ----")
when /^1[9]0[0-26]/, /^611[9]0[0-26]/, /^0011611[9]0[0-26]/ then sys.Respond(403, "NO PREMIUM 1900!!!") # 1[9]0[0126]!
# ? then rejectCall(603,"Custom Message...")
when /^1[258]1/, "09xxxxxx." then sys.Log("---- Trying ${EXTEN} '1[258]1, 09xxxxxx.' ----") # 1[258]1S0|09xxxxxx.S0| ### UPDATED to "/^09\d{6}/ (MNF) /^09\d{12}/ (PTL) OR "09xxxxxx." for 8 and 14 digit MNF numbers! ###
sys.Dial("${EXTEN}@____",33) #
sys.Log("---- ${EXTEN}@____ ERROR! Trying ${EXTEN} '1[258]1, 09xxxxxx.' ----")
sys.Dial("${EXTEN}@____",33) # Backup if 1st fails.
sys.Log("---- ${EXTEN}@____ ERROR! '1[258]1, 09xxxxxx.' ----")
# when /^77[1578]/, /^888\d{7}/ then sys.Dial("${EXTEN}@____") # 77[1578]S0| 888xxxxxxxS0| ### UPDATED: PTL closed and sold out to MNF. ###
# when /^___/ then sys.Dial("${EXTEN}@____") #
Code: Select all
else
sys.Log("+ - - - + - - - + - - - + - - - + - - - + - - - + - - - +")
sys.Log("... No Rule Match! .. .. No Rule Match! .. .. No Rule Match! ...")
sys.Log("... Clean-up $EXTEN ... Retry $EXTEN w/o Rules ...")
num = req.URI.User.to_s # Return Dialled Number >> +61 (0)2 9988-1122 <<
# num.downcase # To Lowercase. NOTE: ".downcase" UNAVAILABLE ON SIPSORCERY!!!
# ERROR: Undefined method `downcase' for nil:NilClass.
num = num.slice(/[^:]+/) # Slice & Save Before ':'.
num = num.gsub(/[^0-9*#]/,'') # Strip ALL Text/Symbols (Except: 0-9, # (hash/pound), * (star))
sys.Log("+ - - - + - - - + - - - + - - - + - - - + - - - + - - - +")
sys.Log("PRIMARY VSP ROUTE [STD: 7.7c/call, MOB: 6.6c/min] Cheapest!")
sys.Dial("#{num}@____", 20)
sys.Log("+ - - - + - - - + - - - + - - - + - - - + - - - + - - - +")
sys.Log("SECONDARY VSP ROUTE [STD: 1.6c/min, MOB: 10.5c/min]")
sys.Dial("#{num}@____", 20)
sys.Log("+ - - - + - - - + - - - + - - - + - - - + - - - + - - - +")
sys.Log("TERTIARY VSP ROUTE [STD: 10c/call, MOB: 12c/min] Expensive!")
sys.Dial("#{num}@____", 20)
sys.Log("+ - - - + - - - + - - - + - - - + - - - + - - - + - - - +")
sys.Respond(404, "#--- Oops! No Destination Found, Destination Timed-Out, or No Dial Plan Matched URI/EXTEN: #{req.Header.To} / #{req.URI.User.to_s}! ---#")
end
DOWNLOAD OUTBOUND DIAL PLAN & UPDATES Australian Outbound Dial Plan v2 - **UPDATED 2016.10.03**
(3.99 KiB) Downloaded 29 times Australian Outbound Dial Plan v2 - **UPDATED 2016.10.01**
(3.82 KiB) Downloaded 46 times
_______________________________________________________________________________
FULLY DEFINITIVE* EXPLANATION OF INBOUND & OUTBOUND "SYS.DIAL" OPTION 'THINGS'! *almost.
- [cd=#,] Maximum 'Call Duration' for answered call(s) before disconnect (in seconds);
[dt=#,] Specific 'Delay Time' to wait before initiating call leg(s) (in seconds);- e.g. sys.Dial("${EXTEN}@Called_Last_-_Delayed[dt=10]&${EXTEN}@Called_First_+_No_Delay")
- - e.g. "[fd=9876543210]" to set '9876543210' to set CLID, as display name/number in Header;
- - e.g. "[fu=example]" to set 'example', or "[fu=#{@cid}]" to set CLID, as URI User Name in Header;
- - e.g. "[fh=host-name]"set 'hostname' as URI Host Name in Header;
- 'true' [default];
- 'false';
- _: 'blank', no redrect option specified, creates new anonymous forward based on 'redirect URI' [default];
- a: Accept 'Any'/'All' redirect response(s) and add to active call (Warning! Exercise caution!);
- m: Redirect 'Manually' - permit the dial plan to decide the action;
- n: Process redirect in 'New Instance' of the same dial plan [default];
- c: Accept new 'Call' REFER requests (Warning! Exercise caution!);
- n: Do NOT permit redirection or transfer request;
- p: Permit 'Pass-Through' transfers and REFER requests [default];
Code: Select all
sys.Dial("${EXTEN}@Provider_X[cd=600,rm=n]")
- Dial via SIP Provider X.
- Terminate call after ~600 secs (10mins).
- Process redirect in a new instance of the dial plan.
Code: Select all
sys.Dial("${EXTEN}@Provider_Z[dt=5,fd=0987654321]")
- Dial via SIP Provider Z.
- Delay ~3-5 secs before dialling.
- Override the display dame/number in the header (fd=, fu=).
Code: Select all
sys.Dial("${EXTEN}@Provider_1 & ${EXTEN}@Provider_2[dt=5] | ${EXTEN}@Provider_3")
- Dial via "Provider_1".
- Then after an approx. ~3-5 secs delay, dial via "Provider_2".
- When both call legs have failed (i.e. no answer, engaged/busy, or timeout), a new call is initiated to '56789' via "Provider_3".
- NOTE: If either of the 2 forwarded calls are answered, all other active (or pending) forwarded calls are cancelled, and the dial plan is terminated.
Code: Select all
sys.Dial("${EXTEN}@Provider_3[rm=a,cd=3600] & ${EXTEN}@Provider_2[dt=5,rm=a,cd=600]")
- Dial via Provider_3, redirect and add new call leg to current call.
- Maximum call duration of 3600sec (60min or 1hr).
- Dial after a delay of ~3-5sec, redirect and add new call leg to current call.
- Maximum call duration of 600sec (10min).
Code: Select all
sys.Dial("${EXTEN}@Provider_1[dt=5] & ${EXTEN}@Provider_2[dt=10] & ${EXTEN}@Provider_3 & ${EXTEN}@Provider_4 & ${EXTEN}@Provider_5[dt=5] & ${EXTEN}@Provider_6[dt=5]")
- Either as an inbound or outbound rule, a call is made and starts the dial plan processing.
- The first call legs initiated and dialled are: ${EXTEN}@Provider_3 AND Provider_4.
- After an approx. ~3-5sec delay ${EXTEN}@Provider_1[dt=5], Provider_5[dt=5] AND Provider_6 call legs are dialled - now 5 SIP providers are being used to ring the number.
- After a total ~7-10sec delay ${EXTEN}@Provider_2 call leg is dialled - now 6 SIP providers are being used to dial the number.
- If all call legs fail, then the dial plan will continue to either the next matching rule or command, else fail and exit.
NOTE: "[dt=x]" is added as a suffix to each call leg it applies to and only applies to that call leg only. Call legs (separated by "&" (and)) are executed in parallel and not sequentially.
Code: Select all
sys.Dial("${EXTEN}@Provider_1[dt=5] & ${EXTEN}@Provider_2[dt=10] & ${EXTEN}@Provider_3 | ${EXTEN}@Provider_4 & ${EXTEN}@Provider_5[dt=5] & ${EXTEN}@Provider_6[dt=5]")
- After an approx. ~3-5sec delay ${EXTEN}@Provider_1[dt=5], Provider_5[dt=5] AND Provider_6 call legs are dialled - now 5 SIP providers are being used to ring the number.
- After a total ~7-10sec delay ${EXTEN}@Provider_2 call leg is dialled - now 6 SIP providers are being used to dial the number.
- If all call legs fail (Providers 1, 2 + 3) then the dial plan advances past the "|" (or) and initiates the ${EXTEN}@Provider_4 call leg. Similar to prior example, Provider_5 and Provider_6 are initiated after ~3-5secs, however both are initiated at the SAME time.
- If all call legs fail (again), then the dial plan will continue to either the next matching rule or command, else fail and exit.
NOTE: "[dt=x]" is added as a suffix to each call leg it applies to and only applies to that call leg and not sucessive processing on the same line (separated by "&").