[Solved] Outbound routes problem

Hello there,

I am a first time poster, but have been long learning from these fora. I have a problem with my outbound routes.

I have two providers, one of which I want to use for calls to Brazil (Provider Brazil) and the other for all other calls (Provider Other). I have working trunks for both providers. I also have two outbound routes, which seems to be where the problem is.

Route 0 -to call Brazil- has a dial pattern of 0055. or 55 (55 being the international code for Brazil). Trunk sequence is 0 Provider Brazil.The trunk for Brazil has a dial pattern of 0055|XXXXXXXXXX or 55|XXXXXXXXXX.

Route 1 has a dial pattern of [1-46-9]. (everything not starting by 5, since I call no other country with a country code starting by 5). Trunk sequence is 0 Provider Other. The trunk for everything else has a dial pattern of 00|*.

The problem is the following: if I leave both trunks enabled, all calls, irrespective of destination, go to the trunk for everything else (Provider Other), even the ones starting by 55 or 0055. If I disable the everything trunk, calls to Brazil work correctly (but then I have no provider for other calls). What is wrong with my dialplan logic? I do not understand why enabling the Provider Other trunk makes calls with Provider Brazil not work, when calls to Brazil should be processed first by outbound route 0.

Any ideas greatly appreciated. This is driving me crazy!

Many thanks,

Daniel

The order of your outbound routes makes a difference. The Brazil route needs to be first and the trunk for that match should only include your Brazil trunk. Then you would list your route for everything else. The rule of thumb for FreePBX outbound routes is the most specific routes first going to your more general.

If this server is in the US, you might want to put this in the Brazil route.

01155|xxxx.

The normal outbound international prefix here is 011.

If this doesn’t help, post both of these outbound routes for us to look at.

Thanks for your response. Route 0 only has the Brazil TRunk. Rule 1 has the general trunk and a second and third possibilities.

Looking further, I believe the problem may be here:

extension.conf

exten => _XXXX.,1,Dial(SIP/terrasip/${EXTEN})

[Terrasip is my general provider. There is no mention of hte Brazil Provider. No other mentions. Terrasip is mentioned again in extensions_custom.conf]

extensions_custom.conf

; This file contains example extensions_custom.conf entries.
; extensions_custom.conf should be used to include customizations
; to AMP’s Asterisk dialplan.

; Extensions in AMP have access to the ‘from-internal’ context.
; The context ‘from-internal-custom’ is included in ‘from-internal’ by default

[from-internal-custom]
exten => 3366,1,Dial(SIP/[email protected])

exten => 1234,1,Playback(demo-congrats) ; extensions can dial 1234
exten => 1234,2,Hangup()
exten => h,1,Hangup()
include => custom-recordme ; extensions can also dial 5678
exten => _88.,1,SayDigits(${EXTEN:2},) ; extensions dialed with 88 prefix get looked up in AsteriDex
exten => _88.,2,EAGI(asteridex.agi|${EXTEN})
exten => _88.,3,GotoIf($["${DIAL:0:2}" = “88”]?97)
exten => _88.,4,NoOp(Number to Dial: ${DIAL})
exten => _88.,5,NoOp(Person to Dial: ${DUDE})
exten => _88.,6,Flite(“Connecting to: ${DUDE}. One moment please.”)
exten => _88.,7,Goto(outbound-allroutes,${DIAL},1)
exten => _00.,8,Hangup()
exten => _00.,97,Playback(num-not-in-db)
exten => _00.,98,Playback(goodbye)
exten => _00.,99,Hangup()

; custom-count2four,s,1 can be used as a custom target for
; a Digital Receptionist menu or a Ring Group
[custom-count2four]
exten => s,1,SayDigits(1234)
exten => s,2,Hangup

; custom-recordme,5678,1 can be used as a custom target for
; a Digital Receptionist menu or a Ring Group
[custom-recordme]
exten => 5678,1,Wait(2)
exten => 5678,2,Record(/tmp/asterisk-recording:gsm)
exten => 5678,3,Wait(2)
exten => 5678,4,Playback(/tmp/asterisk-recording)
exten => 5678,5,Wait(2)
exten => 5678,6,Hangup

; terrasip

exten => _XXXX.,1,Dial(SIP/terrasip/${EXTEN})

[custom-callboth]
exten => _1NXXNXXXXXX,1,Wait(1)
exten => _1NXXNXXXXXX,2,Background(pls-wait-connect-call)
exten => _1NXXNXXXXXX,3,Macro(dialout-trunk,2,${EXTEN},)
exten => _1NXXNXXXXXX,4,Macro(dialout-trunk,3,${EXTEN},)
exten => _1NXXNXXXXXX,5,Macro(outisbusy) ; No available circuits
exten => _NXXNXXXXXX,1,Wait(1)
exten => _NXXNXXXXXX,2,Background(pls-wait-connect-call)
exten => _NXXNXXXXXX,3,Macro(dialout-trunk,2,${EXTEN},)
exten => _NXXNXXXXXX,4,Macro(dialout-trunk,3,${EXTEN},)
exten => _NXXNXXXXXX,5,Macro(outisbusy) ; No available circuits

Does this help? What changes should I make?

Many thanks

You may need to remove this line in extensions.conf

exten => _XXXX.,1,Dial(Sip/terrasip/${EXTEN})

FreePBX puts its stuff in extensions_additional.conf. This entry in extensions.conf would override your dial plan for any dial with 5 digits or more.

Let me know if that resolves it.

something is clearly wrong…

the line
exten => _XXXX.,1,Dial(SIP/terrasip/${EXTEN})
should not and does not exist on the extensions.conf file. So who put it there and why. Extensions.conf is owned by FreePBX. It happens to be a static file for the particular version you are running at that time and only get’s changed/replaced when you update versions (major or minor)…

To see what files are owned by FreePBX see http://freepbx.org/configuration_files

And by the same logic, I guess that

exten => _XXXX.,1,Dial(SIP/terrasip/${EXTEN})

Should also not be there in extensions_custom.conf or it will again override my dialplan, right?

Thanks again.

Daniel

That is correct as it does override the dialplan if it is called at the wrong time, which based on what you are seeing happen is the case. But so that you know extensions_custom.conf is the proper place to put changes you make that you don’t want overridden by FreePBX…

Your solutions worked great. What a great community this is. Many thanks!