Reserve extension to trunk(number) without custom context module

Hello! I have such a problem: I get 9 numbers from the provider, 1 number = 1 trunk. Newer versions of Freepbx do not support the Custom Contexts module. I need to reserve trunk number 1 (99312754301) for outgoing calls from extension 2711, so that only this (99312754301) number is displayed, and not any free of 9?

Because you don’t need a module to use custom contexts.

No you need to route calls from extension 2711 only through the trunk of your choice. That would be standard outbound routing setup.

if it does, you need to find a better provider.

OP is probably referring to the community supported “Custom Contexts” module as opposed to the concept of writing your own context. This is why historically, I refer to user content in extensions_custom.conf as user defined context.

Hello, @lgaetz!
Sorry, could you show an example of extensions_custom. conf please. Outgoing call from extension 2711 is always via trunk1(99312754301).
Thank you very much!

Hello, @sorvani!
It doesn’t work like this, i tried. Only with the custom contexts module everything works as it should.

@lgaetz @sorvani
I read that if my provider could give 9 numbers on one trunk, then everything would work without problems, that is, I could write an outgoing CID in the extension, and that’s it.

I can’t choose another provider because it’s only 1. :frowning:

You set up an Outbound Route for each extension that needs to use a specific trunk, with the extension number in the CallerID field and the desired trunk as the only one in the list.

Hello, @Stewart1!
It doesn’t work! The call comes from random numbers, but not from a reserved one.

Make sure that on the Dial Patterns tab, each pattern has 2711 in the CallerID field.
Make sure that in the list of routes, this route is above (ahead of) any routes that don’t have a number in the CallerID field.
Make sure that the Trunk Sequence for Matched Routes has only gts-1.

If you still have trouble, paste the Asterisk log for a failed call at and post the link here.

I only need to substitute a free line (number) to the extension, I used an old version of pbx in which the custom contexts module worked. This module is not supported in the new version of freepbx 15. And we need to solve this problem somehow.
Perhaps as @lgaetz said use extension_custom.conf. But I don’t understand how to use extension_custom.conf

Sorry, I don’t understand what you mean. I originally thought that you want calls from 2711 to use trunk gts~1 so it would send 99312754301, calls from 2712 would use trunk gts~2 and send 99312754302, and so on. I described how to do that.

If you want something different, please explain what should happen when a particular extension makes a call.

Also, let’s look at alternate providers. What country are you in? Who is your present provider? How much does it cost to call a domestic landline? A domestic mobile?

Yes, you understood me correctly. But the solution that you said does not work for me, the call comes from the other numbers, but not from gts~1. Thats why I used Custom Contexts before.

It will 100% work if you did as instructed

On an unrelated note: You setup up the trunks with chan_sip. You need to redo that all as pjsip unless you like making things even harder than they already are down the line.

No you did not even try previously.

So since you look like you did it this time. now provide a call log.

forget about 2711. Now i tested this with extension 8888 via trunk gts~6 just like @Stewart1 said.

Follow the linked instructions and provide a clear log.

The one you provided is not following a single call.

And take the log from /var/log/asterisk/full (not from the console).

Also, it would be useful to include a SIP trace, so we can see what is sent to gts~6. At the Asterisk command prompt, type
sip set debug on
before making the test call.

The domestic routes should come before the VoIP and GTS routes.

One problem is that the domestic routes have a pattern ‘X.’ which matches everything and will try to send international calls via the GTS route. Remove that pattern and retest.

However, I believe that there are other route patterns that may cause trouble. I’ll try to post the proper settings, but first tell me whether this is accurate:

Hello @Stewart1!
I have removed X. pettern from my trunks. But the result is the same. Yes, I’m from Turkmenistan.

Line 71:
[2021-08-22 13:02:16] VERBOSE[10635][C-0000001c] pbx.c: Executing [[email protected]:4] Set("SIP/2711-0000002b", "_ROUTENAME=GTS") in new stack

It selected the route “GTS”, I’m guessing because it came before OutboundRoute754303. All the caller-ID-specific routes need to be place above the generic ones.