[asterisk-users] Can't make Asterisk send authentication to remote peer on INVITE

Ben WIlliams bwilliams+asterisk at jadeworld.com
Sat Apr 14 04:30:06 CDT 2012


This is a really simple problem that I just can't get to work. There
are two Asterisk servers with the following sip user and peer. When a
call is attempted, Asterisk is not sending authentication details in
response to the 401. Note, if the secret is blank on 172.16.0.2 test,
the INVITE succeeds.

on 172.16.0.2:

[test]
type=friend
secret=abcde
host=dynamic
context=demo

on 172.16.0.1 :

[natty]
type=peer
host=172.16.0.2
fromuser=test
secret=abcde

originate SIP/natty/1234568 extension 200
  == Using SIP RTP CoS mark 5
Audio is at 172.16.0.1 port 19486
Adding codec 0x2 (gsm) to SDP
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 172.16.0.2:5060:
INVITE sip:1234568 at 172.16.0.2 SIP/2.0
Via: SIP/2.0/UDP 172.16.0.1:5066;branch=z9hG4bK59f50e30;rport
Max-Forwards: 70
From: "asterisk" <sip:test at 172.16.0.1:5066>;tag=as1689b2b6
To: <sip:1234568 at 172.16.0.2>
Contact: <sip:test at 172.16.0.1:5066>
Call-ID: 2353cf0e59596e285c684b44220f8915 at 172.16.0.1
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.2.9-2ubuntu2.1
Date: Sat, 14 Apr 2012 09:10:38 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 290

v=0
o=root 1594270426 1594270426 IN IP4 172.16.0.1
s=Asterisk PBX 1.6.2.9-2ubuntu2.1
c=IN IP4 172.16.0.1
t=0 0
m=audio 19486 RTP/AVP 3 0 8 101
a=rtpmap:3 GSM/8000
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=sendrecv

---

<--- SIP read from UDP:172.16.0.2:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP
172.16.0.1:5066;branch=z9hG4bK59f50e30;received=172.16.0.1;rport=5066
From: "asterisk" <sip:test at 172.16.0.1:5066>;tag=as1689b2b6
To: <sip:1234568 at 172.16.0.2>;tag=as1a6c2364
Call-ID: 2353cf0e59596e285c684b44220f8915 at 172.16.0.1
CSeq: 102 INVITE
Server: Asterisk PBX 1.6.2.9-2ubuntu2.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="7a03a1d3"
Content-Length: 0


<------------->
--- (11 headers 0 lines) ---
Transmitting (no NAT) to 172.16.0.2:5060:
ACK sip:1234568 at 172.16.0.2 SIP/2.0
Via: SIP/2.0/UDP 172.16.0.1:5066;branch=z9hG4bK59f50e30;rport
Max-Forwards: 70
From: "asterisk" <sip:test at 172.16.0.1:5066>;tag=as1689b2b6
To: <sip:1234568 at 172.16.0.2>;tag=as1a6c2364
Contact: <sip:test at 172.16.0.1:5066>
Call-ID: 2353cf0e59596e285c684b44220f8915 at 172.16.0.1
CSeq: 102 ACK
User-Agent: Asterisk PBX 1.6.2.9-2ubuntu2.1
Content-Length: 0


---
[Apr 14 21:10:38] NOTICE[31158]: chan_sip.c:17975
handle_response_invite: Failed to authenticate on INVITE to
'"asterisk" <sip:test at 172.16.0.1:5066>;tag=as1689b2b6'



More information about the asterisk-users mailing list