Connecting two FreePBX boxes with a SIP Trunk

Hello

I have Server A and Server B. I want to configure a SIP trunk between the two servers so that all outbound calls on Server A route through Server B which is connected to my carrier.

I’ve got a SIP trunk registered between them both, but when I attempt a call, it never hits Server B. Server A provides the following output:

– Executing [s@macro-dialout-trunk-predial-hook:1] SIPAddHeader(“SIP/652-00001aec”, “P-Asserted-Identity:sip:[email protected]”) in new stack
– Executing [s@macro-dialout-trunk-predial-hook:2] MacroExit(“SIP/652-00001aec”, “”) in new stack
– Executing [s@macro-dialout-trunk:18] GotoIf(“SIP/652-00001aec”, “0?bypass,1”) in new stack
– Executing [s@macro-dialout-trunk:19] ExecIf(“SIP/652-00001aec”, “1?Set(CONNECTEDLINE(num,i)=2146749682)”) in new stack
– Executing [s@macro-dialout-trunk:20] ExecIf(“SIP/652-00001aec”, “1?Set(CONNECTEDLINE(name,i)=CID:4698503805)”) in new stack
– Executing [s@macro-dialout-trunk:21] GotoIf(“SIP/652-00001aec”, “0?customtrunk”) in new stack
– Executing [s@macro-dialout-trunk:22] Dial(“SIP/652-00001aec”, “SIP/Call-Router-A/2146749682,300,Tt”) in new stack
– Executing [s@macro-dialout-trunk:23] NoOp(“SIP/652-00001aec”, “Dial failed for some reason with DIALSTATUS = CONGESTION and HANGUPCAUSE = 21”) in new stack
– Executing [s@macro-dialout-trunk:24] GotoIf(“SIP/652-00001aec”, “0?continue,1:s-CONGESTION,1”) in new stack
– Executing [s-CONGESTION@macro-dialout-trunk:1] Set(“SIP/652-00001aec”, “RC=21”) in new stack
– Executing [s-CONGESTION@macro-dialout-trunk:2] Goto(“SIP/652-00001aec”, “21,1”) in new stack
– Executing [21@macro-dialout-trunk:1] Goto(“SIP/652-00001aec”, “continue,1”) in new stack
– Executing [continue@macro-dialout-trunk:1] NoOp(“SIP/652-00001aec”, “TRUNK Dial failed due to CONGESTION HANGUPCAUSE: 21 - failing through to other trunks”) in new stack
– Executing [continue@macro-dialout-trunk:2] Set(“SIP/652-00001aec”, “CALLERID(number)=652”) in new stack
– Executing [2146749682@restrictedroute-9bf31c7ff062936a96d3c8bd1f8f2ff3:7] Macro(“SIP/652-00001aec”, “outisbusy,”) in new stack
– Executing [s@macro-outisbusy:1] Progress(“SIP/652-00001aec”, “”) in new stack
– Executing [s@macro-outisbusy:2] GotoIf(“SIP/652-00001aec”, “0?emergency,1”) in new stack
– Executing [s@macro-outisbusy:3] GotoIf(“SIP/652-00001aec”, “0?intracompany,1”) in new stack
– Executing [s@macro-outisbusy:4] Playback(“SIP/652-00001aec”, “all-circuits-busy-now&pls-try-call-later, noanswer”) in new stack
– <SIP/652-00001aec> Playing ‘all-circuits-busy-now.ulaw’ (language ‘en’)
– <SIP/652-00001aec> Playing ‘pls-try-call-later.ulaw’ (language ‘en’)

Here are my trunk config’s for both servers…

Server A
type=friend
context=from-internal
qualify=yes
host=IP ADDRESS OF SERVER B
insecure=invite
allow=all

Server B
type=friend
context=from-internal
qualify=yes
insecure=port,invite
host=CARRIER IP
fromdomain=CARRIER IP
disallow=all
allow=g729,ulaw

Can someone please help me understand what is wrong with my trunk config?

Thank you so much!

Where’s the trunk from/to Server A on Server B?

Oops, I have added that additional trunk.

Now the call is hitting Server B, but getting a "the number is not in service prompt:

[2017-08-31 14:25:30] WARNING[20254][C-0000002d]: Ext. s:3 @ from-trunk: Friendly Scanner from IPADDRESS OF SERVER A
– Executing [s@from-trunk:4] Wait(“SIP/call-router-a-00000014”, “2”) in new stack
– Executing [s@from-trunk:5] Playback(“SIP/call-router-a-00000014”, “ss-noservice”) in new stack

I can register an extension on Server B and place an outbound call fine, so the trunk there appears to be working.

I’ve got it working… I had to create an ANY/ANY inbound route and point that to my carrier trunk on Server B.

Sorry for the stupid question, I haven’t linked two PBX’s together with a SIP trunk in the past.

1 Like

I do have one question.

When the call from Server A processes through Server B, the outbound caller ID from Server A is lost and showing up as unknown on the receiving end.

Any idea how to correct this?

I’d start with Googling trustrpid and “Intracompany route” and search around in that little universe. One of those will lead you to a solution in your problem set.

I believe I have resolved this.

I added the following to Server A trunk PEER Details: sendrpid=yes
I added the following to Server B trunk PEER Details: trustrpid=yes

I also set the outbound routes on Server B as intra-company routes.

Caller ID is now passing through from Server A, to Server B, to the receiving party.

Thanks for your help Dave.

Actually… this passes the caller ID through, but on Server B CDR reports, I’m unable to see which trunk that calls are coming in on, so I have no idea which trunk the call is originating from, which is information I need to know.

Is there a better way to do this?

I would have used an IAX2 link between PBXes.
Only one UDP port to open and manage on your firewall.
I have many PBXes federated that way.

2 Likes