Grandstream GXW4104/GXw4108 Stupidity

I have a customer with 7 PSTN lines. We’re working to get them cut over to SIP trunks. In the meantime, we have a Grandstream GXW4108 in line that acts as a gateway or bridge between the PSTN lines and the VitalPBX server.

After setting it up as a PJSIP trunk - which was a steep learning curve with the Grandstream GXW410x - they reported that caller 2-7 would just ring and ring, and not answer. I’ve banged my head against a wall for awhile on this problem, and after reading exhaustively on the internet, it hit me what the problem most likely was. And I was right! So I’m documenting this to maybe save the next poor sysadmin the headaches that I’ve incurred.

To test the theory, I called the main number with my desk phone, and then once it started ringing, called the same number with my mobile phone. Yes, they have rollover on busy from the dial tone provider. Sure enough, the desk phone call went through, and the mobile phone call did not. I opened an SSH session to the server and ran an “asterisk -rvvvvvvv” (show me what’s happening right now, and be ridiculously verbose about it). On the second call, I saw tidbits that looked like this. Unfortunately, I don’t have the copy/paste of the error now that I’ve solved it. But hopefully this is good enough for google searches to pick it up:

pjproject.c: Error in line 7, column 32 could not parse username (yada yada yada) line follows:

Authorization: Digest username="“Anonymous”", realm=“asterisk”, algorithm=MD5, uri=“sip:[REDACTED]@192.168.1.13”, qop=auth, nc=00000004, cnonce=“cf257f9386b3c9b3”, opaque=“3027ba6c37cea913”, nonce=“1656372345/4c64f36a0b86bc0bbdb7f2b7c975cb5e”, response=“4e401c4d2e55a09076bbb90f90e17e7c”

This only happens on callers 2-7, not on caller 1. So what gives? I went through the Grandstream with a fine tooth comb, trying all sorts of things. Here’s the fix:

Look in Accounts >> User Account in the interface. You will probably see something like this:

Channels: 1-8
SIP User ID: [Something you defined]
Authenticate ID: [Something you defined]
Authen Password: [Something you defined]
SIP Account: Account 1

…and that “Channels 1-8” thing would lead you to believe that the Grandstream would use this same username and password for all 8 PSTN lines. But that would be WRONG.

  • Instead, go down the channels column and put in 1, 2, 3, 4, 5, 6, 7, 8.
  • Now copy and paste the SIP User ID into all the fields for channels 1 through 8
  • And then copy and paste the Authenticate ID into all the fields for channels 1 through 8
  • And finally copy and paste the Authen Password into all the fields for channels 1 through 8
  • Leave the SIP account set to Account 1 for all the channels.
  • Save, and Reboot.

This resolved my problem. Now callers 2-7 have a username and password and it’s not “Anonymous” anymore.

I hope this helps someone. YMMV. If you need help with the GXW410x series gateways, let me know. I can probably shoot you a config to work with in a private message or something.

Let me know if this helps you. It gives my minuscule ego a tiny boost. :slight_smile:

2 Likes

Hey anomaly0617,

Could I see you PJSIP config, I can get most of it working on Chan_SIP but would like to us PJSIP?

Hi anomaly0617,

We have set up a PBX Sangoma for our internal telephone exchanges and then configured a GXW410X PSTN Gateway to enable us to make and receive external phone calls. However, after completing the various configurations on both interfaces, we are unable to make or receive calls externally. Could you please share the configurations you have made on both PBX Sangoma and the gateway?

Here’s my working configuration:
GXW4108 Working Configuration.txt (2.5 KB)

Hope it helps!

Edit: Here are some screenshots of my VitalPBX config, with some things redacted as necessary. Note that in the working config, the 10 digit phone number is set to 2345678901 instead of my real number.