I have three servers. Two of them are at a data center providing SIP trunking to the third. One is running Asterisk 13 with chan_sip and the other Asterisk 16 with chan_pjsip.
The third is at an offsite location, and it registers with both of the other two. It’s also running Asterisk 13 with chan_sip. Outbound calls go to the Asterisk 13 server, and inbound calls come from the Asterisk 16 server. All is well here.
I want to eliminate the Asterisk 13 server at the data center from the mix, so that the Asterisk 16 server provides outbound calling as well. However, when I try to direct calls from the offsite location to the Asterisk 16 server, it fails. The trunk configurations on the offsite server for the two are identical, with the exception of the host= parameter of course. A successful outbound call to the Asterisk 13 server, with SIP debugging set ON shows an “INVITE” followed by a “100 Trying” response. The same “INVITE” sent to the Asterisk 16 server returns “401 Unauthorized” even though the INVITE packet contained the authorization details. The logs on the Asterisk 16 server show the following:
[2022-09-20 20:27:43] NOTICE res_pjsip/pjsip_distributor.c: Request ‘INVITE’ from ‘“” <sip:@10.1.50.2>’ failed for ‘:52818’ (callid: email@example.com:0) - Failed to authenticate
But the trunk does register and authenticate properly (again, calls in the other direction through this server work). The only thing I can think of is that my PJSIP endpoint definition on the Asterisk 16 server is not effectively the same as my SIP peer definition on the Asterisk 13 server. However, I have very little experience with PJSIP so I’m not sure how to go about troubleshooting this.
What should I be looking at to troubleshoot this? Or, what information can I post here that would be helpful in identifying the issue?