Incoming calls not working in sip trunk

i have sip trunk it is working fine for outgoing calls but when i call back to same number again it is not responding so i turn on the logger i can find some logs like below can anyone help… thanks

<— Received SIP request (1360 bytes) from UDP:10.5.70.3:5060 —>
INVITE sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.5.70.3:5060;branch=z9hG4bK3479bf91e928d84e6dd795349982e87f65fb2b4e-0-22a301b9-665af78faf35a1f;aluscr
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK_0001_1717237647-183562-28650537-LucentPCSF
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665af78faf0a995-gm-pt-lucentPCSF-013119
To: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone
Max-Forwards: 68
Call-ID: LU-1717237647183541-13340737@i9.kka57.org
CSeq: 1 INVITE
P-Asserted-Identity: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone
Accept: application/sdp
Allow: INVITE,BYE,REGISTER,ACK,OPTIONS,CANCEL,SUBSCRIBE,NOTIFY,PRACK,INFO,REFER,UPDATE
Supported: histinfo,100rel
Content-Type: application/sdp
Contact: sip:lucentNGFS-025470@10.5.70.3:5060;x-afi=2
Content-Length: 378
History-Info: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone;index=1

v=0
o=LucentPCSF 2026386637 2026386637 IN IP4 i9.kka57.org
s=-
c=IN IP4 10.5.110.130
t=0 0
a=sendrecv
m=audio 9052 RTP/AVP 8 0 18 100 96
c=IN IP4 10.5.110.130
b=RR:3000
b=RS:1000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:100 AMR/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=ptime:20
a=maxptime:30

<— Transmitting SIP response (785 bytes) to UDP:10.5.70.3:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.5.70.3:5060;rport=5060;received=10.5.70.3;branch=z9hG4bK3479bf91e928d84e6dd795349982e87f65fb2b4e-0-22a301b9-665af78faf35a1f;aluscr
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK_0001_1717237647-183562-28650537-LucentPCSF
Call-ID: LU-1717237647183541-13340737@i9.kka57.org
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665af78faf0a995-gm-pt-lucentPCSF-013119
To: sip:+918042310210@ka.ims.airtel.in;user=phone;tag=z9hG4bK3479bf91e928d84e6dd795349982e87f65fb2b4e-0-22a301b9-665af78faf35a1f
CSeq: 1 INVITE
WWW-Authenticate: Digest realm=“asterisk”,nonce=“1717237647/d92eab250c46f78a725fd34ce7c21dec”,opaque=“07cd58096829440c”,algorithm=MD5,qop=“auth”
Server: Asterisk PBX 20.8.1
Content-Length: 0

<— Received SIP request (633 bytes) from UDP:10.5.70.3:5060 —>
ACK sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone SIP/2.0
Call-ID: LU-1717237647183541-13340737@i9.kka57.org
Via: SIP/2.0/UDP 10.5.70.3:5060;branch=z9hG4bK3479bf91e928d84e6dd795349982e87f65fb2b4e-0-22a301b9-665af78faf35a1f;aluscr
To: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone;tag=z9hG4bK3479bf91e928d84e6dd795349982e87f65fb2b4e-0-22a301b9-665af78faf35a1f
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665af78faf0a995-gm-pt-lucentPCSF-013119
CSeq: 1 ACK
Route: sip:+918042310210@10.41.244.218:5060;lr;transport=udp
Max-Forwards: 70
Content-Length: 0

The call has been matched to an endpoint that requires a “password”. If the log is complete, the sender had none to send, or the call didn’t match any endpoint.

You have not provided enough logging verbosity to distinguish between the two cases, and you have not provided your pjsip.conf configuration, to allow that to be checked against what was received. (If you are using chan_sip, please move to chan_pjsip, so people don’t have to debug an obsolete channel driver configuration.)

yes above is complete log and
Iam using pjsip.conf itself pls find my pjsip config below

[mytrunk-reg]
type = registration
contact_user = +918042310210
expiration = 3600
outbound_auth=airtel-auth
client_uri = sip:+918042310210@ka.ims.airtel.in
server_uri = sip:+918042310210@ka.ims.airtel.in

[airtel-auth]
type = auth
password = XXXXXX
username = +918042310210@ka.ims.airtel.in

[airtel-aor]
type = aor
contact = sip:+918042310210@ka.ims.airtel.in
maximum_expiration = 3600

[airtel-identify]
type = identify
endpoint = airtel-endpoint
match = XX.XX.XX.XX

[airtel-endpoint]
type = endpoint
context = inbound
disallow = all
allow = ulaw,alaw
rtp_symmetric = yes
force_rport = yes
transport=transport-udp
rewrite_contact = yes
from_domain = XX.XX.XX.XX
from_user=XXXXXXXXXXX
auth = airtel-auth
outbound_auth = airtel-auth
aors = airtel-aor
send_pai=yes

The request came from 10.5.70.3, but you expected it to come from XX.XX.XX.XX. If 10.5.70.3 is your router, disable SIP ALG in it.

Note that 10/8 addresses are private addresses.

ok where i need to modify in from_domain or in identify ?

identify.

However, you need to understand why it is happening, and, in particular, be sure that that address is only used for the “trunk”. If it is SIP ALG in your router, you should disable that, instead.

ok i changed like below but still not working and What is SIP ALG i don’t know that

[airtel-identify]
type = identify
endpoint = airtel-endpoint
match = 10.5.70.3

[airtel-endpoint]
type = endpoint
context = inbound
disallow = all
allow = ulaw,alaw
rtp_symmetric = yes
force_rport = yes
transport=transport-udp
rewrite_contact = yes
from_domain =ka.ims.airtel.in
from_user=+918042310210
auth = airtel-auth
outbound_auth = airtel-auth
aors = airtel-aor
send_pai=yes
inband_progress = yes
trust_id_inbound=yes

pjsip set logger on
PJSIP Logging enabled
<— Received SIP request (1364 bytes) from UDP:10.5.70.3:5060 —>
INVITE sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.5.70.3:5060;branch=z9hG4bKb0b92a1ea218610aae502127658cdd4c65fb2b4e-0-22aebdaf-665b130c3b5333a5;aluscr
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK_0001_1717244684-995214-28709764-LucentPCSF
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665b130c3b518ee9-gm-pt-lucentPCSF-158550
To: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone
Max-Forwards: 68
Call-ID: LU-1717244684995198-13366278@i9.kka57.org
CSeq: 1 INVITE
P-Asserted-Identity: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone
Accept: application/sdp
Allow: INVITE,BYE,REGISTER,ACK,OPTIONS,CANCEL,SUBSCRIBE,NOTIFY,PRACK,INFO,REFER,UPDATE
Supported: histinfo,100rel
Content-Type: application/sdp
Contact: sip:lucentNGFS-166900@10.5.70.3:5060;x-afi=27
Content-Length: 379
History-Info: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone;index=1

v=0
o=LucentPCSF 1683434697 1683434697 IN IP4 i9.kka57.org
s=-
c=IN IP4 10.5.110.146
t=0 0
a=sendrecv
m=audio 16972 RTP/AVP 8 0 18 100 96
c=IN IP4 10.5.110.146
b=RR:3000
b=RS:1000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:100 AMR/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=ptime:20
a=maxptime:30

<— Transmitting SIP response (788 bytes) to UDP:10.5.70.3:5060 —>
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.5.70.3:5060;rport=5060;received=10.5.70.3;branch=z9hG4bKb0b92a1ea218610aae502127658cdd4c65fb2b4e-0-22aebdaf-665b130c3b5333a5;aluscr
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK_0001_1717244684-995214-28709764-LucentPCSF
Call-ID: LU-1717244684995198-13366278@i9.kka57.org
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665b130c3b518ee9-gm-pt-lucentPCSF-158550
To: sip:+918042310210@ka.ims.airtel.in;user=phone;tag=z9hG4bKb0b92a1ea218610aae502127658cdd4c65fb2b4e-0-22aebdaf-665b130c3b5333a5
CSeq: 1 INVITE
WWW-Authenticate: Digest realm=“asterisk”,nonce=“1717244684/9c0e41e5084ca88615549e296ed2a3bc”,opaque=“0bbcf0ac16b11995”,algorithm=MD5,qop=“auth”
Server: Asterisk PBX 20.8.1
Content-Length: 0

<— Received SIP request (636 bytes) from UDP:10.5.70.3:5060 —>
ACK sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone SIP/2.0
Call-ID: LU-1717244684995198-13366278@i9.kka57.org
Via: SIP/2.0/UDP 10.5.70.3:5060;branch=z9hG4bKb0b92a1ea218610aae502127658cdd4c65fb2b4e-0-22aebdaf-665b130c3b5333a5;aluscr
To: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone;tag=z9hG4bKb0b92a1ea218610aae502127658cdd4c65fb2b4e-0-22aebdaf-665b130c3b5333a5
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665b130c3b518ee9-gm-pt-lucentPCSF-158550
CSeq: 1 ACK
Route: sip:+918042310210@10.41.244.218:5060;lr;transport=udp
Max-Forwards: 70
Content-Length: 0

You are asking them to authenticate themselves. That is something that ITSPs generally don’t do.

SIP ALG is SIP Application Level Gateway. It means the router tries to act a proxy, rather than simply passing the IP messages through.

ya david now the call reaches to server but when try to call to some number from the dialplan it says like below

-- Executing [+918042310210@inbound:1] NoOp("PJSIP/airtel-endpoint-00000005", "") in new stack
-- Executing [+918042310210@inbound:2] Set("PJSIP/airtel-endpoint-00000005", "CALLERID(num)=+918042310210") in new stack
-- Executing [+918042310210@inbound:3] Dial("PJSIP/airtel-endpoint-00000005", "PJSIP/+918618633071@airtel-endpoint,30") in new stack
-- Called PJSIP/+918618633071@airtel-endpoint

== Everyone is busy/congested at this time (1:0/0/1)
– Executing [+918042310210@inbound:4] Hangup(“PJSIP/airtel-endpoint-00000005”, “”) in new stack

Your first posting says it works for outbound calls. None of the changes should affect that.

You haven’t provided verbose logging, and you haven’t provided the full contents of the rejection, but 0/0/1 means unavailable, which could include forbidden.

yes david it is working fine for outbound before i post the issue but now it not working after the changes i tested multiple calls it was working but now not working can u pls help me out … below is my updated config

mytrunk-reg]
type = registration
contact_user = +918042310210
expiration = 3600
outbound_auth=airtel-auth
client_uri = sip:+918042310210@ka.ims.airtel.in
server_uri = sip:+918042310210@ka.ims.airtel.in
;server_uri = sip:10.5.70.3

[airtel-auth]
type = auth
password = Wrktop#1
username = +918042310210@ka.ims.airtel.in

[airtel-aor]
type = aor
contact = sip:+918042310210@ka.ims.airtel.in
maximum_expiration = 3600

[airtel-identify]
type = identify
endpoint = airtel-endpoint
match = 10.5.70.3

[airtel-endpoint]
type = endpoint
context = inbound
disallow = all
allow = ulaw,alaw
rtp_symmetric = yes
force_rport = yes
transport=transport-udp
rewrite_contact = yes
from_domain = ka.ims.airtel.in
from_user=+918042310210
;auth = airtel-auth
outbound_auth = airtel-auth
aors = airtel-aor
send_pai=yes
inband_progress = yes
trust_id_inbound=yes

See logging requirements. Both auth= and match= only affect incoming calls.

They may have marked your account as down because of repeated incoming call failures.

PJSIP Logging enabled
<— Received SIP request (1363 bytes) from UDP:10.5.70.3:5060 —>
INVITE sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone SIP/2.0
Via: SIP/2.0/UDP 10.5.70.3:5060;branch=z9hG4bK605f7590ac3d467c936fe5edb29862cf65fb2b4e-0-22b32d45-665b1d743ad21d5e;aluscr
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK_0001_1717247348-986725-28725428-LucentPCSF
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665b1d743acffb3e-gm-pt-lucentPCSF-025078
To: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone
Max-Forwards: 68
Call-ID: LU-1717247348986706-13371561@i9.kka57.org
CSeq: 1 INVITE
P-Asserted-Identity: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone
Accept: application/sdp
Allow: INVITE,BYE,REGISTER,ACK,OPTIONS,CANCEL,SUBSCRIBE,NOTIFY,PRACK,INFO,REFER,UPDATE
Supported: histinfo,100rel
Content-Type: application/sdp
Contact: sip:lucentNGFS-105021@10.5.70.3:5060;x-afi=6
Content-Length: 379
History-Info: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone;index=1

v=0
o=LucentPCSF 1032774978 1032774978 IN IP4 i9.kka57.org
s=-
c=IN IP4 10.5.110.130
t=0 0
a=sendrecv
m=audio 40080 RTP/AVP 8 0 18 100 96
c=IN IP4 10.5.110.130
b=RR:3000
b=RS:1000
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=yes
a=rtpmap:100 AMR/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-15
a=ptime:20
a=maxptime:30

<— Transmitting SIP response (556 bytes) to UDP:10.5.70.3:5060 —>
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.5.70.3:5060;rport=5060;received=10.5.70.3;branch=z9hG4bK605f7590ac3d467c936fe5edb29862cf65fb2b4e-0-22b32d45-665b1d743ad21d5e;aluscr
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK_0001_1717247348-986725-28725428-LucentPCSF
Call-ID: LU-1717247348986706-13371561@i9.kka57.org
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665b1d743acffb3e-gm-pt-lucentPCSF-025078
To: sip:+918042310210@ka.ims.airtel.in;user=phone
CSeq: 1 INVITE
Server: Asterisk PBX 20.8.1
Content-Length: 0

-- Executing [+918042310210@inbound:1] NoOp("PJSIP/airtel-endpoint-00000007", "") in new stack
-- Executing [+918042310210@inbound:2] Dial("PJSIP/airtel-endpoint-00000007", "PJSIP/+918618633071@airtel-endpoint,30") in new stack
-- Called PJSIP/+918618633071@airtel-endpoint

<— Transmitting SIP request (1039 bytes) to UDP:10.5.70.3:5060 —>
INVITE sip:+918618633071@ka.ims.airtel.in SIP/2.0
Via: SIP/2.0/UDP 10.41.244.218:5060;rport;branch=z9hG4bKPjca0f9101-c675-4a93-9195-1f3c26b27d46
From: sip:+918042310210@ka.ims.airtel.in;tag=89f145be-959e-4a82-9dbf-eff842e5ab45
To: sip:+918618633071@ka.ims.airtel.in
Contact: sip:+918042310210@10.41.244.218:5060
Call-ID: 2d6c2b9d-706d-48fe-ae3e-a3132e4e8584
CSeq: 17208 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, INFO, REFER, MESSAGE
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
P-Asserted-Identity: “Unavailable” sip:+919036383353@ka.ims.airtel.in
Max-Forwards: 70
User-Agent: Asterisk PBX 20.8.1
Content-Type: application/sdp
Content-Length: 259

v=0
o=- 77226749 77226749 IN IP4 10.41.244.218
s=Asterisk
c=IN IP4 10.41.244.218
t=0 0
m=audio 26878 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:140
a=sendrecv

<— Received SIP response (396 bytes) from UDP:10.5.70.3:5060 —>
SIP/2.0 100 Trying
Call-ID: 2d6c2b9d-706d-48fe-ae3e-a3132e4e8584
Via: SIP/2.0/UDP 10.41.244.218:5060;received=10.41.244.218;branch=z9hG4bKPjca0f9101-c675-4a93-9195-1f3c26b27d46;rport=5060
To: sip:+918618633071@ka.ims.airtel.in
From: sip:+918042310210@ka.ims.airtel.in;tag=89f145be-959e-4a82-9dbf-eff842e5ab45
CSeq: 17208 INVITE
Date: Sat, 01 Jun 2024 13:09:09 GMT
Content-Length: 0

<— Received SIP response (431 bytes) from UDP:10.5.70.3:5060 —>
SIP/2.0 487 Request Terminated - 4023
Via: SIP/2.0/UDP 10.41.244.218:5060;received=10.41.244.218;branch=z9hG4bKPjca0f9101-c675-4a93-9195-1f3c26b27d46;rport=5060
From: sip:+918042310210@ka.ims.airtel.in;tag=89f145be-959e-4a82-9dbf-eff842e5ab45
To: sip:+918618633071@ka.ims.airtel.in;tag=65fb2b4e-665b1d75813a20f-gm-po-lucentPCSF-098086
Call-ID: 2d6c2b9d-706d-48fe-ae3e-a3132e4e8584
CSeq: 17208 INVITE
Content-Length: 0

<— Transmitting SIP request (461 bytes) to UDP:10.5.70.3:5060 —>
ACK sip:+918618633071@ka.ims.airtel.in SIP/2.0
Via: SIP/2.0/UDP 10.41.244.218:5060;rport;branch=z9hG4bKPjca0f9101-c675-4a93-9195-1f3c26b27d46
From: sip:+918042310210@ka.ims.airtel.in;tag=89f145be-959e-4a82-9dbf-eff842e5ab45
To: sip:+918618633071@ka.ims.airtel.in;tag=65fb2b4e-665b1d75813a20f-gm-po-lucentPCSF-098086
Call-ID: 2d6c2b9d-706d-48fe-ae3e-a3132e4e8584
CSeq: 17208 ACK
Max-Forwards: 70
User-Agent: Asterisk PBX 20.8.1
Content-Length: 0

== Everyone is busy/congested at this time (1:0/0/1)
– Executing [+918042310210@inbound:3] Hangup(“PJSIP/airtel-endpoint-00000007”, “”) in new stack
== Spawn extension (inbound, +918042310210, 3) exited non-zero on ‘PJSIP/airtel-endpoint-00000007’
<— Transmitting SIP response (707 bytes) to UDP:10.5.70.3:5060 —>
SIP/2.0 500 Server Internal Error
Via: SIP/2.0/UDP 10.5.70.3:5060;rport=5060;received=10.5.70.3;branch=z9hG4bK605f7590ac3d467c936fe5edb29862cf65fb2b4e-0-22b32d45-665b1d743ad21d5e;aluscr
Via: SIP/2.0/UDP 127.0.0.1;branch=z9hG4bK_0001_1717247348-986725-28725428-LucentPCSF
Call-ID: LU-1717247348986706-13371561@i9.kka57.org
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665b1d743acffb3e-gm-pt-lucentPCSF-025078
To: sip:+918042310210@ka.ims.airtel.in;user=phone;tag=410a43b3-fa2d-4bcb-b918-2349bf5bf6fb
CSeq: 1 INVITE
Server: Asterisk PBX 20.8.1
Reason: Q.850;cause=127
P-Asserted-Identity: sip:+918042310210@ka.ims.airtel.in;user=phone
Content-Length: 0

<— Received SIP request (585 bytes) from UDP:10.5.70.3:5060 —>
ACK sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone SIP/2.0
Call-ID: LU-1717247348986706-13371561@i9.kka57.org
Via: SIP/2.0/UDP 10.5.70.3:5060;branch=z9hG4bK605f7590ac3d467c936fe5edb29862cf65fb2b4e-0-22b32d45-665b1d743ad21d5e;aluscr
To: sip:+918042310210@ka.ims.airtel.in;transport=udp;user=phone;tag=410a43b3-fa2d-4bcb-b918-2349bf5bf6fb
From: “Unavailable” sip:+919036383353@ka.ims.airtel.in;user=phone;tag=65fb2b4e-665b1d743acffb3e-gm-pt-lucentPCSF-025078
CSeq: 1 ACK
Route: sip:s@10.41.244.218:5060;lr;transport=udp
Max-Forwards: 70
Content-Length: 0

they didn’t mark as down because we connected directly to microsip softphhone and made calls it is working fine

You have screen scraped the logs, rather than using the full log file, so there is no timing information. However the ITSP appears to have committed a protocol violation. There are only two reasons for sending 487, either you sent CANCEL, which isn’t shown as having happened, and would only happen, if the incoming call ended, or the Dial timeout was reached, or you sent an Expires header, and that had expired, however you didn’t send an Expires header.

You will need to check how long it took from the INVITE to the 487, and ask them what the 4023 means, and why they issued 487 without a valid triggering event.

ok david i will check with provider thanks for the support

@dhanunjaya I encountered the 487 Request Terminated - 4023 issue with Nokia IMS a few days ago. We were receiving immediate 487 releases from the SBC. They have since made some changes on their end to resolve the problem.

@Inderjeet01 thank you i will check with them …

now working fine @david551 @Inderjeet01 thanks for support

i removed auth = airtel-auth from endpoint and then plugout and plugin the provider connection