Assign outbound route to extension

FreePBX 16.0.40
I want to make extension X only use outbound route X and extension Y only use outbound route Y. How can I do it?

1 Like

Ciao,
you have to use the “Class of Service” module

You can set a caller id in the dial patterns. So the outbound route is only used if the caller id in the dial pattern matches X or Y.

Extension routing module

Thank you for the suggestion. The online help of the caller id in the dial pattern says:

“If CallerID is supplied, the dialed number will only match the prefix + match pattern if the CallerID being transmitted matches this. When extensions make outbound calls, the CallerID will be their extension number and NOT their Outbound CID. The above special matching sequences can be used for CallerID matching similar to other number matches.”

Suppose that I want to use the extensions both for outbound calls and for forwarding to PSTN the incoming calls received on a DID number. In the first case the caller id is the extension number, in the second case it is the calling number, which is impredictable. So, in order to make the setting complete, how should be the configuration? How can get sure that the DID number calls received by extension X are forwarded to PSTN only using the route X?

How do you enabling call forwarding on extension X? If you enable the call forwarding in Asterisk this should work.

Adding the PSTN number followed by # in the follow-me section

I have done some tests and it is confirmed what I guessed: if the extensions is used both for outbound calls and for forwarding to PSTN the calls to a DID number, there are two cases

  1. Caller id set equal to the extension number in the dial patterns of the outbound route ==> the outbound calls work (the right outbound trunk is chosen), but if I call the DID linked to the extension, the PSTN number in the follow-me list is not called, because the caller id in the dial pattern is not matched

  2. Caller id is left empty in the dial patterns of the outbound route ==> outbound calls work well and DID calls are forwarded to the PSTN number in the follow-me list. This would be fine, but the problem is that doing so, any extension existing in my freepbx installation can call any PSTN number using the same outbound route

So if it is not possible to do what I am asking, I reformulate my initial question: is it possible to restrict the usage of an outbound trunk (with access to PSTN) only to some extensions, both for PSTN call forwarding and for outbound calls, and block the access to the PSTN to all other extensions?

I cannot believe that such a basic feature is possible only buying licenses using paid modules.

I am not so sure I could categorize this feature as “basic”, but I am curious as to whatever workaround may be available.

in the ‘unsupported’ repo is ‘custom-contexts’ which can do that but not easily.

Can you please give some more details? This is set with the Freebox GUI or editing some conf files?

Possibly it’s the problem that I didn’t specify the requirement that I have in mind, so I will change the question in this way.

In freepbx actually there are currently 2 cases:

  1. I don’t create any setting to allow access to PSTN ==> no extension will have access to PSTN.

  2. I create the settings in freepbx to make outbound calls and do PSTN forwarding ==> any extension that I will create will have access to the PSTN and will spend the money that I charged in the provider giving access to the outbound trunk. This means that I can use the freepbx only for my family or some dear friend.

IMHO it is show-stopper restriction and it is a basic feature, to solve this. Or possibly I misunderstood the philosophy of Freepbx

This sounds like you want the commercial, Class of Service module, although the documentation isn’t clear with regard to how it handles transfers.

I solved It, even though with not so elegant solution. I wrote a predial hook to hang up the call if it Is trying to dial out and the extension number is not in the allowed range.
For example, only extensions between 10000 and 11000 are allowed

This is fairly simple and does not require any custom dial plan. Oubound routes are evaluated in order; the first one that matches is used. So, you should put your emergency routes first, so that any extension can reach emergency services.

One approach is to put a ‘dummy’ route after the emergency routes, which matches only the restricted extensions. All your normal routes are placed after that. For example, if your disallowed extensions are from 11000 through 19999, you might use:
prepend: (leave blank)
prefix: (leave blank)
match pattern: X.
CallerID: 1[1-9]XXX
Trunk Sequence: (none)

Another way is for your normal routes to match external caller IDs. For example, you would include
prepend: (same as your regular outbound route)
prefix: (same as your regular outbound route)
match pattern: (same as your regular outbound route)
CallerID: XXXXXX.
which will match any caller ID with 6 or more digits.

There are lots of other ways to skin this cat.

1 Like

It is in fact possible that you misunderstand the philosophy of FreePBX. FreePBX was not designed to give away every possible option in the system but to create a system that would work for the majority of use cases. Though extension control may be relatively basic, a standard free use case is one single line in and out and in this case it allows multiple lines out but to have control of who uses them as a sub service. The Extension Routing Module is not that expensive (compared to a commercial PBX version) and the sub is for 25 years… not month to month. Just saying… it is a really robust system, for basically free unless you are using it in a commercial mode as a private entity.

1 Like

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