Forcing Extensions to use specific trunk


I’d like to be able to specify an extension to use a particular trunk regardless of whether the dialstring matches other trunks dialstrings. I don’t think this can be done in the standard settings for FreePBX. Could someone please let me know how this can be achieved otherwise?
I’m using FreePBX

Many thanks!

John, this works VERY well!!

Custom contexts module can do it but it doesn’t always work with everything :slight_smile:
I’ve noticed that things like dialing feature codes for recordings don’t work/etc.
There is a module called outgroups that I’ve never used… anyone using that on 2.5??


You could also create a little code in extensions_custom.conf.

In FreePBX, put the extension in a special context, like from-fred. Then in extensions_custom.conf add something like this.


exten => _1XXXXXXXXXX,1,goto(from-internal,555${EXTEN},1)
exten => _XXXXXXXXXX,1,goto(from-internal,555${EXTEN},1)
include => from-internal

Now create an outbound route in FreePBX called something like “FredsRoute”. In the dial patterns for that route put:


Any 11 digit number starting with 1 or 10 digit number will match and be sent to FreePBX with the number 555 prepended to it. When it gets to FredsRoute, it will match, the 555 will be stripped off and the rest of the number sent to the trunk. The include => from-internal catches everything else dialed, so the extension will work as a normal from interal extension.