Hi, I've been following this integration tutorial http://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb and have a successful registration and I can even make calls through my asterisk box.

However what is unusual to me is that every time a phone registers with Kamailio, that is forwarded to Asterisk (as expected), yet Asterisk replies with 401 Unauthorized. Oddly enough the phone registers and can still make calls. What worries me is that as we scale to 100's of cps, this seemingly erroneous message may slow down Asterisk because it's trying to handle authentication for users which have already been authenticated by Kamailio. If this behavior is expected, then that would be good to know as well.

This is the sip debug from ASTERISK (I have replaced IP's with the names of the servers):


<--- SIP read from TCP:kamailio:41205 --->
REGISTER sip:asteriskIP:5060;transport=tcp SIP/2.0
Via: SIP/2.0/TCP kamailio;branch=z9hG4bK998f.2846e405000000000000000000000000.0
To: <sip:40081@asteriskIP>
From: <sip:40081@asteriskIP>;tag=32fda68bf54efeeb04e3edc67b53c63d-cfb0
CSeq: 10 REGISTER
Call-ID: 0005ce130bcee5c4-26538@kamailio
Max-Forwards: 70
Content-Length: 0
User-Agent: kamailio (4.3.0 (x86_64/linux))
Contact: <sip:40081@kamailio:5060>
Expires: 3600

<------------->
--- (11 headers 0 lines) ---
Sending to kamailio:5060 (no NAT)
Sending to kamailio:5060 (no NAT)

<--- Transmitting (no NAT) to kamailio:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TCP kamailio;branch=z9hG4bK998f.2846e405000000000000000000000000.0;received= kamailio
From: <sip:40081@asteriskIP>;tag=32fda68bf54efeeb04e3edc67b53c63d-cfb0
To: <sip:40081@asteriskIP>;tag=as404bac9a
Call-ID: 0005ce130bcee5c4-26538@ kamailio
CSeq: 10 REGISTER
Server: Asterisk PBX 11.6-cert2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="262b338e"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '0005ce130bcee5c4-26538@ kamailio' in 32000 ms (Method: REGISTER)
Scheduling destruction of SIP dialog '0005ce130bcee5c4-26538@ kamailio' in 32000 ms (Method: REGISTER)
Really destroying SIP dialog '0005ce130bcee5c1-26536@ kamailio' Method: REGISTER

=========================

sip.conf for kamailio trunk:

[kamailio-inbound]
type=friend
dtmfmode=auto
host=kamailioIP
allow=all
context=sipout
insecure=port,invite
canreinvite=no

========================

Asterisk version: 11.6-cert2
Kamailio version: 4.3

Benjamin Fitzgerald
LETS Corporation
(925) 235-1154




*******Confidential Notice: 
This message is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this message in error, please delete this message from all computers and contact Orion Systems/LETS Corp immediately by return e-mail and/or telephone at (925) 566-5600