One side setup "trunk"

I need help with VoIP only service using FreePBX.
One server is behind NAT [prvServer](for now only one), second have public static IP[pubServer].
There will be not possible to change NAT settings (port forwarding is disabled).

My goals to achieve:

  1. Same cellphone using softphone can be connected to any of that servers
  2. This cellphone should be registered only on [prvServer]
  3. [prvServer] is initializing connection with [pubServer], created connection is used for SIP or IAX bidirectional transfer
  4. [prvServer] must work even without internet connection
    5.[pubServer] avoid any phones specific config (like one extension for one phone), should don’t have manually provided [prvServer] IP, FQDN or port

It is possible with FreePBX or i should try something else?

Yes, except for the part where your cell phone has to be able to get from the Internet to your internal phone server when there’s no Internet connection. That sounds hard.

Now i have 3 virtualbox machines
First with [pubServer] - one extension for testing 7001
Second with [prvServer] - with public IP, extensions 5001 and 5002
Third with [prvServer] - behind virtualbox NAT, extensions 6001 and 6002

Between First-Second and First -Third is IAX Trunk.
Outbound routes are set and i can make calls .
(7001 -> 6xxx not working now i will work on it later)

I cant’t find a way to register 5002 and 6002 using first server.

OK - I’m still not clear on what you really want to do.

If you have an IAX trunk between the servers, you can just set up a dial pattern in the outbound side of the connection or set up a forwarder from server 1 to point to the extensions on servers 2 and 3.

What are you really trying to do? Where are 5002 and 6002 actual connected to the network? Are your extensions coming in from the Internet? Are your extensions in the local network, or are they in the WAN?

If you’ve set up the trunks, have you set up the routes too?

Are you trying to register the phones one more than one server at a time, or are you trying to set up a fail-over scenario?

I’d like to help you, but the questions you are asking and the lack of useful information in your question is making it hard for me to help.

Sorry for confusion. I try make it clear.
Vbox machines are only for test. Now they have IAX trunks, extensions, and outbound routes. I want to change their configuration step by step to make them work like in my first post. All of that virtual machines are installed on single desktop computer.

5002 and 6002 are extensions to connect cellphone to local network phones (first one is for tests without NAT, second to tests with NAT ). When they inside LAN should talk with freePBX directly. When cellphone is outside LAN will use WAN connection and public server to access own LAN.

I want register (input number, name, password) phones only on local server. Cellphone will use that same name and password on both servers.

Public server can get copy of registration data, or have direct access to local database, or transparently bypass connections, or ask local server, or use any other way to allow cellphone to connect with own LAN.