How can i connect two PBXs with different public address with sip protocol using freepbx

I want to use sip could you please tell how to configure the outbound and inbound setting in details

I have established a connection between two PBxs in the local network now. I’m trying to simulate that the PBXs are in the different places. I want to enable the person with his own phone number(assuming 3000) to automatically register on the pbx at either place, where his is, and make phone calls from that place to the other. I tried to configure 3000 with context: from-internal in pbx A. And I also configured the dial pattern 3xxx to be in the context from-trunk in pbx A. But when I use another phone, registered on PBX A, with number 4000 to call 3000,the phone number 3000 can’t be reached unless it is registered on PBX A. When I register 3000 on pbx B, it will tell me 3000 is unavailable. How could I fix this problem?

thank you for your reply. I want to set up two pbxs in two different locations behind nat. The pbx is located in a local network with other softphones. How can I make sure the phone calls is routed to the PBX rather than other computers which sited in the same local netwrok? where can i get the sip peer documentation, could you give a reference website? Thank you very much.

You really don’t need FreePBX to do this. In fact it will complicate it. I would use Asterisk without FreePBX on a public IP address then have the two systems behind NAT register to the Asterisk box.

Information on Asterisk @

Of course you could still use FreePBX but if you aren’t going to use the PBX functionality just a gateway why complicate things.

You question is too vague. On the most simplistic level all you have to do is create two trunks.

How can we provide detail when you have provided none.

Setting up Asterisk SIP peers is also well documented. You need to review the documentation, create your trunks and dial plans then ask specific questions so we can assist you.

It is better to use IAX Trunks rather than SIP Trunks. There are plenty of documents online that tell you how to configure FreePBX to connect two remote locations. I’ve figured out how to connect two locations, both behind NAT using IAX with no port forwarding, but I’ve been too busy to write it up. It’ll eventually make its way into the documentation…

To be honest, I’m a new user of asterisk. I found it’s easy to use freepbx to configure the asterisk. Now I have successfully connect two PBXs in the local network using freepbx. But I don’t know how to do that in the public network environment.I don’t know the Pros and Cons for any kind of implementation. Most importantly, I don’t know the procedure to configure the asterisk work in the public network environment. I didn’t find any proper learning materials on the internet.Could you please tell me how to set the trunks, outbound routes and other parameters or tell me where I can find the learning materials fit for my situation. Thanks!

Thanks for your reply. I heard that it maybe easy to implement my system using IAX trunks. But I was repuired to use sip trunks to do that and I don’t know how to set parameters for trunks, outbound routes and other settings need to be configured. Is there any documentation teaching how to connect two pbxs using sip. Could you tell me some website where I can access to the learning materials. Thank you very much!

I entered IAX and FreePBX into Google and got 100s of hits Same with FreePBX and "connect two systems together" many hits. We cant hold each users hand, these are basic concepts. If you want help you need to try and configure your trunks then come back and ask specific questions.

Not trying to be difficult, just point you in the right direction.

OK.i will try to find learn things from internet first then ask you specific questions. By the way can I connect two pbxs with different public IP address using sip? Do i have to buy a trunk from a voip service provider to connect my two PBXs?

You can certainly set up two FreePBX boxes with a SIP or IAX trunk between them. I would recommend that you setup a VPN between the two sites that way you don’t have to worry about opening up ports to the outside on your firewalls to allow the trunk to connect.

I answered this in the first post. Yes you can connect as many SIP peers to Asterisk as your hardware will allow. They can be other FreePBX boxes, phones or any other SIP devices.

Fundamentally there is no difference between how a phone connects or another server. It’s just a SIP peer.

It sounds good. How can I setup the VPN between the two PBXs?(using router?) I’m a rookie to use linux and I’m not familiar with setting up network environment. Could you please show me a direction. By the way, do I have to purchase a trunk from the voip service provider(I only want to make phone calls through the internet, but many materials on the internet teaching how to setup the connection need a commercial service )?

Thanks. You may have ignored my second question. Do I have to buy the service from a VOIP provider if I only want to use the PBXs make phones calls through the internet and only require the function of making phones calls. The materials I found on the internet seem all need to connect to a voip service provider first.

I did answer your question. You can directly connect the systems to each other. Providers connect you to the PSTN.

WRT the network, VPN, Public Internet it really does not matter, you just need IP connectivity. Prudence dictates security measures if using Public IP.

As far as VPN’s, you would have to provide much information for us to provide any suggestions.

It sounds like you are missing much fundamental knowledge of SIP and IP telephony in general.

You would setup the VPN between the routers at each location. How to setup the VPN is dependent on your router hardware.

The VPN will allow you to make calls from server to server. If you want to make calls from your server to other phones you would need a commercial service like SIP trunks or analog lines with an analog card in the server.

Thanks. I’m indeed a new user with limited fundamental knowledge. I’m very grateful for your patient answer. I will learn more things then ask you more specific questions. Thanks.

You need an outbound route for the dial pattern. Point it at the trunk between the two systems. Make sure you use the corrce context (from-internal) on your trunks so they can access the internal extensions.

Before I add an extension 3000 in the pbx A, I could use 4000, registered on pbx A, to dial to 3000, which is registered on pbx B through the outbound route. Now when I add extension 3000 in PBX A, I could no longer make phone calls to 3000 if 3000 is not registered on pbx A. I have tried to change the context of the trunk to be from-internal, but it doesn’t work. I also tried to change the context of 3000 which is registered on pbx A and it doesn’t work either. Is there any other ways to do that?

Hi. Now i have located my two pbx in different places. Using sip proctocl, have established a trunk connecting these two pbx(but i’m not sure if i have achieve that, as the only thing i know that when i type sip show peers on each of the pbx, the pbx shows the trunk status is “OK”). When i use the extension on one of the pbx to call the other extension registered on the other pbx, the phone call can not be made. It says that the number is not answering and there is no ring tone when i’m dialing. what is the problem i’m facing? how can i fix it? Thanks!