Time to start fresh. From the guide you referenced above
On the gateway create a new sip endpoint
1. enable advanced options no
2. give the endpoint a descriptive name
3. username anything as long as it matches whats in the pbx
4. make a strong password
5. for registration choose “Endpoint registers with this gateway”
6. use udp yes
7. use tcp no
8. use tls no
9. nat traversal yes (for the time being)
goto the gateway settings and config
1. click on call routing rules
2. click create call routing rule
inbound
a. give a descriptive name
b. call comes from - set to the t1 port
c. send call through - select pbx endpoint
outbound
a. give a descriptive name
b. call comes from - set to pbx endpoint
c. send call through - select t1 port
click save call rule
In pbx configuration
basic trunks
1. add sip trunk
2. trunk give a descriptive name
3. outgoing settings
a. trunk name (can use the name from above)
b. peer details enter the following:
host=(gateway ip address)
defaultuser=(username from gateway)
secret=(password from gateway)
type=friend
context=from-trunk
4. incoming settings
a. user context - leave blank
b. user details - delete contents if any and leave blank
5. registration
a. set registration string using the format (gateway username)

gateway password)@(gateway ip address)
6. save and apply
create inbound and outbound routes in the pbx as needed