FreePBX (User Auth)

Trunk
Connectivity > Trunks > Add SIP (chan_sip) Trunk

type=peer
host={trunk_gateway}
username={trunk_username}
secret={trunk_password}
qualify=yes
allow=!all,g722,alaw,ulaw
insecure=invite
context=fromtrunk

Inbound
Connectivity > Inbound Routes > Add Inbound Route
Add DID number in e164 format and the destination.

Outbound
Connectivity > Outbound Routes > Add Outbound Route

Add route name and point to the trunk.

Settings > Asterisk SIP Settings > Chan SIP Settings (tab) > Advanced General Settings
Make sure that TCP is enabled.