<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.4.3">
</HEAD>
<BODY>
Hello,<BR>
<BR>
This does look like an issue with authentication rather than WebSockets.&nbsp; Have you tried using an ordinary SIP client (for example, Jitsi) with your Kamailio configuration to verify that the authentication part of kamailio.cfg is correct?<BR>
<BR>
Regards,<BR>
<BR>
Peter<BR>
<BR>
On Tue, 2012-08-21 at 10:59 +0200, David Pati&#241;o wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Hi there,

I'm new on kamailio users list.
Now I'm developing a client in javascript (using websockets) to SIP calls.

I'm using last devel version of kamailio with websocket support. I've
already get a correct REGISTER transaction but now I'm not able to get
a correct INVITE transaction. Actually I'm not sure if this a kamailio
error or a problem with my source code however I'm using the same
function to get digest info from received nonce both REGISTER and
INVITE transactions. The INVITE transaction always enters in an
endless loop with 407 requests.

Please, is there anybody who could help me?

Those are the frames of my code (obtained from chrome browser console):

wsUri: ws://10.1.20.40:80/
SOCKET CREATED
SOCKET OPENED

SENT:
REGISTER <A HREF="sip:10.1.20.40">sip:10.1.20.40</A> SIP/2.0
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bK1C36k8S3b0OobHUAOLLOae0SbsbEQg
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=Me0arqDG6K8o7l32oJgR
To: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>
Call-ID: 0EQSBkoG9RGgfg3E
CSeq: 1 REGISTER
Max-Forwards: 70
Supported: path, outbound, gruu
Contact: &lt;<A HREF="sip:101@KMkjMf37lVeM.invalid">sip:101@KMkjMf37lVeM.invalid</A>;transport=ws&gt;
        reg-id=98
        +sip.instance=&quot;&lt;urn:uuid:beb-68a9-6396e5f4&gt;&quot;


RESPONSE:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bK1C36k8S3b0OobHUAOLLOae0SbsbEQg;rport=50906;received=10.1.2.229
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=Me0arqDG6K8o7l32oJgR
To: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=9de7b31b15b69da019f867d4866ff286.000c
Call-ID: 0EQSBkoG9RGgfg3E
CSeq: 1 REGISTER
WWW-Authenticate: Digest realm=&quot;10.1.20.40&quot;,
nonce=&quot;UDND2VAzQq0Tz8wvIFWNh2eYRxdtu4Re&quot;
Server: kamailio (3.4.0-dev3 (i386/linux))
Content-Length: 0


SENT:
REGISTER <A HREF="sip:10.1.20.40">sip:10.1.20.40</A> SIP/2.0
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bKl521S8acS8nVEcejv2GOJ8r46Jb037
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=Pb8d1gV8K5qJo1gOv612
To: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>
Call-ID: 0EQSBkoG9RGgfg3E
CSeq: 2 REGISTER
Max-Forwards: 70
Supported: path, outbound, gruu
Contact: &lt;<A HREF="sip:101@KMkjMf37lVeM.invalid">sip:101@KMkjMf37lVeM.invalid</A>;transport=ws&gt;
        reg-id=98
        +sip.instance=&quot;&lt;urn:uuid:beb-68a9-6396e5f4&gt;&quot;
Authorization: Digest username=&quot;101&quot;, realm=&quot;10.1.20.40&quot;,
nonce=&quot;UDND2VAzQq0Tz8wvIFWNh2eYRxdtu4Re&quot;, opaque=&quot;&quot;,
uri=&quot;<A HREF="sip:10.1.20.40">sip:10.1.20.40</A>&quot;, response= &quot;9b209eb35ee88192e2e0c468f8cf91da&quot;


RESPONSE:
SIP/2.0 200 OK
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bKl521S8acS8nVEcejv2GOJ8r46Jb037;rport=50906;received=10.1.2.229
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=Pb8d1gV8K5qJo1gOv612
To: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=9de7b31b15b69da019f867d4866ff286.b2e4
Call-ID: 0EQSBkoG9RGgfg3E
CSeq: 2 REGISTER
Contact: &lt;<A HREF="sip:101@KMkjMf37lVeM.invalid">sip:101@KMkjMf37lVeM.invalid</A>;transport=ws&gt;;expires=120;received=&quot;<A HREF="sip:10.1.2.229:50906">sip:10.1.2.229:50906</A>;transport=WS&quot;;pub-gruu=&quot;<A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;gr=urn:uuid:beb-68a9-6396e5f4&quot;;temp-gruu=&quot;<A HREF="sip:uloc-5033344d-5211-1-1de173@10.1.20.40">sip:uloc-5033344d-5211-1-1de173@10.1.20.40</A>;gr&quot;;+sip.instance=&quot;&lt;urn:uuid:beb-68a9-6396e5f4&gt;&quot;;reg-id=98
Server: kamailio (3.4.0-dev3 (i386/linux))
Content-Length: 0


SENT:
INVITE <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A> SIP/2.0
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bKOIosJ8TMPgvfHme6NIm4GSn24Fu7f7
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=3U0osO4h3h2bgCrvnCqO
To: <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>
Call-ID: 9KoKnFdh285k2jg4
CSeq: 1 INVITE
Max-Forwards: 70
Supported: path, outbound, gruu
Contact: &lt;<A HREF="sip:101@KMkjMf37lVeM.invalid">sip:101@KMkjMf37lVeM.invalid</A>;transport=ws
        gr=urn:uuid:beb-68a9-6396e5f4;ob&gt;
Content-Type: application/sdp


RESPONSE:
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bKOIosJ8TMPgvfHme6NIm4GSn24Fu7f7;rport=50906;received=10.1.2.229
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=3U0osO4h3h2bgCrvnCqO
To: <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>;tag=9de7b31b15b69da019f867d4866ff286.f545
Call-ID: 9KoKnFdh285k2jg4
CSeq: 1 INVITE
Proxy-Authenticate: Digest realm=&quot;10.1.20.40&quot;,
nonce=&quot;UDND2VAzQq0Tz8wvIFWNh2eYRxdtu4Re&quot;
Server: kamailio (3.4.0-dev3 (i386/linux))
Content-Length: 0


SENT:
ACK <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A> SIP/2.0
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bKAmmLhK71tr2QoAiV9f5QmdKF9dGkke
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=3U0osO4h3h2bgCrvnCqO
To: <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>;tag=9de7b31b15b69da019f867d4866ff286.f545
Call-ID: 9KoKnFdh285k2jg4
CSeq: 1 ACK
Max-Forwards: 70
Supported: path, outbound, gruu


SENT:
INVITE <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A> SIP/2.0
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bK1GRkmlTVo7Cb4fg8OMe9g39g096hmn
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=3U0osO4h3h2bgCrvnCqO
To: <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>
Call-ID: 9KoKnFdh285k2jg4
CSeq: 2 INVITE
Max-Forwards: 70
Supported: path, outbound, gruu
Contact: &lt;<A HREF="sip:101@KMkjMf37lVeM.invalid">sip:101@KMkjMf37lVeM.invalid</A>;transport=ws
        gr=urn:uuid:beb-68a9-6396e5f4;ob&gt;
Proxy-Authorization: Digest username=&quot;101&quot;, realm=&quot;10.1.20.40&quot;,
nonce=&quot;UDND2VAzQq0Tz8wvIFWNh2eYRxdtu4Re&quot;, opaque=&quot;&quot;,
uri=&quot;<A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>&quot;, response= &quot;f4bbe128abf3acb3a4e11882749d8798&quot;
Content-Type: application/sdp


RESPONSE:
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bK1GRkmlTVo7Cb4fg8OMe9g39g096hmn;rport=50906;received=10.1.2.229
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=3U0osO4h3h2bgCrvnCqO
To: <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>;tag=9de7b31b15b69da019f867d4866ff286.0007
Call-ID: 9KoKnFdh285k2jg4
CSeq: 2 INVITE
Proxy-Authenticate: Digest realm=&quot;10.1.20.40&quot;,
nonce=&quot;UDND2VAzQq0Tz8wvIFWNh2eYRxdtu4Re&quot;
Server: kamailio (3.4.0-dev3 (i386/linux))
Content-Length: 0


SENT:
ACK <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A> SIP/2.0
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bKG9v5g7i1LNsoVGo18ULlgqdA1EcFGb
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=3U0osO4h3h2bgCrvnCqO
To: <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>;tag=9de7b31b15b69da019f867d4866ff286.0007
Call-ID: 9KoKnFdh285k2jg4
CSeq: 2 ACK
Max-Forwards: 70
Supported: path, outbound, gruu


SENT:
INVITE <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A> SIP/2.0
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bK8cie6bGSG0eOGh7Ne08Ro4CS1hI0oJ
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=3U0osO4h3h2bgCrvnCqO
To: <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>
Call-ID: 9KoKnFdh285k2jg4
CSeq: 3 INVITE
Max-Forwards: 70
Supported: path, outbound, gruu
Contact: &lt;<A HREF="sip:101@KMkjMf37lVeM.invalid">sip:101@KMkjMf37lVeM.invalid</A>;transport=ws
        gr=urn:uuid:beb-68a9-6396e5f4;ob&gt;
Proxy-Authorization: Digest username=&quot;101&quot;, realm=&quot;10.1.20.40&quot;,
nonce=&quot;UDND2VAzQq0Tz8wvIFWNh2eYRxdtu4Re&quot;, opaque=&quot;&quot;,
uri=&quot;<A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>&quot;, response= &quot;f4bbe128abf3acb3a4e11882749d8798&quot;
Content-Type: application/sdp


RESPONSE:
SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/WS
KMkjMf37lVeM.invalid;branch=z9hG4bK8cie6bGSG0eOGh7Ne08Ro4CS1hI0oJ;rport=50906;received=10.1.2.229
From: <A HREF="sip:101@10.1.20.40">sip:101@10.1.20.40</A>;tag=3U0osO4h3h2bgCrvnCqO
To: <A HREF="sip:102@10.1.20.40">sip:102@10.1.20.40</A>;tag=9de7b31b15b69da019f867d4866ff286.b1f7
Call-ID: 9KoKnFdh285k2jg4
CSeq: 3 INVITE
Proxy-Authenticate: Digest realm=&quot;10.1.20.40&quot;,
nonce=&quot;UDND2VAzQq0Tz8wvIFWNh2eYRxdtu4Re&quot;
Server: kamailio (3.4.0-dev3 (i386/linux))
Content-Length: 0


.......and so on in an endless loop with 407 requests

Thanks a lot

Kind Regards

--
     --DAVID--

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<A HREF="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</A>
<A HREF="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</A>
</PRE>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>