You will either use an SBC or VPN to connect to the cloud system (I wouldn't recommend STUN).
Generate the provisioning file for the device on 3CX and if using SBC either change the registration address from the local address of 3CX to thelocal address of the SBC.
If using VPN and your routing is ok then this should be ok. The issues occur if you want to use FAX machines.
I am trying to follow these instructions to setup a Gateway with patton SN 4112. But the gateway shows as red and would not work so far. Could you please advise if I am doing something wrong?
what I did is -
0) Created a SBC on Raspberry and connected it to my network. (192.168.1.248)
1) upgraded firmware on Patton 4112 and connected it to the PSTN phone line and LAN
2) then I proceeded to 3CX > SIP Trunks > Add Gateway > and Generated device config, replaced 3cx IP with IP address of my Raspberry SBC and uploaded it to my Patton.
How about via IPSEC? Sorry I couldn't resist since your subject seems to answer the question in your post.
So assuming you weren't just throwing that out there you would use your VPN tunnel back to 3CX as the only supported method. You would NOT use SBC as @eddv123 already pointed out that SBC is not a supported configuration. So you would use the config as it's generated. That being said if the ATA config is like the T1 config then 3CX doesn't supply the gateway IP so you'll have to add that manually. Now whether that is just sloppy or by design I couldn't tell you.