How to connect two pbxs with different IP address

how can i connect two pbxs each has its public ip address using freepbx. I want to use sip protocol. I’m behind nat. Do i have to use any commercial sip trunk to achieve that?

For Asterisk, I don’t understand the problem. Provided all the PBXes, except Asterisk, are outside the NAT, there is nothing special at all.

If this is related to a limitation of FreePBX, you need to ask on a FreePBX forum.