Routing a call for [email protected]


I have some non-geographic numbers that, if routed via SIP, are delivered free.

To test this I have set-up the routing for a number to be delivered to [email protected] which is delivered to the extension with sip_alias.

This is all working OK, but it does mean I can’t do any call filtering, e.g. on CLI, or routing to call groups, etc.

The number supplier does not support SIP trunks, so my question is, does anyone know if FreePBX can be configured for calls routed to [email protected] to actually be delivered to a destinations other than the sip_alias? If so how?



Sure just setup a trunk for that user


Can you point me at an example set-up for that please?


D9025 UK

Well that depends. Do all calls come from one IP?

At it’s basic this should work…

[email protected]

That should work in the peer settings.

You can of course tune the CODEC etc. They may be using other fields to put the domain data so it is important to review all the variables available for a trunk.

The idea is to build a trunk with the least number of parameters that you need to uniquely identify the peer.

Here is a link to the sip variables:

The firewall restricts the inbound SIP traffic to this provider and I’ve made the SIP alias unique to this number.

I somewhat expected that the trunk definition needed peer details set as well. Otherwise I expected asrerisk to report an error.

Having had a quick check of the SIP config parameters, how do you tie the SIP alias to the trunk?

Will try a config a.s.a.p.

Thanks for the advice.


I’m not completely clear on what you’re asking, but if you want FreePBX to be able to route inbound calls to a SIP ALIAS, you just need to create a trunk to accept inbound calls or allow anonymous inbound SIP calls, and then you can configure a SIP Alias in the extension settings.

If you want to place an outbound call to SIP ALIAS, you set up a custom trunk with the dial string

SIP/[email protected]

Also, if your SIP ALIAS is a DID (or any numerical string), then you can route calls using the inbound routes module.

i.e., if the calls come in to:

[email protected]

Then, you can set-up an inbound route for 2125551212 and the calls will be routed using that inbound route.

To ensure that your system will accept those calls, you either need to allow anonymous inbound calls in the general settings, or set-up a basic trunk that will tell FreePBX to accept the calls:



There’s clearly something I’m not getting here. And I’ve probably not described things as well as possible.

The provided number is a non-geographic number which would usually be delivered to a real destination number, e.g.

0800 123 4567 ----> 01 717 123 4567

But I can have this routed to a SIP address, e.g.

0800 123 4567 ----> [email protected]

Where sip_alias is the alias specified for an extension in FreePBX (and is the only place I’ve found sip_alias is able to be set) and “Allow Anonymous Inbound SIP Calls” is set to yes. The rest of is one of my domains which points to the PBX. So there are no third parties involved with the [email protected] address.

This is all working.

But because the calls (inbound only as the number supplier does not support outbound calls in this case) are delivered directly to the extension (of sip_alias) FreePBX can’t route the call based on CLI or deliver to a ring group.

From previous experience I would expect this to have been possible by setting up a SIP trunk, but I’ve not defined a trunk where I owned [email protected] rather than a third party.

As I would like to be able to have more control of the call I asked my original question.

Thanks for your response.


If your sip_alias is a number, any number, you can place that number into an inbound route and inbound calls will be delivered to the destination specified in that route.

You need to build a trunk, as I indicated. If the carrier requires authentication then of course you need to put the parameters in the trunk.

I believe the fromuser variable in the trunk is what you are looking for.

Well you need to drop a dime cuz you are not quite there yet!

The trunk is required so you can turn off anonymous inbound.

OK - while I’m sure there are a number of solutions to this, while looking at the call logs as calls were being presented I finally had the penny dropping moment.

Given I could see “DID=sip_alias” I changed the config so that the number delivery is presented as:

0800 123 4567 ----> [email protected]

Then defined an inbound route with 08001234567 as the DID Number.

All makes sense and easy when you know how.

Thanks for persevering with me.


I’ll take that as a to do.

While anonymous SIP is allowed at the PBX its not allowed at the firewall. So the only SIP traffic allowed in from the WAN is from designated sources.

Given the amount of SIP traffic I see rejected by the firewall, I’m not likely to change this.

However, I think it will be good to turn off anonymous inbound, so I will look at this sometime.

Thanks again.


OK. I now have the trunks defined and “Allow Anonymous Inbound SIP Calls” disabled.

As there are multiple source IP’s I defined a trunk for each.

For anyone else out there who might find it useful. To create the trunk the only parameters I set were:

[General Settings]

Trunk Name
Outbound CallerID

[Outgoing Settings]

Trunk Name

PEER Details{

All other fields being either default value or null.


Great job, I should have added that the real reason for doing this is so the trunk name is properly displayed in call traces and CDR’s. Also allows you to route calls to a custom context. Something you can’t do if you don’t have a working trunk.

Spotted the trunk names in the call trace.

Also changed the SIP address to [email protected] to remove the need for a DNS lookup. I did this as some of the inbound calls take a long time to arrive. Though it does not look like DNS was the culprit.