PJSIP Trunk 401 Unauthorized (Alestra Mexico)

Home » Asterisk Users » PJSIP Trunk 401 Unauthorized (Alestra Mexico)
Asterisk Users 2 Comments

    I am having a really bad day trying to get incoming calls to work on Asterisk 13 with PJSIP.  We just migrated from Asterisk 1.8 where everything was working but there seems that something got lost in translation.  No matter what I try I always get a 401 Unauthorized message when receiving a call from the PSTN provider.  I can make calls and the registration is working.  I have tried to set the identify to an endpoint that does not have an auth defined.  Anyone using Alestra SIP
trunks in Mexico?

Here is what I get on the cli:

<--- Received SIP request (1092 bytes) from UDP: --->
INVITE sip:5547371276@XXX.XXX.XXX.XXX:5060;line=qooanvj SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bKnvnkof007gngrp80d2g1.1
Call-ID: BW1622569380212171700499694@
CSeq: 212444374 INVITE
Recv-Info: x-broadworks-client-session-info Accept: application/media_control+xml,application/sdp,multipart/mixed Min-SE: 90
Session-Expires: 900;refresher=uac Max-Forwards: 9
Content-Type: application/sdp Content-Disposition: session;handling=required Content-Length: 287

o=BroadWorks 26026640 1 IN IP4
c=IN IP4
t=0 0
m=audio 5470 RTP/AVP 18 0 8 100
a=rtpmap:18 G729/8000
a=fmtp:18 annexb:no a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:100 telephone-event/8000
a=fmtp:100 0-15
a=sendrecv a=maxptime:40

<--- Transmitting SIP response (588 bytes) to UDP: --->
SIP/2.0 401 Unauthorized Via: SIP/2.0/UDP;received=;branch=z9hG4bKnvnkof007gngrp80d2g1.1
Call-ID: BW1622569380212171700499694@
CSeq: 212444374 INVITE
WWW-Authenticate: Digest realm=”asterisk”,nonce=”1512253376/546618e0645f233990bd70d97691ddba”,opaque=”3b5f610b33037ba2″,algorithm=md5,qop=”auth”
Server: Asterisk PBX 13.18.3
Content-Length:  0

<--- Received SIP request (434 bytes) from UDP: --->
ACK sip:5547371276@XXX.XXX.XXX.XXX:5060;line=qooanvj SIP/2.0
Via: SIP/2.0/UDP;branch=z9hG4bKnvnkof007gngrp80d2g1.1
CSeq: 212444374 ACK
Call-ID: BW1622569380212171700499694@
Max-Forwards: 9
Content-Length: 0

My identify is:

 endpoint      : Alestra
 match         :
 match_header  :
 srv_lookups   : true

It does not matter if I use the original endpoint or an endpoint with no auth.  Asterisk will still reject the call.  Any tips? How can I make sure that the identify is being used?

Telecomunicaciones Abiertas de México S.A. de C.V. Carlos Chávez dCAP #1349

2 thoughts on - PJSIP Trunk 401 Unauthorized (Alestra Mexico)

  • If you turn up the core debug to level 4 and send it to the console it will tell you what it is doing. I’d also suggest providing the endpoint definition, and confirming it was loaded as expected. If it’s not then you can look at the Asterisk console at load time and it will tell you what it did not like.

    Joshua Colp Digium, Inc. | Senior Software Developer
    445 Jan Davis Drive NW – Huntsville, AL 35806 – US
    Check us out at: http://www.digium.com & http://www.asterisk.org

  • the register for the trunk had the endpoint defined there and therefore the identify section is ignored. I never got a message that the IP
    matched because of this. I need to keep this in mind for future reference.

    Telecomunicaciones Abiertas de México S.A. de C.V. Carlos Chávez
    +52 (55)8116-9161