I blogged in 2019 about connecting 3CX running on Windows with an AT&T Flexible Reach SIP gateway. Now I’m moving that customer to a Grandstream UCM6301, currently running firmware 1.0.21.9, and I wanted to share a post about the settings needed to get that working.
First, you’ll need to use two network cables to the UCM. I chose to connect LAN1 to the router that goes out to the Internet and WAN2 directly to the special SIP port 8 on the AT&T Edgemarc gateway. The unit is off-site so I can’t double check, but I believe LAN1 corresponds to the UCM’s LAN port and LAN2 to the UCM’s WAN port.
Throughout this post, click on the screenshot to see the full image. Use the Back button in your browser to return to the post.
Network and NAT
The main trick is to get the UCM to connect with the AT&T SIP gateway. The gateway’s address is 1.1.2.1 and it expects traffic from the UCM at 1.1.2.21. (And yes, those are public, routable IP addresses not owned by AT&T, but this SIP port isn’t connected directly to the Internet, so it can use those addresses without conflict.)
In the UCM, define System Settings > Network Settings > Basic Settings as follows:
Method: Dual mode
Default interface: LAN1
LAN1 > IP Method: DHCP
LAN2 > IP Method: Static
LAN2 > IP Address: 1.1.2.21
LAN2 > Subnet Mast: 255.255.255.0
LAN2 > DNS Server 1: 1.1.2.1
Under System Settings > Network Settings > Static Routes. add a static route. It might work without this, but it seems like a good idea to help the UCM immediately know to send traffic for 1.1.2.1 on LAN2. Grandstream support says, “This is to prevent any traffic signaling related to trunk could be acting odd in the call flow.” Note that leaving the subnet blank causes it to infer 255.255.255.255, i.e. just that one IP address.
Under PBX Settings > SIP Settings > NAT, add 1.1.2.0/24 as a Local Network Address. (You should also add the network that your IP phones are connected to as a second address, e.g. 192.168.1.1/24.)
Notes:
- If you forget this, you may find, as I did, that incoming calls work but outgoing calls do not. (The same symptoms were described in this post about connecting FreePBX to Flexible Reach. The solution there was to add a custom transport to
pjsip.endpoint_custom_post.conf
. I wonder if Local Network Addresses is how the UCM defines transports. Or maybe this is a different approach.) - At one point during troubleshooting, Grandstream Support had me uncheck Use IP address in SDP. It didn’t solve the outbound call issue, so it may be okay to leave it checked. But It’s working with it unchecked, so I’ll probably just leave it unchecked.
Trunk
Under Extension/ Trunk > VoIP Trunks, add the AT&T trunk as a “peer” trunk as shown here (Basic and Advanced Settings):
Notes:
- The From Domain appears in the From field of SIP packets sent from the trunk, e.g.
From: “Company Name” <sip:1234567890@1.1.2.1:5060>;tag=8adfd… The “:5060” may not be needed but I noticed it was present in the SIP packets sent by 3CX so I added it here. - By default, the AT&T gateway sends codec G279 first, offering PCMU and PCMA second and third. At one point, users were complaining about choppy audio. To rule out transcoding issues, and because who cares about saving a little bandwidth on an intranet, I removed all but PCMU and PCMA from the codecs that the UCM accepts on this trunk. Audio quality returned to normal. I suspect that the audio issue was caused by the NAT issue instead, so putting G729 back in there, at first priority to match the AT&T gateway (as recommended by Grandstream support), would probably work to.
- Enable Heartbeat Detection to have the UCM periodically send an OPTIONS packet to the gateway. This allows it to know when the trunk is available and display that on the UCM dashboard:
And if the trunk is not available, like when it wasn’t doing outbound, that will also be detected and it can fail over to a secondary trunk for outbound.
Outbound Routes
When I was having outbound calling issues, I pored over the outbound routes, but it turns out that they are nothing special for AT&T Flex. Under Extension/Trunk > Outbound Routes, I configured one route that prepends 1 if the user dials 10 digits, and another route to handle all other calls:
In each route, “ATT Flexible IP” is the primary trunk with an ITSP trunk as failover.