Two trunks with different DID

I have a freepbx with two trunks, I want some extensions to go out through one trunk and others through another, for this I have created a custom context to apply it to the extensions that I want to go out through the second trunk that I have for only some. But it doesn’t work, I don’t know what parts I have to allow and what parts I have to leave in allow, can you give me a hint or a config example in freepbx gui?

Get rid of the custom context. Add a new Outbound Route that uses the alternate trunk, ahead of the regular routes (but after emergency routes if appropriate), with the CallerID field matching the extensions that should use that trunk.

1 Like

I have been trying but it doesn’t work for me, they keep coming out through the first trunk, can you give me more details on how to create this route in freepbx?

For the route that’s not working, post screenshots of the Route Settings and Dial Patterns tabs.

If both of your trunks are coming from the same server and being delivered to the same server, this can be challenging. Recent improvements in trunk handling have made this better than it used to be, but Multi-tenant operations with FreePBX are still a huge PITA.

For inbound, your ITSP will send the traffic to your PBX and whichever trunk is “first” will be used to process the call. There are ways using usernames and trunk types to make that work better, but Asterisk doesn’t care. After that, the DID is used to process the call into an Incoming Route which processes the call forward to the final destination.

For outbound, a similar set of processes is used. Even if you specify which trunk you want to use in the Outbound Route, Asterisk may still choose “the first” matching trunk to send your traffic out. This was a huge limitation with Chan-SIP (where you didn’t get a vote) but even now, how the remote end processes your call may make it impossible to split this traffic.

Hints to try to make this work:

  1. Specify one trunk for the outbound routes you want to use. If this is a one-for-one setup, you’ll have one (and only one) trunk set up per outbound route.
  2. In the Outbound Route Dial Rules screen, the 4th field is the “extension” screen, which is used to limit certain outbound routes to specific certain extensions.
  3. If you are using the same provider IP address for both trunks, you may need to add Dial Manipulations so that one of the trunks can only be access through a prefix, which can be added in the outbound route. In the Trunk definition, you’ll use “the opposite” rules to remove the prefix and set the number up for your provider.

The two trunks has two diferent DID, I have extensions numbered as 10 - 19 I want extensions 14-19 go out by the second trunk and 10-13 by the first one.

The route you posted does not make sense. If the number dialed matches the combination of prefix and match pattern, prefix is removed, prepend is added at the front and the result is passed to the trunk.

If you have a working default route, make the Marce route look the same, except that it has
in the CallerID field of each entry, and it uses the second trunk. Put this route ahead of the default route. On calls from 10 to 13, it won’t match and the default route will be tried. That will match so the call will go out the first trunk.

If you still have trouble, post new screenshots.

1 Like

@sarenos2001 The best practice is to use custom contexts, now see carefully that when creating a context, there are some settings that are highlighted in red, in which requires attention and impediment to enable to deny those who need it. whenever I need, I use contexts like this, I have no problems.

Sorry but I was out, I have tried it and doesn´t work, I have put ahead outbound route Marce

Then I have put de 1[4-9] in callerID

and extensions from 14 continues going out by salientes por defecto

I have applied custom context but it doesnt works,

I want to extesions who has custom context go out by salientes marce, but it continues going by the other, do you know what is wrong? regards

Now it’s working, this way is very simple and is working, thanks a lot

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.