SIP trunking two FreePBX and use first PBX SIP provider for Outbound calls

Hi,

I configured a FreePBX with a few SIP providers and a couple of remote workers as well. Everything is working great so far and I’m very satisfied with call quality and FreePBX new features.

Now I want to trunk a second FreePBX to the first one so it can use the first system’s SIP trunk for both receiving calls on DIDs and making outbound calls.

I was able to make the inbound calls work but had no success for the outbound calls. Also Outbound CallerID from second system must be shown. I don’t need servers extensions being able to call each others. Also, I do not want to use IAX2. Both systems are 6.12.65, fully updated, they are trunked through public internet, NATed behind pfsense firewalls.

As it’s public internet, I want some minimal security, so I used username/password.

Tried making it with these instructions:

http://asteriskguide.quora.com/Create-a-SIP-trunk-between-two-Asterisk-Servers
http://www.asteriskdocs.org/en/2nd_Edition/asterisk-book-html-chunk/connecting_two_asterisk.html
http://wiki.freepbx.org/pages/viewpage.action?pageId=4161588 (even though its IAX, tried to adapt it to SIP)
How to setup a SIP trunk between 2 local Asterisk servers (same LAN, no NAT, no firewalls) (with links in the topic)

I also tried playing with contexts (from-internal, from-trunks etc…) and now I’m lost.

Oh, I forgot some important details:

I’m using Asterisk 13.2 with chan_sip for trunks.

Why don’t you want to use IAX2 (Inter Asterisk Exchange v2)?

It is far easier to traverse NAT and firewalls (one UDP port) and is more efficient as a trunk (if so configured) when more than one call is being “trunked” and plays well with your pfsense stuff no problem.

Because I do not control both firewalls and SIP ports are already open. Also, I might add trunks for other devices (sipxecs box) as well so the recipe will already work­.

I was finally able to get both incoming DID and outbound SIP provider calls to work but I can’t get the outbound CID to be shown on outbound calls from the second PBX. I will probably open a new thread for this.

Then in reality, you “can’t use” not “don’t want to use”, ask your “net nazi administrator” to open UDP/4569, it would be benificial to both of you.

Are your outbound routes appropriately “Intra-Company” ?

I did not tick “intra-company” as I want the outbound CallerID to be shown, not the internal extension CID.

There should not be any internal calls between both systems, the objective is sharing VoIP provider trunks costs between multiple organisations using the “original” FreePPX box both as a PBX and an Asterisk SIP “router”.

The reason for using SIP is another box will be added which is only SIP (3rd company)

As for ports, the netadmin would open them if really needed but as he already opened the ports for remote workers and SIP providers, we agreed upon doing it with SIP, especially since a 3rd SIP-only PBX will be trunked and doing the current one with IAX2 would only postpone the problem.

I will try the Intra-company check-box tonight as the only problem left now is callerid related. In case I would not be able to overcome the CID/CNAME problem, I will open another ticket here. Currently it’s always anonymous.

You might want to look into a sip proxy like kamailio or indeed sipexecs to do what you are trying to do. Asterisk as yet is still a b2bua and performs poorly In your scenario.

Yeah a proxy would probably be a better option but since I’m pretty close to get it work the way I wanted I will probably stick with the FreePBX box as it’s the only one I have enough knowledge of and no more than 2 boxes should go through (3 if you consider the box with the outbound trunks itself).

Just not enough knowledge to make Outbound CID/CNAME work yet though… Will have to open a new topic about that as I tried ticking intra company and trustrpid/sendrpid params without success.