Background
The Grandstream HT503 has one FXO and one FXS port.
Setting them up an FXO port in FreePBX/ Asterisk has many steps and it is non-obvious what each one is, what it does, and what you get from that step.
Note: The screenshots shown refer to FreePBX 12 with Asterisk 12/13.
Different ways of setting up the HT503, or the whys behind setting up an FXO appliance
There are lots of different ways of setting up the HT503 listed on the web.
(Almost) All agree that the FXS port should be set up as an extension.
It is on the FXO port that many have not been able to follow all the steps through, so I will list the various layers of configuration and approaches and try and highlight what each gives you.
- Set up the FXO port as an extension (add extension to FreePBX and set username/pwd on HT503)
We get: Can call extension and then, after hearing dialtone, can call outside number. Step 1 + Set up trunk on FreePBX and an outbound route
We get: Can dial 9+number (etc) and will get dial-through to our PSTN line, with monitored
trunk status
Steps 1 + 2 + Set up ‘Unconditional call forward to VOIP’ to an Extension or Misc Application
We get: incoming calls flow in to the specified extension, but we have no inbound route
controls/ settings
Steps 1 + 2 +
i) Set up ‘Inbound Route’ in FreePBX, and set up ‘Unconditional call forward to VOIP’ to theDND in the Inbound Route.
We get: inbound calls appear to ring forever and we get extension busy in the logsii) In the extension for the FXO, change the context from ‘from-internal’ to ‘from-trunk’ which now causes the Inbound Route to be invoked.
We get: a round of applause for having a fully working HT503
When I started it was not obvious what each stage was for, and it was extremely non-obvious how everything linked together
Stage 1 in Detail
Set up FXO port as extension (FXS port has identical setup – but it will use a more normal extension number)
Applications:Extensions:PJSIP:Add Extension
Note: The SIP Server/ Outbound Proxy should be the IP address of your SIP Server.
Stage 2 in Detail
Applications:Connectivity:Trunk
Applications:Connectivity:Outbound Routes
Stage 3 not shown as it was a step in the wrong direction
Stage 4i) in Detail
Applications:Connectivity:Inbound Routes
Stage 4ii) in Detail
Applications: Extensions
What have I not covered in this introduction?
Caller Id setup,
Number of rings,
Country based settings.
These are less contentious and can be found from many sources.
Please note that this approach for setting up FXO ports can be used with other Grandstream products.
I hope this helps other uses get to the full setup much more quickly.
Additional Notes From Another User
These instructions do work setting up the FXO port of a Grandstream HT-503. You do end up with a working system. However, as the author points out, Caller ID has not been addressed. And in this configuration Caller ID will not work at all. The mistake is configuring an extension to receive inbound calls. Do not do this. Only configure the trunk. Trunks are intended for both inbound and outbound traffic. If you send inbound calls through an extension, the Caller ID will be set to the name and number of that extension, which is what you want for an FXS port but not an FXO port. Some configuration points I discovered:
- Make sure the trunk name on both the General Page and the SIP Settings page of the trunk configuration matches your User ID on the Unconditional Call Forward setting and the SIP User ID and Authenticate ID on the FXO page of the HT-503.
- I am unclear how much the port number of the Unconditional Call Forward setting matters. Once I removed the extensions, I reset one of my HT-503s from port 5060 to port 5062 thinking this was important. But I forgot the other HT-503, leaving it at 5060. However, both HT-503s continued to work for inbound calls. I suspect once you have only a single destination for a particular username, FreePBX just figures things out. However, for consistency sake I have set both ports to 5062.
- The Outbound section of SIP Settings on the trunk is not configured at all.
- Note the HTML of the FXO page on the HT-503 sometimes does not maintain the Authenticate Password setting if you make changes on that page. If you have problems dialing out try resetting the password on that page.
- Be sure to set the PSTN Ring Thru FXS setting to "No" on the FXO page of the HT-503. This was reiterated by Grandstream tech support. The FXO and FXS ports are two different things in this application.
- Multiple sources say that Caller ID information is transmitted between the first and second ring on most PSTN systems. This means you need to set the Number of Rings on the HT-503 to at least two. This is the case on my two analog Comcast PSTN lines.
- Set "SIP Registration" to "No" in the HT-503 FXO port. There is nothing to register. Everything still works. If you look at the SIP report or 'asterisk -rx "sip show peers"' you'll see that the trunks are "unmonitored." Once you have only the trunk setup, the first page of the HT-503 will no longer show "Registered" for the FXO port. If you leave registration on, you'll see warnings logged about registration failed – peer is not supposed to register.
The Peer Details section above is a bit hard to read. Host is the IP address of the HT-503. Username is what you need to match across the trunk and HT-503. Here is mine:
host=10.0.2.99
username=09259991111
secret=something
type=peer
port=5062
disallow=all
allow=ulaw
dtmfmode=rfc2833
context=from-trunk