Grandstream GXW4104 as TRUNK - outgoing call invite rejected / forbidden

I have been trying to get outgoing calls to work on the GXW4104 but I can’t quite figure out the issue.

I have followed the WIKI article on configuration with FreePBX using a single trunk type structure (all FXOs work as a single trunk with FreePBX ). I’ve checked these settings a few times thinking I’ve missed something but all looks correct.

https://wiki.freepbx.org/display/FOP/Configuring+a+Grandstream+GXW-410X+Device+to+act+as+an+FXO+Gateway

I am using the CHAN_SIP driver on port 5060 as I need support for older Cisco SIP phones that PJSIP doesn’t seem support. I have observed too many issues trying to mix SIP and PJSIP devices so everything is using the CHAN_SIP driver.

When the outgoing INVITE from Asterisk is sent it looks like the GXW4101 is rejecting it (SIP 403). The SIP debug output is below the verbose monitoring.

Incoming calls route properly on all FXO ports for the GXW4104 with bi-directional audio verified.

In my TRUNK settings the trunk name matches the user ids in the 4101 and the outgoing settings are:
type=friend
qualify=yes
secret=mysecret
host=172.30.1.7
context=from-trunk
insecure=port
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw

The incoming fields are all BLANK per the wiki article.

I am beginning to suspect the SIP invite content that includes the %40GXW4104 characters is confusing the GWX4104 dialplan. However I don’t know how / where that is coming from. GXW4104 is the FREEPBX trunk name, not the SIP trunk name. I see in my SYSLOG file that the GXW4104 sees an invalid parsed dialplan length mesage and and the parsed number includes the 40GXW4104 part of the string.

QUESTION(s):
Any idea on what might be happening here?
Anybody have a better article than the Wiki article referenced on a FreePBX setup?
Any better way to troubleshoot this?

OUTPUT snippet:
– Executing [s@macro-dialout-trunk:23] Dial(“SIP/104-00000043”, “SIP/gxwt1/17174375277@GXW4104,300,Tt”) in new stack
== Using SIP RTP CoS mark 5
Audio is at 19732
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 172.30.1.7:5060:
INVITE sip:17174375277%[email protected] SIP/2.0
Via: SIP/2.0/UDP 172.30.1.8:5060;branch=z9hG4bK2aaa6d7a
Max-Forwards: 70
From: sip:[email protected];tag=as6068fa0c
To: sip:17174375277%[email protected]
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.7.1
Date: Mon, 01 Jan 2018 20:05:30 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 245

v=0
o=root 155194336 155194336 IN IP4 172.30.1.8
s=Asterisk PBX 13.7.1
c=IN IP4 172.30.1.8
t=0 0
m=audio 19732 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv


-- Called SIP/gxwt1/17174375277@GXW4104

<— SIP read from UDP:172.30.1.7:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 172.30.1.8:5060;branch=z9hG4bK2aaa6d7a
From: sip:[email protected];tag=as6068fa0c
To: sip:17174375277%[email protected]
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: Grandstream GXW4104 (HW 1.1, Ch:5) 1.4.1.5
Content-Length: 0

<------------->
— (8 headers 0 lines) —

<— SIP read from UDP:172.30.1.7:5060 —>
SIP/2.0 403
Via: SIP/2.0/UDP 172.30.1.8:5060;branch=z9hG4bK2aaa6d7a
From: sip:[email protected];tag=as6068fa0c
To: sip:17174375277%[email protected];tag=9c474e62cbc16875
Call-ID: [email protected]:5060
CSeq: 102 INVITE
User-Agent: Grandstream GXW4104 (HW 1.1, Ch:5) 1.4.1.5
Content-Length: 0

<------------->
— (8 headers 0 lines) —
Transmitting (no NAT) to 172.30.1.7:5060:
ACK sip:17174375277%[email protected] SIP/2.0
Via: SIP/2.0/UDP 172.30.1.8:5060;branch=z9hG4bK2aaa6d7a
Max-Forwards: 70
From: sip:[email protected];tag=as6068fa0c
To: sip:17174375277%[email protected];tag=9c474e62cbc16875
Contact: sip:[email protected]:5060
Call-ID: [email protected]:5060
CSeq: 102 ACK
User-Agent: Asterisk PBX 13.7.1
Content-Length: 0


[2018-01-01 15:05:30] WARNING[1888][C-00000020]: chan_sip.c:23372 handle_response_invite: Received response: “Forbidden” from 'sip:[email protected];tag=as6068fa0c’
Scheduling destruction of SIP dialog ‘[email protected]:5060’ in 6400 ms (Method: INVITE)

Since I didn’t have anything to lose, I rebooted FreePBX. After the reboot, the extra FreePBX trunk name was no longer being appended to the dial number. Outgoing calls are now working through the GXW4104.

Evidently there is a bug somewhere in FreePBX or Asterisk that was causing the dial string to not be constructed properly. The reboot fixed this.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.