Outbound issue with Grandstream HT813 ATA adapter

Hi guys,

Trying to resolve this. I have a PSTN number from ISP through Grandstream HT813 ATA and as a pjsip trunk. It currently works with incoming calls only. If I dial out from extension dedicated for this trunk, the call dials as that PSTN number but PBX jumps to the next pjsip trunk I have and uses it.

It also shows rejected status in the Asterisk Info module when I click on registries.

Here are some most notable packets flow from an sngrep utility:

2022/10/01 18:00:10.256519 10.100.20.2:5060 → 10.100.20.5:5060

REGISTER sip:10.100.20.5:5060 SIP/2.0

Via: SIP/2.0/UDP 10.100.20.2:5060;rport;branch=z9hG4bKPjb88e208a-67cc-484a-a3cf-01d2e443f7f7

From: <sip:My PSTN #@10.100.20.5>;tag=46784501-4b91-4fb1-b846-48ce0bad7d2b

To: <sip:My PSTN #@10.100.20.5>

Call-ID: 11d12f0e-47fe-4c86-895e-39c532e46910

CSeq: 52626 REGISTER

Contact: sip:[email protected]:5060;line=fqwchcb

Expires: 3600

Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER

Max-Forwards: 70

User-Agent: FPBX-15.0.23.25(13.38.3)

Content-Length:

2022/10/01 18:02:10.335524 10.100.20.5:5060 → 10.100.20.2:5060

SIP/2.0 405 Method Not Allowed

Via: SIP/2.0/UDP 10.100.20.2:5060;rport=5060;branch=z9hG4bKPj42fbb7f2-d48d-4899-b25e-c83f0e3d7a19

From: <sip:My PSTN #@10.100.20.5>;tag=b8862028-5aa3-4788-abcc-7ace5cec533c

To: <sip:My PSTN #@10.100.20.5>;tag=1881867613

Call-ID: 11d12f0e-47fe-4c86-895e-39c532e46910

CSeq: 52634 REGISTER

Supported: replaces, path, timer, eventlist

User-Agent: Grandstream HT813 1.0.13.3

Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE

Content-Length: 0

It persistently shows 405 Method Not Allowed, I’m not sure how to debug this.

My FreePBX IP is 10.100.20.2

ATA IP is 10.100.20.5

SIP port is 5060

Let me know what you think might be an issue with settings on both sides.

Thank you.

The HT813 (as well as similar devices such as HT503, SPA3000, SPA3102, OBi110, OBi212) is not a SIP registrar.

You can configure it statically (recommended for on-site PBX):
Trunk has Registration set to None and SIP Server set to 10.100.20.5 .
Device has SIP Registration set to No.

Or the device can register to the PBX (recommended for cloud PBX):
Trunk has Registration set to Receive.
Device has SIP Registration set to Yes.

There are likely other errors in the config. Set the trunk to Registration None. If outbound calls still fail, at the Asterisk command prompt, type
pjsip set logger on
make a failing call, paste the Asterisk log for the call at pastebin.freepbx.org and post the link here.

Hi Stewart,

It is set statically. The PBX is on-site.
The ATA has SIP registration set to - No
I set PBX trunk to Registration - None

Outbound still fails - I still see other paid per minute trunk active.

I will update with logged debug text.

Here is sample of the log with enabled asterisk -r then pjsip set logger on:

IP/2.0 200 OK
Via: SIP/2.0/UDP 10.100.20.6:5060;rport=5060;received=10.100.20.6;branch=z9hG4bK486077002
Call-ID: [email protected]
From: “200” sip:[email protected];tag=1865871944
To: <sip:My PSTN #@10.100.20.2>;tag=04601c09-5e89-4db2-8342-5c6a681d43e2
CSeq: 2 INVITE
Server: FPBX-15.0.23.25(13.38.3)
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Contact: sip:10.100.20.2:5060
Supported: 100rel, timer, replaces, norefersub
P-Asserted-Identity: “CID:4083375508” <sip:My PSTN #@10.100.20.2>
Content-Type: application/sdp
Content-Length: 273

v=0
o=- 20033 20035 IN IP4 10.100.20.2
s=Asterisk
c=IN IP4 10.100.20.2
t=0 0
m=audio 13838 RTP/AVP 0 8 9 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:9 G722/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<— Received SIP request (380 bytes) from UDP:10.100.20.6:5060 —>
ACK sip:10.100.20.2:5060 SIP/2.0
Via: SIP/2.0/UDP 10.100.20.6:5060;branch=z9hG4bK1302458956
From: “200” sip:[email protected];tag=1865871944
To: <sip:My PSTN #@10.100.20.2>;tag=04601c09-5e89-4db2-8342-5c6a681d43e2
Call-ID: [email protected]
CSeq: 2 ACK
Contact: sip:[email protected]:5060
Max-Forwards: 70
User-Agent: Yealink W60B 77.85.0.25
Content-Length: 0

<— Transmitting SIP request (440 bytes) to UDP:10.100.20.5:5060 —>
OPTIONS sip:My PSTN #@10.100.20.5:5060 SIP/2.0
Via: SIP/2.0/UDP 10.100.20.2:5060;rport;branch=z9hG4bKPj91f2a804-234e-425d-8bfc-30c5fd592bea
From: sip:[email protected];tag=0be78b5c-bcd4-4f4d-ada9-f70213c68c97
To: <sip:My PSTN #@10.100.20.5>
Contact: sip:[email protected]:5060
Call-ID: ba2ea137-5bff-4bb5-aa9a-7c2a24ff5fa4
CSeq: 58179 OPTIONS
Max-Forwards: 70
User-Agent: FPBX-15.0.23.25(13.38.3)
Content-Length: 0

<— Received SIP response (494 bytes) from UDP:10.100.20.5:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.100.20.2:5060;rport=5060;branch=z9hG4bKPj91f2a804-234e-425d-8bfc-30c5fd592bea
From: sip:[email protected];tag=0be78b5c-bcd4-4f4d-ada9-f70213c68c97
To: <sip:My PSTN #@10.100.20.5>;tag=647348211
Call-ID: ba2ea137-5bff-4bb5-aa9a-7c2a24ff5fa4
CSeq: 58179 OPTIONS
Supported: replaces, path, timer, eventlist
User-Agent: Grandstream HT813 1.0.13.3
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE
Content-Length: 0

<— Received SIP request (648 bytes) from UDP:10.100.20.6:5060 —>
BYE sip:10.100.20.2:5060 SIP/2.0
Via: SIP/2.0/UDP 10.100.20.6:5060;branch=z9hG4bK2644439629
From: “200” sip:[email protected];tag=1865871944
To: <sip:My PSTN #@10.100.20.2>;tag=04601c09-5e89-4db2-8342-5c6a681d43e2
Call-ID: [email protected]
CSeq: 3 BYE
Contact: sip:[email protected]:5060
Authorization: Digest username=“200”, realm=“asterisk”, nonce=“1664742935/da67e725a702ea52e873b794c1a1397c”, uri=“sip:10.100.20.2:5060”, response=“129360b4f4346b41a5b69fe3352099ab”, algorithm=MD5, cnonce=“2909205067”, opaque=“6ae766a02074a43d”, qop=auth, nc=00000002
Max-Forwards: 70
User-Agent: Yealink W60B 77.85.0.25
Content-Length: 0

<— Transmitting SIP response (337 bytes) to UDP:10.100.20.6:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.100.20.6:5060;rport=5060;received=10.100.20.6;branch=z9hG4bK2644439629
Call-ID: [email protected]
From: “200” sip:[email protected];tag=1865871944
To: <sip:My PSTN #@10.100.20.2>;tag=04601c09-5e89-4db2-8342-5c6a681d43e2
CSeq: 3 BYE
Server: FPBX-15.0.23.25(13.38.3)
Content-Length: 0

<— Transmitting SIP request (623 bytes) to UDP:192.76.120.10:5060 —>
BYE sip:My PSTN #@10.15.255.4:5070;transport=tcp SIP/2.0
Via: SIP/2.0/UDP 174.87.180.196:5060;rport;branch=z9hG4bKPja5120b28-441a-453c-bd4f-4d84e141083b
From: <sip:My PSTN #@10.100.20.2>;tag=ca7fea30-e11e-4b61-8129-1be818881ed5
To: <sip:My PSTN #@sip.telnyx.com>;tag=vapmFv4Frrc7e
Call-ID: 5741cc2c-5ac4-4fca-8f3d-6d9011dd23a5
CSeq: 21724 BYE
Route: sip:192.76.120.10;lr;r2=on;ftag=ca7fea30-e11e-4b61-8129-1be818881ed5
Route: sip:10.255.0.1;transport=tcp;lr;r2=on;ftag=ca7fea30-e11e-4b61-8129-1be818881ed5
Reason: Q.850;cause=16
Max-Forwards: 70
User-Agent: FPBX-15.0.23.25(13.38.3)
Content-Length: 0

<— Received SIP response (457 bytes) from UDP:192.76.120.10:5060 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 174.87.180.196:5060;received=174.87.180.196;rport=60335;branch=z9hG4bKPja5120b28-441a-453c-bd4f-4d84e141083b
From: <sip:My PSTN #@10.100.20.2>;tag=ca7fea30-e11e-4b61-8129-1be818881ed5
To: <sip:My PSTN #@sip.telnyx.com>;tag=vapmFv4Frrc7e
Call-ID: 5741cc2c-5ac4-4fca-8f3d-6d9011dd23a5
CSeq: 21724 BYE
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REFER, NOTIFY
Supported: path
Content-Length: 0

Note:
10.100.20.6 is base station IP.
Extension is 200.
PSTN is from Spectrum.

There are no failures, and no complete calls, in that log.

I felt that way, but how do I know when it’s complete, I ran it till I hanged the call?

You know that it is complete when you see both the first INVITE and the final OK with a a CSEQ reference BYE. You don’t have the first INVITE.

You know it has failed when you get a response with a CSEQ for INVITE that has a status code of, at least, 400. Status 200 is a success. If your problem is one way or no-way audio, you need to mention that and the direction of failure. We’ll probably ask for RTP debugging in that case.

I’m working on new logs grab and will put pastebin. The issue is with outgoing only, it refuses to use ATA and shifts call to next pjsip trunk.

Here is new log:

https://pastebin.freepbx.org/view/82dac500

  1. On Web UI of HT813, have you setup “Unconditional call forward to VoIP” correctly (Basic Settings → at the very bottom)?

  2. Have you tried both FXO and FXS setup as SIP instead of PJSIP to validate that it works? I have HT813 setup for my home and it works. I had big trouble making it work with PJSIP.

NS

There are no failures on that log, either, but you didn’t set the verbosity to show the dialplan execution. I assume it has decided to failover because it thinks the first choice is unavailable, and hasn’t actually tried to call it.

There was no attempt to use the HT trunk. Does it show as available? Are you also using the FXS port?

This looks strange:
OPTIONS sip:My PSTN #@10.100.20.5:5060 SIP/2.0

I would expect that you should have SIP Server Port for the trunk to 5062, matching the value of 5062 in Local SIP Port in the FXO Port settings. If you change Local SIP Port to 5060 (not recommended), you must also change the Local SIP Port for the FXS Port to something else, or disable the FXS port.

When you paste another log, please paste the Asterisk log for the call, not the console output. The Asterisk log file is /var/log/asterisk/full , or you can access it in the GUI at Reports → Asterisk Logfiles.

Confirmed unconditional call forward to PSTN and FPBX IP.

Haven’t tried via FXS. Don’t mind trunk via the SIP. Can you please share your trunk SIP setting in FPBX and ATA?

It’s FXO port.
It’s currently 5060 in FXO and in the trunk. Should I use 5062, I see it’s default port.
Let me see if can grab new log.

There is no problem using port 5060 for the FXO, provided that you don’t have a conflict with the FXS side.

Are you using the FXS side (as a extension, to connect an analog phone)? If not, there is no reason to mess with chan_sip; the pjsip setup is very simple. If you need both FXS and FXO, there are some tricks needed to make it work with pjsip.

Ok good.
Yes, don’t need both. I use only FXO. My use case is this: modem->ATA->LAN, then on FreePBX I have pjsip trunk and special extension.

The default port for the FXO in that model is 5062, 5060 is the default port for the FXS

Here is another log string taken from /var/log/asterisk/full file
Hope this is correct as I matched test call length.

https://pastebin.freepbx.org/view/770b18f9

The outbound call from extension 200 did not attempt to use the HT trunk at all and went straight to Telnyx.

[2022-10-02 20:35:17] VERBOSE[16635][C-00000016] pbx.c: Executing [Outgoing Cell #@from-internal:4] Set("PJSIP/200-0000002a", "_ROUTEID=5") in new stack
[2022-10-02 20:35:17] VERBOSE[16635][C-00000016] pbx.c: Executing [Outgoing Cell #@from-internal:5] Set("PJSIP/200-0000002a", "_ROUTENAME=Telnyx") in new stack
[2022-10-02 20:35:17] VERBOSE[16635][C-00000016] pbx.c: Executing [Outgoing Cell #@from-internal:6] Set("PJSIP/200-0000002a", "EMERGENCYROUTE=YES") in new stack

I believe that you have an Emergency Route defined above the route you intended to use, that somehow matched on the “Outgoing Cell #”. It is of course normal for emergency routes to be above regular routes, but it is not normal for them to match ordinary numbers. Typically, they would match 911, possibly 988, and any emergency test numbers such as 933 for Telnyx.

If you are sure that this isn’t the case, please post details (screenshots or descriptions) of your Outbound Routes.

Hi Stewart,

It’s the case that one route with emergency on is above. I attached picture how they currently stacked.
How do you recommend me to set this up?