Trunks and Inbound routes

Guys, i need some help

I have three different trunks, each trunk has one different number, and each number belongs to a different company.

Trunk1
Trunk2
Trunk3

I want to create three different inbound trunks. One inbound trunk for each company. The purpose is to have three different IVRs that will say the name of each company.

Trunk1 goes to IVR1
Trunk2 goes to IVR2
Trunk3 goes to IVR3

Is this possible ?

I have already tried changing the inbound ID, the inbound caller ID and in every possible combination.

Sonetel is my ITSP for each different account, thus each different trunk, thus each different number. I have set sonetel to send me as caller ID the number called.

Awaiting your answers/questions

Thank you in advance

What you are asking is beyond trivial, but be warned that FreePBX doesn’t really do multi-tenant very well. I have 25 incoming numbers to one of my PBXes and it works fine.

Having said that, It’s not that FreePBX can’t be used in a multi-tenant environment, but once you start down this path (especially if you have people connecting extensions to the system), the system does NOT scale well on the way up. Things like transfer codes, ring pickup, on-hold parking lots, etc. all start to get really, really messy.

Now, for the educational part:

If you have a single ITSP, there is NO good reason to use multiple trunks. In fact, if your provider is like all of mine, they will charge you more for each trunk.

Instead of doing that, have all three trunks consolidating and route your IVR traffic based on the DID (Direct Inbound Digits). That way, the caller ID can be passed to the customer through the IVR. It also simplifies your setup.

Set up your incoming routes based on DID and send each to your IVR. If you are having trouble m,atching inbound DIDs to your inbound routes, your /etc/asterisk/full log file will give you the information you need to resolve the issue.

I do not predict an extremely satisfying experience for you, especially if you are new to setting up Asterisk or FreePBX systems.

Thank you very much for your help.

I did as you said and it gives me this:

[2016-04-27 05:53:26] VERBOSE[2984][C-00000064] pbx.c: Spawn extension (from-internal, 00435465782945, 8) exited non-zero on ‘SIP/101-000000f0’
[2016-04-27 05:53:26] VERBOSE[2984][C-00000064] pbx.c: Executing [h@from-internal:1] Macro(“SIP/101-000000f0”, “hangupcall”) in new stack
[2016-04-27 05:53:26] VERBOSE[2984][C-00000064] pbx.c: Executing [s@macro-hangupcall:1] GotoIf(“SIP/101-000000f0”, “1?theend”) in new stack
[2016-04-27 05:53:26] VERBOSE[2984][C-00000064] pbx.c: Goto (macro-hangupcall,s,3)
[2016-04-27 05:53:26] VERBOSE[2985][C-00000064] bridge_channel.c: Channel SIP/pstn-000000f1 left ‘simple_bridge’ basic-bridge <3179vb2d-c237-4237-a376-b51e8a6358615>
[2016-04-27 05:53:26] VERBOSE[2984][C-00000064] pbx.c: Executing [s@macro-hangupcall:3] ExecIf(“SIP/101-000000f0”, “0?Set(CDR(recordingfile)=)”) in new stack
[2016-04-27 05:53:26] VERBOSE[2984][C-00000064] pbx.c: Executing [s@macro-hangupcall:4] Hangup(“SIP/101-000000f0”, “”) in new stack
[2016-04-27 05:53:26] VERBOSE[2984][C-00000064] app_macro.c: Spawn extension (macro-hangupcall, s, 4) exited non-zero on ‘SIP/101-000000f0’ in macro ‘hangupcall’
[2016-04-27 05:53:26] VERBOSE[2984][C-00000064] pbx.c: Spawn extension (from-internal, h, 1) exited non-zero on ‘SIP/101-000000f0’

In DID number I place the number correctly and i leave the CID empty. Then for security reasons it hangsup after the message that says: the number you have dialed is not in service please checkthe number you have dialed and try again.

Could you help me out a little bit more ?

Thank you in advance

I’m not sure I understand your question.

From the log, it looks like your system is hanging up just like you said you told it to.

I go to the inbound routes. I only have one inbound route.

The settings are:

DID Number ANY
CallerID Number ANY
CID Priority Route No
Alert Info : Empty
CID name prefix : EMpty
Music On Hold : Default
Set Destination : Queus: 13Incoming


If i change Caller ID to my cellphone and leave DID Number as is(with the ption ANY), and I call the pbx number from my cell, the change works fine.

But if I leave Caller ID with the option “any” , and change the DID number to my company number , it does not work.

How can I track down the error ?

if the three companies are yours, and there is no issues with users accessing extension from the other companies, then it is doable. If these are three separately owned companies that should have no access to the others’ stuff, then it’s a little more complicated.

Marc’s point is a good one, but doesn’t really address the issue you are having.

If you set the inbound route Caller ID to anything, the route will be used by calls coming in with that Caller ID. This is useful for things like a number that works exclusively for your manager from his cell phone or from someone’s house. This is an advanced feature (one that you definitely don’t need yet) and you shouldn’t be setting it to anything but ANY.

The DID number is the incoming number that gets dialed to reach your PBX, but it’s in the format that your ITSP is sending.

So, you tested with a DID of “ANY” and the IVR worked. That’s a successful test of your incoming call.

The next step is add a second route. Change the first “Incoming Route” so that the destination is a voice mail box or a funny message that hangs up. Next you need to look in the “/var/log/asterisk/full” log and see what DID your ITSP actually sent. Copy that and paste it into the DID number of the new Incoming Route.

Dial one of your numbers that isn’t in an Incoming Route - you should get the message. Dial your DID-enabled incoming route’s number and see what happens. You should get your 13 incoming IVR. Remember that the inbound route DID MUST MATCH the DID sent by your carrier, not what you think it should be.