Incoming calls getting rejected by Asterisk, also can't create channel to endpoint

Hello everyone,
I’m having a problem in our Asterisk PBX. It’s been some days that we are not able to receive calls on one of our identities. Specifically, we have two Patton gateways that convert ISDN to VoIP and FXO to VoIP respectively. The issue is on the line managed by the former, but the call does get routed and it does get to our PBX. What’s weird is that I’m not getting any logs in the CLI when carrying out a test call. This is a PJSIP trace done on Asterisk:

<--- Received SIP request (825 bytes) from UDP:172.16.1.235:5060 --->
INVITE sip:01119703XXX@172.16.1.232 SIP/2.0
Via: SIP/2.0/UDP 172.16.1.235:5060;branch=z9hG4bK49c7493fd47482ca6
Max-Forwards: 70
From: <sip:3357897XXX@172.16.1.235:5060>;tag=283c5a25d2
To: <sip:01119703XXX@172.16.1.232>
Call-ID: 7635a29c22b106eb
CSeq: 12767 INVITE
Contact: <sip:3357897XXX@172.16.1.235:5060;transport=udp>
P-Preferred-Identity: <sip:3357897XXX@172.16.1.235:5060>
Supported: replaces
User-Agent: Patton SN4120 1BIS2V 00A0BA0A8DB4 R6.3 2013-05-01 H323 SIP M5T SIP Stack/4.1.12.18
Content-Type: application/sdp
Content-Length: 266

v=0
o=MxSIP 0 10 IN IP4 172.16.1.235
s=SIP Call
c=IN IP4 172.16.1.235
t=0 0
m=audio 4872 RTP/AVP 8 0 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=fmtp:101 0-16
a=sendrecv


<--- Transmitting SIP response (502 bytes) to UDP:172.16.1.235:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.16.1.235:5060;rport=5060;received=172.16.1.235;branch=z9hG4bK6492fa6cb4cfdada2
Call-ID: 5af36d7c697963f7
From: <sip:3357897XXX@172.16.1.235>;tag=33519a6a04
To: <sip:01119703XXX@172.16.1.232>;tag=z9hG4bK6492fa6cb4cfdada2
CSeq: 9084 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1655115561/8e1264ccd32abf6bdbe3afafe8b8b961",opaque="5c9849467db945e2",algorithm=md5,qop="auth"
Server: Asterisk PBX certified/16.8-cert14
Content-Length:  0


<--- Received SIP request (410 bytes) from UDP:172.16.1.235:5060 --->
ACK sip:01119703XXX@172.16.1.232 SIP/2.0
Via: SIP/2.0/UDP 172.16.1.235:5060;branch=z9hG4bK6492fa6cb4cfdada2
Max-Forwards: 70
From: <sip:3357897XXX@172.16.1.235:5060>;tag=33519a6a04
To: <sip:01119703XXX@172.16.1.232>;tag=z9hG4bK6492fa6cb4cfdada2
Call-ID: 5af36d7c697963f7
CSeq: 9084 ACK
User-Agent: Patton SN4120 1BIS2V 00A0BA0A8DB4 R6.3 2013-05-01 H323 SIP M5T SIP Stack/4.1.12.18
Content-Length: 0




The patton cfg is the same as it was last week where the problem was not there; asterisk’s cfg didn’t change aswell. Another full VoIP trunk we have works flawlessly, and another FXO line we have is good aswell, both of them work for both incoming and outgoing calls.

The line that’s problematic is not working for outbound calls either, but in this case I have some logs:

== Setting global variable 'SIPDOMAIN' to '172.16.1.232'
    -- Executing [3388821XXX@int:1] Set("PJSIP/201-00000016", "CALLERID(number)=011197038XX") in new stack
    -- Executing [3388821XXX@int:2] Dial("PJSIP/201-00000016", "PJSIP/3388821XXX@10005") in new stack
[Jun 13 12:30:37] ERROR[9020]: res_pjsip.c:3534 ast_sip_create_dialog_uac: Endpoint '10005': Could not create dialog to invalid URI '10005'.  Is endpoint registered and reachable?
[Jun 13 12:30:37] ERROR[9020]: chan_pjsip.c:2679 request: Failed to create outgoing session to endpoint '10005'
[Jun 13 12:30:37] WARNING[11033][C-00000010]: app_dial.c:2576 dial_exec_full: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)
    -- No devices or endpoints to dial (technology/resource)
    -- Executing [3388821XXX@int:3] Congestion("PJSIP/201-00000016", "") in new stack
  == Spawn extension (int, 3388821XXX, 3) exited non-zero on 'PJSIP/201-00000016'

The patton is correctly registered on Asterisk with its two identities (10001, 10002) and the other patton aswell (10004, 10005).

You’d need to provide the PJSIP configuration and describe how it’s supposed to work. As it is the given incoming call is being challenged for authentication, at which point it’s up to the remote side to send the INVITE again with credentials.

Sure,
Patton01: ISDN interface, registers correctly to Asterisk through identities 10001 and 10002. SP says that the calls are being routed correctly to our port. In fact, Asterisk sees something when making a test call, but only when displaying a sip trace. I can’t get any CLI logs when trying to test for incoming calls.
This is the cfg:

[10001](endpoint-10x)
auth = 10001
outbound_auth = 10001
aors = 10001
context = incoming

[10001]
type = aor
max_contacts = 1
default_expiration = 180

[10001]
type = auth
username = 10001
password = password_for_10001

[10001]
type = identify
endpoint = 10001
match = 172.16.1.235:5060  ; IP Patton01

;========================================================

[10002](endpoint-10x)
auth = 10002
outbound_auth = 10002
aors = 10002
context = incoming

[10002]
type = aor
max_contacts = 1
default_expiration = 180

[10002]
type = auth
username = 10002
password = password_for_10002

[10002]
type = identify
endpoint = 10002
match = 172.16.1.235:5061  ; IP Patton01

Asterisk is challenging for authentication, which it is doing as you’ve configured the endpoint to do so (the auth option is set). Unless you’ve trimmed the log, the Patton is not sending the call again with credentials and thus it fails. If it should not authenticate then the auth option should not be set.

If you are using a certified version, you shouldn’t be using this forum. Certified versions are for people with service contracts with Sangoma. Open source users should be using the most recent version.

The sip trace is not trimmed.I can’t find anything in the patton cfg related to the behaviour you just pointed out. Actually we were experimenting with fail2ban on this PBX recently, but I made sure to uninstall everything before these tests I’m making. It’s weird because the other patton does not have any problems whatsoever, even though it has a different interface (FXO vs ISDN)…
Anyways, I switched on the previous PBX we had until last month, with a different version of Asterisk that made use of chan_sip instead of res_pjsip, and everything works again, even the “problematic” ISDN patton. I can’t keep that old machine up though, I have to migrate the PBX to the new machine with res_pjsip.
I just wanted to make a quick test, this is the SIP trace of what happens in the old PBX with chan_sip (Patton’s IP is 172.16.1.235):

<--- SIP read from UDP:172.16.1.235:5060 --->
INVITE sip:01119703XXX@172.16.1.233 SIP/2.0
Via: SIP/2.0/UDP 172.16.1.235:5060;branch=z9hG4bK510a13fb59aa132d1
Max-Forwards: 70
From: <sip:3357897XXX@172.16.1.235:5060>;tag=4d00fb63e2
To: <sip:01119703XXX@172.16.1.233>
Call-ID: 5c25d9d83564e7d9
CSeq: 4086 INVITE
Contact: <sip:3357897XXX@172.16.1.235:5060;transport=udp>
P-Preferred-Identity: <sip:3357897XXX@172.16.1.235:5060>
Supported: replaces
User-Agent: Patton SN4120 1BIS2V 00A0BA0A8DB4 R6.3 2013-05-01 H323 SIP M5T SIP Stack/4.1.12.18
Content-Type: application/sdp
Content-Length: 265

v=0
o=MxSIP 0 6 IN IP4 172.16.1.235
s=SIP Call
c=IN IP4 172.16.1.235
t=0 0
m=audio 4868 RTP/AVP 8 0 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=fmtp:101 0-16
a=sendrecv
<------------->
--- (13 headers 13 lines) ---
Sending to 172.16.1.235:5060 (NAT)
Sending to 172.16.1.235:5060 (NAT)
Using INVITE request as basis request - 5c25d9d83564e7d9
Found peer '10001' for '3357897XXX' from 172.16.1.235:5060
  == Using SIP RTP CoS mark 5
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 18
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format G729 for ID 18
Found audio description format telephone-event for ID 101
Capabilities: us - (alaw|ulaw), peer - audio=(ulaw|alaw|g729)/video=(nothing)/text=(nothing), combined - (alaw|ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
       > 0x7f5fb8017e00 -- Strict RTP learning after remote address set to: 172.16.1.235:4868
Peer audio RTP is at port 172.16.1.235:4868
Looking for 01119703XXX in incoming (domain 172.16.1.233)
sip_route_dump: route/path hop: <sip:3357897XXX@172.16.1.235:5060;transport=udp>

<--- Transmitting (NAT) to 172.16.1.235:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 172.16.1.235:5060;branch=z9hG4bK510a13fb59aa132d1;received=172.16.1.235;rport=5060
From: <sip:3357897XXX@172.16.1.235:5060>;tag=4d00fb63e2
To: <sip:01119703XXX@172.16.1.233>
Call-ID: 5c25d9d83564e7d9
CSeq: 4086 INVITE
Server: Asterisk PBX 13.17.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:01119703XXX@172.16.1.233:5060>
Content-Length: 0


<------------>
    -- Executing [01119703XXX@incoming:1] Set("SIP/10001-0000000a", "FROM_DID=01119703XXX") in new stack
    -- Executing [01119703XXX@incoming:2] Set("SIP/10001-0000000a", "CALLERID(name)=MA 3357897XXX") in new stack
    -- Executing [01119703XXX@incoming:3] Dial("SIP/10001-0000000a", "SIP/801,60,tTr") in new stack
  == Using SIP RTP CoS mark 5
Audio is at 15722
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 172.16.1.234:5060:
INVITE sip:801@172.16.1.234:5060 SIP/2.0
Via: SIP/2.0/UDP 172.16.1.233:5060;branch=z9hG4bK3b8cc2db;rport
Max-Forwards: 70
From: "MA 3357897XXX" <sip:3357897XXX@172.16.1.233>;tag=as6417c866
To: <sip:801@172.16.1.234:5060>
Contact: <sip:3357897XXX@172.16.1.233:5060>
Call-ID: 39819aa16278ccb827ccc8811c91446b@172.16.1.233:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 13.17.2
Date: Tue, 14 Jun 2022 12:44:11 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 274

v=0
o=root 137388565 137388565 IN IP4 172.16.1.233
s=Asterisk PBX 13.17.2
c=IN IP4 172.16.1.233
t=0 0
m=audio 15722 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
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/801

<--- Transmitting (NAT) to 172.16.1.235:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 172.16.1.235:5060;branch=z9hG4bK510a13fb59aa132d1;received=172.16.1.235;rport=5060
From: <sip:3357897XXX@172.16.1.235:5060>;tag=4d00fb63e2
To: <sip:01119703XXX@172.16.1.233>;tag=as0be3785c
Call-ID: 5c25d9d83564e7d9
CSeq: 4086 INVITE
Server: Asterisk PBX 13.17.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:01119703XXX@172.16.1.233:5060>
Content-Length: 0


<------------>

<--- SIP read from UDP:172.16.1.234:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 172.16.1.233:5060;branch=z9hG4bK3b8cc2db;rport=5060
From: "MA 3357897XXX" <sip:3357897XXX@172.16.1.233>;tag=as6417c866
To: <sip:801@172.16.1.234:5060>
Call-ID: 39819aa16278ccb827ccc8811c91446b@172.16.1.233:5060
CSeq: 102 INVITE
Supported: replaces, path, timer, eventlist
User-Agent: Grandstream HT802 1.0.3.7
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---

<--- SIP read from UDP:172.16.1.234:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 172.16.1.233:5060;branch=z9hG4bK3b8cc2db;rport=5060
From: "MA 3357897XXX" <sip:3357897XXX@172.16.1.233>;tag=as6417c866
To: <sip:801@172.16.1.234:5060>;tag=1348042945
Call-ID: 39819aa16278ccb827ccc8811c91446b@172.16.1.233:5060
CSeq: 102 INVITE
Contact: <sip:801@172.16.1.234:5060>
Supported: replaces, path, timer, eventlist
User-Agent: Grandstream HT802 1.0.3.7
Allow-Events: talk, hold
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE
Content-Length: 0

<------------->
--- (12 headers 0 lines) ---
sip_route_dump: route/path hop: <sip:801@172.16.1.234:5060>
    -- SIP/801-0000000b is ringing

<--- Transmitting (NAT) to 172.16.1.235:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 172.16.1.235:5060;branch=z9hG4bK510a13fb59aa132d1;received=172.16.1.235;rport=5060
From: <sip:3357897XXX@172.16.1.235:5060>;tag=4d00fb63e2
To: <sip:01119703XXX@172.16.1.233>;tag=as0be3785c
Call-ID: 5c25d9d83564e7d9
CSeq: 4086 INVITE
Server: Asterisk PBX 13.17.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:01119703XXX@172.16.1.233:5060>
Content-Length: 0


<------------>

<--- SIP read from UDP:172.16.0.109:5060 --->
REGISTER sip:MA SIP/2.0
Via: SIP/2.0/UDP 172.16.0.109:5060;branch=z9hG4bKa11c4f4fc5628cc539d49ddba1e755d6;rport
From: "202" <sip:202@MA>;tag=1167122267
To: "202" <sip:202@MA>
Call-ID: 3129382509@172_16_0_109
CSeq: 321 REGISTER
Contact: <sip:202@172.16.0.109:5060>
Max-Forwards: 70
User-Agent: C610 IP/42.243.00.000.000
Expires: 180
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, SUBSCRIBE, NOTIFY, REFER, UPDATE
Content-Length: 0

<------------->
--- (12 headers 0 lines) ---
Sending to 172.16.0.109:5060 (NAT)
Sending to 172.16.0.109:5060 (NAT)

<--- Transmitting (NAT) to 172.16.0.109:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 172.16.0.109:5060;branch=z9hG4bKa11c4f4fc5628cc539d49ddba1e755d6;received=172.16.0.109;rport=5060
From: "202" <sip:202@MA>;tag=1167122267
To: "202" <sip:202@MA>;tag=as47fccc35
Call-ID: 3129382509@172_16_0_109
CSeq: 321 REGISTER
Server: Asterisk PBX 13.17.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="31b51db9"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '3129382509@172_16_0_109' in 32000 ms (Method: REGISTER)

<--- SIP read from UDP:172.16.0.109:5060 --->
REGISTER sip:MA SIP/2.0
Via: SIP/2.0/UDP 172.16.0.109:5060;branch=z9hG4bKf5e99562eef17486c354e84b76c5f5e9;rport
From: "202" <sip:202@MA>;tag=1167122267
To: "202" <sip:202@MA>
Call-ID: 3129382509@172_16_0_109
CSeq: 322 REGISTER
Contact: <sip:202@172.16.0.109:5060>
Authorization: Digest username="202", realm="asterisk", algorithm=MD5, uri="sip:MA", nonce="31b51db9", response="7e5edf7d3f778a5d086182980f3dc444"
Max-Forwards: 70
User-Agent: C610 IP/42.243.00.000.000
Expires: 180
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, SUBSCRIBE, NOTIFY, REFER, UPDATE
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Sending to 172.16.0.109:5060 (NAT)
Reliably Transmitting (NAT) to 172.16.0.109:5060:
OPTIONS sip:202@172.16.0.109:5060 SIP/2.0
Via: SIP/2.0/UDP 172.16.1.233:5060;branch=z9hG4bK283bfacb;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk@172.16.1.233>;tag=as70828cd0
To: <sip:202@172.16.0.109:5060>
Contact: <sip:asterisk@172.16.1.233:5060>
Call-ID: 3c6fe8d867c1aa6f41f7126522906a83@172.16.1.233:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.17.2
Date: Tue, 14 Jun 2022 12:44:12 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- Transmitting (NAT) to 172.16.0.109:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.16.0.109:5060;branch=z9hG4bKf5e99562eef17486c354e84b76c5f5e9;received=172.16.0.109;rport=5060
From: "202" <sip:202@MA>;tag=1167122267
To: "202" <sip:202@MA>;tag=as47fccc35
Call-ID: 3129382509@172_16_0_109
CSeq: 322 REGISTER
Server: Asterisk PBX 13.17.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 180
Contact: <sip:202@172.16.0.109:5060>;expires=180
Date: Tue, 14 Jun 2022 12:44:12 GMT
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '3129382509@172_16_0_109' in 32000 ms (Method: REGISTER)
Retransmitting #4 (NAT) to 94.32.130.112:5060:
OPTIONS sip:ims.tiscali.net SIP/2.0
Via: SIP/2.0/UDP 188.218.155.110:5060;branch=z9hG4bK4552c32c;rport
Max-Forwards: 70
From: "asterisk" <sip:00390115849478@188.218.155.110>;tag=as356e31c2
To: <sip:ims.tiscali.net>
Contact: <sip:00390115849478@188.218.155.110:5060>
Call-ID: 1d5d184f269d659a471aa3340da481b8@188.218.155.110:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 13.17.2
Date: Tue, 14 Jun 2022 12:44:08 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---
Really destroying SIP dialog '1d5d184f269d659a471aa3340da481b8@188.218.155.110:5060' Method: OPTIONS

<--- SIP read from UDP:172.16.0.109:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.16.1.233:5060;branch=z9hG4bK283bfacb;rport=5060
From: "asterisk" <sip:asterisk@172.16.1.233>;tag=as70828cd0
To: <sip:202@172.16.0.109:5060>;tag=ar61939be1
Call-ID: 3c6fe8d867c1aa6f41f7126522906a83@172.16.1.233:5060
CSeq: 102 OPTIONS
Supported: replaces
User-Agent: C610 IP/42.243.00.000.000
Allow: INVITE, ACK, CANCEL, BYE, OPTIONS, INFO, SUBSCRIBE, NOTIFY, REFER, UPDATE
Accept: application/sdp, application/dtmf-relay, message/sipfrag, application/simple-message-summary, application/url, multipart/mixed
Accept-Encoding: identity
Accept-Language: en
Content-Length: 0

<------------->
--- (13 headers 0 lines) ---
Really destroying SIP dialog '3c6fe8d867c1aa6f41f7126522906a83@172.16.1.233:5060' Method: OPTIONS
Really destroying SIP dialog 'a4dfb8819c52d0475f29c608b321d3fc@0:0:0:0:0:0:0:0' Method: OPTIONS
  == Manager 'fop2' logged on from 127.0.0.1
  == Manager 'fop2' logged off from 127.0.0.1
voiptop1*CLI> sip set debug off
SIP Debugging Disabled
  == Spawn extension (incoming, 01119703XXX, 3) exited non-zero on 'SIP/10001-0000000a'

That log shows no authentication happening. If that is the case, then my previous response stands of how to configure PJSIP to not challenge for authentication.

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