Connecting PBX systems to FreePBX / DID Manipulation Help

So I am trying to use FreePBX to solve an issue we are having with our voice deployment. We were having registration and other issues with our new carrier and instead of getting a proper Session Border Controller we went with using FreePBX to see it if can solve the problems. So far it has solved all the issue we were running into but it’s also brought up some new issues. I believe I know the answer but I’m just not sure what syntax or structures to use to get there.

Here’s what I have so far, please note the 10 digit DID is the extension number.

  • FreePBX system that PEERS back to our Origination/Termination trunks to the carrier.
  • Created extensions 1234567890 and 1234567891
  • Connected PBX01 to extension 1234567890 and PBX02 to 1234567891
  • Outbound calls work great from PBX01/02 --> FreePBX --> Outbound Trunk --> PSTN
  • Inbound calls work great from PSTN --> Inbound Trunk --> FreePBX -->PBX01/02
  • Internal (“Onnet”) calls work great PBX01 --> FreePBX --> PBX02 (vice versa)

Here’s where I am running into an issue. I added 1234567892 as just an Inbound DID and pointed it to PBX01 (1234567890) and when I make calls to 1234567892 (PSTN or local) the calls are still being sent and received by PBX01, however, the contact/to and the initial SIP INVITE from FreePBX to PBX01 is showing 1234567890@ instead of 1234567892. While the call hits PBX01 and there are no issues with the call, we cannot control the DID routing of 1234567892 since it never appears in the SIP message.

So I just need to figure out how to re-write the headers being sent from FreePBX to PBX01 (or any) to include the 1234567892 DID in the contact/to or SIP invite fields. Is there a way to do this?

Or is there a way to setup trunks on FreePBX that PBX01 and PBX02 can connect to directly without an extension in the way? I haven’t messed with Asterisk/FreePBX in years so I am way rusty on this.

Any help would be great. In a bit of a crunch.

I was actually able to figure this out.

I was able to create trunks for the PBXes to connect to. Had a bit of an issue with one trunk configuration because it was doing auth registration and apparently I need to name the trunk the same as the username.

But so far all calls are sending and receiving fine, I even have them listening over two different ports. All DIDs are routing in the PBXes as I would like.