HOW TO: Grandstream GXW-4104 setup

This ended up taking me a few more hours than it should have due to the lack of a decent guide ANYWHERE. I thought I’d spare the next person the same problem.

In FreePBX create a new SIP Trunk. (You could create one and round robin the numbers, but because I want to be able to send each line to a different spot, I setup four trunks, 6000, 6001, 6002, 6003)

In this guide, if I don’t mention something, don’t touch the setting.

Trunk Name: NXXNXXXXX (Your phone number eg. 8885551212)
Outbound Caller ID: NXXNXXXXXX

Trunk Name: 6000

PEER Details:

Empty out incoming settings. You DO NOT need a registration string.

Create an inbound route.

Set the DID to NXXNXXXXXX (the did that comes from the FXO port). You don’t need to define anything else.

Create an outbound route.
Name your route.
Create a dial plan.
Define the trunk sequence (the order you want to use the lines)

On the web interface of the GXW-4104:

TAB Basic Settings:
Setup a static ip.

Update>>> reboot

Go back into the web interface with the new IP.

TAB Advanced Settings:
Create a password.

Update>>> reboot

TAB FXO Lines:
Channel Dialing to PSTN:

  1. Wait for dial tone: ch1-4:N;
  2. Stage Method: ch1-4:1;


  2. Sip Server: ch1-4:YOUR_FREEPBX_INSTALLS_IP;

PSTN to VOIP Caller ID Setting: (I needed 2 rings before ATT transmitted caller ID info)

  1. Number of Rings Before Pickup: ch1-4:2;

Update>>> reboot

TAB Channels:
Port Number Settings, Fill it in as follows:
Channel: 1
SIP User ID: 6000
Authenticate ID: 6000
Profile ID: Profile 1

Channel Voice Setting:
Feel free to play with the RX and TX gains here, My tx was fine but I had to amp up my RX to 2. DO NOT go crazy here. You will introduce echo and hissing.

Channel Specific Setting:

  1. DTMF Methods(1-7): ch1-4:2;

Update>>> reboot

TAB Profile 1:
NAT Traversal (STUN): NO

Update>>> reboot

Do you have to update and reboot after every tab? Probably not.

The above directions got it work for me with no echo, caller ID, and directed routes to each fxo port. Keep in mind, you need to setup an inbound route, and add/setup each number to an outbound route.

HI, tahnk you very much for the guide. i would have been in trouble were it not for this.

I followed your guide to the letter on a 4108. Figured it is essentially the same as a 4104, just more FXO ports. The problem I have however is that when dialing outbound the Trunk sequence I set in FreePBX with my outbound rules is ignored. The system only uses the highest channel number to make the calls. So in effect I can’t even get the dial rules to pick one channel of the other and I want my outbound long distance to use a different channel than local. Any ideas?

hi thanks for your guide

i do as you write in this guide

i have some problem that my gateway is behind VPN router and the freepbx in other site and the problem is it work will but after some time it not available from the server side and i have to restart it to work again
did you have any solutions for that

I use grandstream 503 step by step do it but there are not same like TAB FXO Lines:
Channel Dialing to PSTN:

  1. Wait for dial tone: ch1-4:N;
  2. Stage Method: ch1-4:1;

if in grandstream 503 nothing choice ch1-4N
can you information detail regarding setting fxo grandstream 503

Hello. One fix in your procedure that made everything work.
TAB Profile 1:
NAT Traversal (STUN): NO
SIP Registration: YES ******

(with default SIP registration set to NO, I was calling in and it always said that the number you have dialed is not in service. Outgoing it was saying that all lines are currently busy)

Also, if you want to setup the other ports, under the Tab Channels, you can provide an example:
In freepbx
Trunk name: 5142222222
Outgoing Caller ID: 5142222222

Outgoing settings
Trunk name: 6001
Peer details:

  • Peer details:
    o canreinvite=no
    o context=from-pstn
    o dtmfmode=rfc2833
    o host=dynamic
    o qualify=yes
    o type=friend

Channel: 2
SIP User ID: 6001
Authenticate ID: 6001
Profile ID: Profile 1

Finally, an addon explanation. If you want a call incoming from a specific port to go to a specific destination, in freepbx:
Incoming routes.

  • Description: whatever you want like callsfrom4501234567
  • DID number: (type exactly what you’ve written in the grandstream, in FXO lines Tab, Channel Dialing to VoIP, Unconditional Call Forward, User ID, ch2:THISnumber!
  • Set destination: Whatever you want your system to do.

The big string sends a DID and Freepbx catches the DID in that line.

Hope it helped. I made a full manual with the addon and corrections!

Thank you so much for your guide. Saved me days of trying to do this alone. I followed your steps and i’m able to dial out through my GXW4108 without any issue. However when i dial into one of those lines, it rings, then i get my pbx dial tone. i setup the incoming route for that DID to ring an extension. (or at least i thought i did) The CDR report isn’t showing the incoming call.

I picked up 2 of the GXW4104’s, the issue I’m having is it looks like the newer firmware has been upgraded with a new UI (according to the release notes), no other docs exist so I’m swimming to say the least being this is my first run in with the beast.

It would appear they moved and renamed many of the menus if trying to follow the above steps.

Has anyone updated to the newer firmware and or have set up a new gateway that could point/update to the above steps?

Some steps I see where they go but the changes don’t hold etc. I would not think you have to do things in some order but maybe?

I half thought about seeing if I can roll the firmware back but that seem a step backwards (no pun intended).

Thanks All



I have 2 phone lines from my provider, how do I get 2 lines connected in GXW 4104? I installed, but I have a problem:

When you make the connection, calls are ALWAYS out of line 2 from line 1 and not as I set the rules for outbound.



Hi, we have GW4108 and xlite, testing for incoming to FXO, the call keep ringing even though the xlite has ended the incoming call. We have also set to temination hangup on freepbx inbound route, but call keep ringing. So it looks like the grandstream unable to detect a termination signal from pbx. Any idea for setting ?

Any one has a guide similar to one above for the Fm Version
having a hard time making it work.