Secure FreePBX for public use AND accept IP calls

I would like to set my PBX up to be able to both accept IP based calls (IE: someone calls my domain name …phone.mydomain.com), and to be able to connect my phones outside of my local network, therefore my SIP needs to be totally secure.

Is there any instructions on how to both of these things? I dont want people to be able to make outgoing calls thru some kind of backdoor on my system, and equally I really want to be able to publish an IP phone number for other VoIP users to be able to call my system.

on a side note… my system already accepts calls to [extension]@phone.mydomain.com, it just doesnt accept them when not directed to an extension. the PBX says “beep beep beep, the person you are calling is unavailable”

Thanks in advance.