FreePBX (Raspberry Pi) - Grandstream HT503 - BSNL India - Setup Notes

After weeks of attempting to the get the above combination work with Caller ID and remote extensions, the setup below worked. I made notes incase the system fails and I need to reset up the system. My notes are posted below should they be useful to someone with the same issue.


  1. Complete and total noob with no knowledge of Linux, Asterisk or programming. Setup only by reading these forums, and google.
  2. Settings not discussed have been left at default value.

Here goes:

FreePBX - Raspberry Pi - Grandstream HT 503 - Setup Notes

Raspberry Pi - FreePBX (
Netgear DG 834 ASDL Router
Grandstream HT 503 FXO Gateway

FreePBX Setup Notes

-Do not touch any .conf file through the Linux Terminal, FreePBX will make changes to the Asterisk. provides the best resource for understanding the settings.

Asterisk SIP Settings need to be configured correctly i.e.,
-IP Configuration = Dynamic IP,
-Dynamic Host = (yourhostname),
-Local Networks = (auto configure),
-NAT=yes (for remote extensions to work),
-RTP Port Range = 10002 - 20000
(Can’t be set manually if Google Module is installed in FreePBX, I removed Google Module and specified the RTP Port Range)

Extension Notes

-NAT = Yes for remote extensions
-NAT = No for local extensions
-Enter correct SIP Port and RTP Port Range in Remote Extension & Switch on NAT in Remote Extension also
-Enter DDNS server name in appropriate column in Remote Extension

Router Notes

-Forward SIP Port (UDP) to FreePBX Server
-Forward RTP Port Range (UDP) to FreePBX Server
-Disable SIP ALG

Setup till here permits Local Extensions and Remote Extensions to interact with audio.


Grandstream HT 503 Notes

-Separate Extension for FXS port and FXO port. To reach PSTN line from IP Extensions, extension number of the FXO Port on HT 503 needs to be dialled. HT503 will thereafter answer the call and provide the BSNL Dial Tone.

-Basic Settings - Unconditional Call Forward Option = Ring Group/IVR/Extension ID as setup in the FreePBX server.

-Advanced Settings - Enable SYSLog for diagnostics, disable after complete setup.

-FXS Port configured as any other IP Extension

FXO Port Settings -
-Primary SIP Server= Local IP of FreePBX server,
-Outbound Proxy=Local IP of FreePBX Server,
-SIP User ID=Extension ID as setup in FreePBX server,
-Authenticate Password=extension password as setup in FreePBX server,
-SIP Registration=Yes
-Caller ID Scheme=ETSI-DTMF during ringing (For BSNL India)
-FSK Called ID Mnimum RX Level (dB)=0
-Caller ID Transport Type=Relay via SIP P-Asserted-Identity
-AC Termination Model=Impedance-based
-Impedance-Based=Complex3—370 ohms + (620 ohms || 310nF)
-Number of Rings=5
-PSTN Ring Thru FXS=No
-Stage Method=1

FreePBX Settings for HT503

-Contrary to online posts, no inbound route set, not outbound route set, no SIP Trunk set.
-Only Extensions, Ring Groups & IVR Configured so that the ID of such Extensions, Ring Groups & IVR can be entered in the Basic Settings of the HT503. HT503 will handled the call forwarding.
-All extensions, ring groups have FIXEDCIDVALUE enabled to ensure that the HT503 passes on the caller ID from the PSTN Line.

Overall Security Settings

-Router logs enabled to detect all activity on ports, including port scans, successful rule matches etc. Logs are set to be emailed every hour.
-Fail2ban setup to permanently ban IP’s without proper credentials after 3 attempts.
-Call Records set to be emailed to admin every hour to detect strange activity.
-PIN Code enabled on HT503 to authenticate outgoing calls from PSTN.

Despite the weeks of frustration, when it works… It works beautifully.