[quote=“spoonz”]How does this integrate with “least cost routing”?
How would you set this if you didnt want the user to enter a prefix? [/quote]
I’ve got accounts with 3 ITSPs in Europe and 3 in Australia. This is how i deal with routing according to the number called - it’s not really complete, but it works for the numbers i call at the moment and i’ll modify it as i need to.
Extract from extensions.conf:
; ***** OUTSIDE LINES *****
[dialout]
; we’ll put the dialout capable extensions into a separate context, only
; available from internal phones
; ******
; ****** call routing according to destination ******
; ******
include => atp-local ; numbers local to atp’s POPs
include => aus-regional ; all numbers that don’t match above
; UK
exten => _+44.,1,Dial(SIP/0${EXTEN:3}@sipgate-020)
; Luxembourg
exten => _+352.,1,Dial(IAX2/xxxxxxx:@voipgate/${EXTEN:1})
; Spain
exten => _+34.,1,Dial(IAX2/xxxxxxx:@voipgate/${EXTEN:1})
; Ireland
exten => _+353.,1,Dial(IAX2/xxxxxxx:@voipgate/${EXTEN:1})
; France
exten => _+33.,1,Dial(IAX2/xxxxxxx:@voipgate/${EXTEN:1})
; *** call routing via specific service provider ***
; ATP
exten => _151.,1,Dial(IAX2/xxxx:@ATP/${EXTEN:3})
exten => _151.,2,Hangup
; FRESHTEL
exten => _152.,1,Dial(IAX2/xxxxxxxxx@freshtel/${EXTEN:3})
exten => _152.,2,Hangup
; VOIPGATE
exten => _153.,1,Dial(IAX2/xxxxxxx:@voipgate/${EXTEN:3})
exten => _153.,2,Hangup
; GOSSIPTEL
exten => _154.,1,Answer
exten => _154.,2,Ringing
exten => _154.,3,Dial(SIP/${EXTEN:3}@gossiptel,)
exten => _154.,4,Hangup
; SIPGATE 020
exten => _155.,1,Dial(SIP/${EXTEN:3}@sipgate-020)
exten => _155.,2,Hangup
; SIPGATE 01621
exten => _156.,1,Dial(SIP/${EXTEN:3}@sipgate-01621)
exten => _156.,2,Hangup
; OZTELL
exten => _157.,1,Dial(SIP/${EXTEN:3}@oztel)
exten => _157.,2,Hangup
[atp-local]
; numbers that are local calls from ATP
; sydney
exten => _02[89].,1,Dial(IAX2/xxxx:@ATP/${EXTEN})
exten => _+612[89].,1,Dial(IAX2/xxxx:@ATP/0${EXTEN:3})
; melbourne
exten => _03[89].,1,Dial(IAX2/xxxx:@ATP/${EXTEN})
exten => _+613[89].,1,Dial(IAX2/xxxx:@ATP/0${EXTEN:3})
; brisbane
exten => _073.,1,Dial(IAX2/xxxx:@ATP/${EXTEN})
exten => _+617.,1,Dial(IAX2/xxxx:@ATP/0${EXTEN:3})
; adelaide
exten => _089[234].,1,Dial(IAX2/xxxx:@ATP/${EXTEN})
exten => _+6189[234].,1,Dial(IAX2/xxxx:@ATP/0${EXTEN:3})
; perth
exten => _08[78].,1,Dial(IAX2/xxxx:@ATP/${EXTEN})
exten => _+618[78].,1,Dial(IAX2/xxxx:@ATP/0${EXTEN:3})
[aus-regional]
; what to do with numbers that don’t come into the ATP local number ranges
; - call via freshtel
exten => _0.,1,Dial(IAX2/xxxxxxxx@freshtel/${EXTEN})
exten => _+61.,1,Dial(IAX2/xxxxxxxx@freshtel/0${EXTEN:3})
Notes:
Calls to Australian capital cities are cheaper via ATP, but calls to regional phone numbers are cheaper via Freshtel
I use the (GSM) mobile phone style “+44…” notation for international numbers. I don’t use them for Aus numbers, but i included them in case i work out a way to synchronise the phonebook in my softphone with the phonebook in my mobile!
The “include” statements bring in the contexts that they refer to at the point in the flow where the statement is - so the australian contexts are checked for matches before the rest.
Voipgate uses the bare country code prefix format - e.g. 442071234567, but Sipgate uses the British style dialling format - e.g., 02071234567. If i was dialling an international call via Sipgate, i suppose i’d have to enter something like +44034612345678 - which doesn’t make much sense! Alternatively, i could enter 1560034612345678 - which is one more digit, but makes more sense!
I don’t (yet) do automatic routing via Oztell - as i’ve only recently opened the account with them. They may replace some (or all) of the rest - or they may not - depending on how their service shapes up.