PJSIP Trunk incoming call SIP/2.0 401 Unauthorized

Have moved a chan_sip Asterik, to pjsip, and our trunk connection to a SIP PBX for incoming calls get dropped.

NOTICE[7010]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request ‘INVITE’ from ‘“AL-PI” sip:932240844@172.30.1.2;user=phone’ failed for ‘10.200.6.202:5060’ (callid: ec4869e4e334cc704b2a62c8cba9d796@10.200.6.202) - No matching endpoint found

have done these minimal setup

[oxe]
type=endpoint
transport=0.0.0.0-udp
context=from-pstn
disallow=all
allow=ulaw,alaw
aors=oxe
send_connected_line=false
language=es
outbound_auth=oxe
from_domain=10.200.6.202
t38_udptl=yes
t38_udptl_ec=none
fax_detect=yes
trust_id_inbound=yes
t38_udptl_nat=yes
send_rpid=yes
direct_media=no
rewrite_contact=yes
rtp_symmetric=yes
dtmf_mode=auto

[oxe]
type=aor
contact=sip:10.200.6.202:5060
contact=sip:10.200.6.203:5060

[oxe]
type=identify
endpoint=oxe
match=10.200.6.202

Any clue?

You need to authenticate the incoming INVITE request based on the ip or username, or
a more insecure method is allow anonymous

I don’t believe there is any requirement to authenticate. In any case it isn’t getting that far, as the identify seems to be failing.

The subject, here, is confusing, as 401 is not an error, and there is no mention of it in the body of the question.

I know 401 Unauthorized is not an error, but
having

type=identify
endpoint=oxe
match=10.200.6.202

with a direct match by ip should let the call come in?

Is very usual have trunks that don’t have to auth on our systems, like with the old
insecure=invite

Have tried following the tips at

https://wiki.asterisk.org/wiki/display/AST/Migrating+from+chan_sip+to+res_pjsip#Migratingfromchan_siptores_pjsip-ExampleSIPTrunkConfiguration

Missatge de david551 via Asterisk Community <asterisk@discoursemail.com> del dia ds., 14 de nov. 2020 a les 21:01:

Have you examined the output of res_pjsip at startup to make sure your endpoint does not have an error? Does it show in “pjsip show endpoints”?

Make sure the endpoint exist because some error on pjsip config file creating this endpoint could prevent it to exist, and is valid reason to not authenticate your INVITE request

i saw the endpoints but can’t check for the identify, you are right.

Got some module not compiled and my sorcery.conf was broken using realtime + conf.
Checked and compiled everything again.

Now i got the identify and calls get in.

Thansk

Missatge de jcolp via Asterisk Community <asterisk@discoursemail.com> del dia dg., 15 de nov. 2020 a les 0:03: