I can't make outbound calls with FreePBX and GrandStream GXW4104

Hi everyone,

I have recently configured FreePBX with Grandstream GXW 4014 FXO gateway using for now just one analong PSTN line.

I have configured following along Configuring a Grandstream GXW-410X Device to act as an FXO Gateway, but I can’t make any outbound call, I have even connect old analog phone directly to wall inlet, and tested few times, just to confirm that everything is OK. Everything I get in my handset is “all circuits are busy now please try again later”. Just note, I have Yealink T41P VoIP telephones, and custom made server with latest FreePBX 13.9.1 version and GrandStream GXW 4104 FXO gateway with latest Program : 1.4.1.5, Loader : 1.1.3.4 and Boot :1.1.3.2 version.

My configuration is as follows:

  1. Calling to VoIP >> Calling to VoIP Unconditional Call Forward to Following:
    ch1:38515626012;ch2-4:;
    ch1-4:p1;
    ch1-4:5160;

  2. Outgoing dial plan (Stage 1 dialing in GXW) is as following:
    {x+}

  3. User account is set up in GXW4104 as follows:

  4. 1 101 101 somepassword Account 1

  5. Trunk name in FreePBX is “101” as account set up in GWX, tech is “sip”, and Dial Number Manipulation Rules is just a dot sign “.” to allow all digits and characters.

  6. My “peer” details are:

type=friend
qualify=yes
secret=somepassword
host=192.168.0.35
context=from-trunk
port=5160
dtmfmode=rfc2833
canreinvite=no
disallow=all
allow=ulaw

  1. My intbound route is set with my number as DID (“38515626012”). and destinastion is set as extension (200).

  2. My outbound route is set with CID and route name “101”, where Trunk Sequence for Matched Routes is “101”.

  3. Dial pattern is set to single dot character “.”.

I have tried various changes, and have eliminated network related problems. I have also took a look in /var/log/asterisk/full and then seen something problematic, but I don’t have idea what to check, or where to look.

[2016-08-18 00:01:37] NOTICE[2634][C-0000000f] chan_sip.c: Failed to authenticate on INVITE to sip:[email protected]:5160;tag=as5a62a413

Here is a part of asterisk log, when I try to dial my phone number, I haven’t put it all here because is to big.

**NOTE: I have emptied log before making test call, which than generate entries in log file.

Here is problematic part, I don’t have a clue, why editor strip it:
[2016-08-18 00:01:37] NOTICE[2634][C-0000000f] chan_sip.c: Failed to authenticate on INVITE to ‘sip:[email protected]:5160;tag=as5a62a413’

i have not used these gateways before so this is only a wag. does the gateway when used as a trunk require registration?

@bksales

It makes some sense, but I am not sure.

do inbound calls work?

@bksales, Yes, they are working, but outbound not. I am not sure what to look for.

how about a snippet of the /var/log/asterisk/full file that shows an outbound call attempt?

Hi, I have already pasted snippet on gist on github. You can find it here: Asterisk log

Only thing I get in my handset is voice message “All circuits are bussy now, plesae try again later”

What is strange, is that when I am making outgoing call, I think that GXW is trying to register with my analog phone number (DID), where it should use “101”.

I guess this is relevant part:

[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:22] GotoIf(“SIP/300-00000014”, “0?customtrunk”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:23] Dial(“SIP/300-00000014”, “SIP/101/0921929444,300,T”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] netsock2.c: Using SIP RTP TOS bits 184
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] netsock2.c: Using SIP RTP CoS mark 5
[2016-08-18 00:01:37] NOTICE[2634][C-0000000f] chan_sip.c: Failed to authenticate on INVITE to ‘sip:[email protected]:5160;tag=as5a62a413’
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] app_dial.c: Called SIP/101/0921929444
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] app_dial.c: SIP/101-00000015 is circuit-busy
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] app_dial.c: Everyone is busy/congested at this time (1:0/1/0)
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:24] NoOp(“SIP/300-00000014”, “Dial failed for some reason with DIALSTATUS = CONGESTION and HANGUPCAUSE = 21”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:25] GotoIf(“SIP/300-00000014”, “0?continue,1:s-CONGESTION,1”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx_builtins.c: Goto (macro-dialout-trunk,s-CONGESTION,1)
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:1] Set(“SIP/300-00000014”, “RC=21”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:2] Goto(“SIP/300-00000014”, “21,1”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx_builtins.c: Goto (macro-dialout-trunk,21,1)
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:1] Goto(“SIP/300-00000014”, “continue,1”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx_builtins.c: Goto (macro-dialout-trunk,continue,1)
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:1] NoOp(“SIP/300-00000014”, “TRUNK Dial failed due to CONGESTION HANGUPCAUSE: 21 - failing through to other trunks”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:2] ExecIf(“SIP/300-00000014”, “1?Set(CALLERID(number)=300)”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:8] Macro(“SIP/300-00000014”, “outisbusy,”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:1] Progress(“SIP/300-00000014”, “”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:2] GotoIf(“SIP/300-00000014”, “0?emergency,1”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:3] GotoIf(“SIP/300-00000014”, “0?intracompany,1”) in new stack
[2016-08-18 00:01:37] VERBOSE[13972][C-0000000f] pbx.c: Executing [[email protected]:4] Playback(“SIP/300-00000014”, “all-circuits-busy-now&pls-try-call-later, noanswer”) in new stack

UPDATE: I have other error now, I have tested and ports are opened:

Here is relevant part I hope so:

2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:13] Set(“SIP/300-00000074”, “OUTNUM=0921929444”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:14] Set(“SIP/300-00000074”, “custom=SIP/38515626012”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:15] ExecIf(“SIP/300-00000074”, “0?Set(DIAL_TRUNK_OPTIONS=M(setmusic^default)T)”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:16] ExecIf(“SIP/300-00000074”, “0?Set(DIAL_TRUNK_OPTIONS=TM(confirm))”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:17] Macro(“SIP/300-00000074”, “dialout-trunk-predial-hook,”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:1] MacroExit(“SIP/300-00000074”, “”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:18] GotoIf(“SIP/300-00000074”, “0?bypass,1”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:19] ExecIf(“SIP/300-00000074”, “1?Set(CONNECTEDLINE(num,i)=0921929444)”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:20] ExecIf(“SIP/300-00000074”, “1?Set(CONNECTEDLINE(name,i)=CID:1001)”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:21] ExecIf(“SIP/300-00000074”, “0?Set(CONNECTEDLINE(name,i)=CID:(Hidden)1001)”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:22] GotoIf(“SIP/300-00000074”, “0?customtrunk”) in new stack
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] pbx.c: Executing [[email protected]:23] Dial(“SIP/300-00000074”, “SIP/38515626012/0921929444,300,T”) in new stack
[2016-08-21 02:06:53] WARNING[28901][C-00000058] app_dial.c: Unable to create channel of type ‘SIP’ (cause 20 - Subscriber absent)
[2016-08-21 02:06:53] VERBOSE[28901][C-00000058] app_dial.c: Everyone is busy/congested at this time (1:0/0/1)

And whole log is here from calling outside:

http://paste.servergur.us/xebudoqebu.coffee

Tell us more about your trunk and outbound route configuration.

From here, it looks like your PBX Is trying to call out on extension 101, which is clearly not going to work.

Yes, that was wrong, now everything is OK and works like a charm.

I have the same problem: “[2018-06-25 10:22:15] WARNING[4046][C-000000bc]: chan_sip.c:24015 handle_response_invite: Received response: “Forbidden” from ‘<sip : 46511246 @ 192.168.10.7 : 5160 > ; tag=as3903832c’”

Incoming calls are ok, but it’s trying to authenticate with the Inbound number and not the gateway that mine is GXWT2. How did you manage to solve it?