Problems with intra-company trunk exposing internal CID on outbound call

Wondering if anyone can help me figure out where I’ve gone wrong. We have 3 offices which are all connected to each other via IAX2 trunks (A -> B, A -> C, B -> A, B -> C,… etc) I have enabled the “intra-company” flag on each of those trucks to allow internal CIDs to be exposed at each of the other offices.

Each location has their own set of extensions (A = 1XXX, B = 2XXX, C = 3XXX) and everything works great, except in the case when an intra-company calls is placed and ultimately gets forwarded out of the system… Maybe this will help explain what’s going on:

Caller A -> System A -> Intra-company IAX2 trunk -> System B -> Recipient B (Follow Me settings kick in, which forwards the call to an external number) -> Sip provider processes the call, but with the internal CID.

If I remove the “intra-company” flag internal CIDs do not get passed to our SIP provider but that also prevents each office from knowing who is calling who.

I have Outbound CIDs configured at the extension, outbound route and trunk level but all of them seem to get overridden when the intra-compnay flag is on.

Am I missing something? Is there a relatively easy fix to this problem?

I just tested this on my system and the default trunk CID (on System B) is sent, and not the internal CID. However, I didn’t do it using a follow-me, so that may make a difference.

On the outbound trunk level on System B, do you have a default CID set?

Does your follow me external number end with a pound symbol (i.e., #)

Okay, did a bit more testing. If I route my call from System A to System B using an “Intra-Company” outbound route and then send my call to a ring-group with an external phone number (ending in #), FreePBX passes the internal Caller ID.

However, if I dial that same ring group from a phone on System B, the default Trunk Caller ID gets passed instead.

The only right way to get this resolved is to open a ticket and ask the devs to address it. However, you may be able to overcome the issue by creating a special outbound route on System B that handles calls from internal caller IDs on your local system and forces the use of a specific caller ID.

So, if System A has extensions in the 600-699 range, and you want to force calls from them to use 2125551212 as the Caller ID on System B, then you’d set-up an Outbound Router on System B as follows:

Route Name: ForceExt600to699touse2125551212
Router CallerID: 2125551212
Override Extension: Checked

Dial Patterns:

( ) + | [./6XX]

Trunk Sequence: As desired…

Then give this new outbound route priority above your standard routes…

First, thanks for taking the time to confirm that I’m not the only one seeing this. I’m relatively inexperienced with FreePBX/Asterisk so it’s pretty much impossible for me to tell the difference between configuration issue and a possible bug.

As you’ve discovered, my follow-me’s are configured so that they include the original extension and usually the users home or cell phone ending with a trailing “#”.

I’ve actually tried the work around you suggested prior to posting here… I properly catch the outbound calls originating from external systems and I’ve specified a Route CID and the “Override Extension” option but it doesn’t seem to have any effect on the resulting CID sent to my SIP provider.

Would there be any other work arounds that might solve this issue?

Also, would this be a bug with how FreePBX configures things or an underlying issue with Asterisk (or the fact that I’m doing something that isn’t correct/a good idea)? Not sure who I would go about reporting this bug to.

A big caveat here: I’m not a coder. I’m just a user.

However, based upon what I can see, it looks like the problem MAY be the transition from IAX2 to SIP. If that’s the case, you may be able to fix the problem by using SIP trunks for interoffice connections. Just yesterday, I figured out how to get them to work without forwarding ports. You may want to try this:

Create a new SIP Trunk:

Outgoing Details:

Trunk Name: SystemB
PEER Details:

type=peer
trustrpid=yes
sendrpid=yes
secret=yourpassword
qualifyfreq=45
qualify=yes
insecure=port
host=dynamic
fromuser=SystemA
defaultuser=SystemA
dtmfmode=rfc2833
directmedia=no
context=from-internal

Registration String:

SystemA:[email protected]

Then do the reverse for the other system (i.s. change SystemA to SystemB and vice versa.)

I suspect that using this configuration will solve the problem.

I will give the Intra-company SIP trunk a try… I originally chose IAX2 trunks because I was trying to simplify the network/firewall stuff but I will revisit that when I get some free time.

Thanks for the help AdHominem.