My nonce is correct i guess here is the formula i am using:<br>nonce="e6942c46-0c8d-11e0-a946-13f4f379a0fc", <br>uri="sip:78.23.93.41", <br>response="294b6b91485aaa66e917c1378736267b"<br><br> /** Calculates the digest-response.<br>
* <p> If the "qop" value is "auth" or "auth-int":<br> * <br> KD ( H(A1), unq(nonce) ":" nc ":" unq(cnonce) ":" unq(qop) ":" H(A2) )<br>
*<br> * <p> If the "qop" directive is not present:<br> * <br> KD ( H(A1), unq(nonce) ":" H(A2) )<br> */<br> public String getResponse()<br> { String secret=HEX(MD5(A1()));<br>
StringBuffer sb=new StringBuffer();<br> if (nonce!=null) sb.append(nonce);<br> sb.append(":");<br> if (qop!=null)<br> { if (nc!=null) sb.append(nc);<br> sb.append(":");<br>
if (cnonce!=null) sb.append(cnonce);<br> sb.append(":");<br> sb.append(qop);<br> sb.append(":");<br> }<br> sb.append(HEX(MD5(A2())));<br> String data=sb.toString();<br>
return HEX(KD(secret,data));<br> }<br><br><br>
<br><br><div class="gmail_quote">On Mon, Dec 20, 2010 at 11:55 PM, Michael Collins <span dir="ltr"><<a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Well, I don't claim to be a genius in these sorts of things but I don't know if your nonce count field is correct. IIRC it needs to be 8 characters long and yours appears to be 9 characters long. Check your app to make sure it uses a proper nc="00000001" and see what happens.<div>
<br></div><div>-MC<br><br><div class="gmail_quote"><div><div></div><div class="h5">On Mon, Dec 20, 2010 at 2:47 PM, Shamun toha md <span dir="ltr"><<a href="mailto:shamun.toha@gmail.com" target="_blank">shamun.toha@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
I was writing a small application i never get it working with FreeSwitch sip login. This is my packets switching i get always auth fail. What is there missing ?<br><br><br>recv 407 bytes from udp/[78.23.93.41]:5091 at 22:42:15.817398:<br>
------------------------------------------------------------------------<br> REGISTER sip:78.23.93.41 SIP/2.0<br> Via: SIP/2.0/UDP localhost:5091;rport;branch=z9hG4bK2049230244<br> Max-forwards: 70<br> From: "1002" <<a href="mailto:sip%3A1002@78.23.93.41" target="_blank">sip:1002@78.23.93.41</a>>;tag=2049230244<br>
To: <<a href="mailto:sip%3A1002@78.23.93.41" target="_blank">sip:1002@78.23.93.41</a>><br> Call-ID: @localhost<br> CSeq: 400 REGISTER<br> Contact: <sip:1002@localhost:5091>;expires=3600<br> Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,REFER,NOTIFY,SUBSCRIBE,INFO,MESSAGE<br>
User-agent: test<br> Content-Length: 0<br> <br> ------------------------------------------------------------------------<br>send 634 bytes to udp/[78.23.93.41]:5091 at 22:42:16.072075:<br> ------------------------------------------------------------------------<br>
SIP/2.0 401 Unauthorized<br> Via: SIP/2.0/UDP localhost:5091;rport=5091;branch=z9hG4bK2049230244;received=78.23.93.41<br> From: "1002" <<a href="mailto:sip%3A1002@78.23.93.41" target="_blank">sip:1002@78.23.93.41</a>>;tag=2049230244<br>
To: <<a href="mailto:sip%3A1002@78.23.93.41" target="_blank">sip:1002@78.23.93.41</a>>;tag=XD2H1ja8U4jyr<br> Call-ID: @localhost<br> CSeq: 400 REGISTER<br> User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-828960a 2010-09-25 12-51-42 -0500<br>
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE<br> Supported: timer, precondition, path, replaces<br> WWW-Authenticate: Digest realm="78.23.93.41", nonce="64da83a6-0c8a-11e0-a943-13f4f379a0fc", algorithm=MD5, qop="auth"<br>
Content-Length: 0<br> <br> ------------------------------------------------------------------------<br>recv 540 bytes from udp/[78.23.93.41]:5091 at 22:42:16.091547:<br> ------------------------------------------------------------------------<br>
REGISTER sip:78.23.93.41 SIP/2.0<br> Via: SIP/2.0/UDP localhost:5091;rport;branch=z9hG4bK2049230244<br> To: <<a href="mailto:sip%3A1002@78.23.93.41" target="_blank">sip:1002@78.23.93.41</a>> <br> From: "1002" <<a href="mailto:sip%3A1002@78.23.93.41" target="_blank">sip:1002@78.23.93.41</a>>;tag=2049230244<br>
Call-ID: @localhost<br> CSeq: 402 REGISTER<br> Contact: <sip:1002@localhost:5091>;expires=3600<br> Authorization: Digest username="1002", realm="78.23.93.41", nonce="64da83a6-0c8a-11e0-a943-13f4f379a0fc", uri="sip:78.23.93.41", response="e747a46dbb1169661e9435773921cff5", qop="auth", algorithm="MD5", cnonce="", nc="000000001"<br>
User-agent: test<br> Content-Length: 0<br> <br> ------------------------------------------------------------------------<br>2010-12-20 23:42:16.328313 [WARNING] sofia_reg.c:1088 SIP auth failure (REGISTER) on sofia profile 'internal' for [<a href="mailto:1002@78.23.93.41" target="_blank">1002@78.23.93.41</a>] from ip 78.23.93.41<br>
send 512 bytes to udp/[78.23.93.41]:5091 at 22:42:16.330038:<br> ------------------------------------------------------------------------<br> SIP/2.0 403 Forbidden<br> Via: SIP/2.0/UDP localhost:5091;rport=5091;branch=z9hG4bK2049230244;received=78.23.93.41<br>
From: "1002" <<a href="mailto:sip%3A1002@78.23.93.41" target="_blank">sip:1002@78.23.93.41</a>>;tag=2049230244<br> To: <<a href="mailto:sip%3A1002@78.23.93.41" target="_blank">sip:1002@78.23.93.41</a>>;tag=ypUa3DUBSD9gm<br>
Call-ID: @localhost<br>
CSeq: 402 REGISTER<br> User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-828960a 2010-09-25 12-51-42 -0500<br> Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO, REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE<br>
Supported: timer, precondition, path, replaces<br> Content-Length: 0<br> <br> ------------------------------------------------------------------------<br>recv 268 bytes from udp/[78.23.93.41]:5091 at 22:42:16.334712:<br>
------------------------------------------------------------------------<br> ACK <a href="http://sip:1002@78.23.93.41:5060" target="_blank">sip:1002@78.23.93.41:5060</a> SIP/2.0<br> Via: SIP/2.0/UDP null:5091;rport;branch=z9hG4bK2049258514<br>
From: 1002 <<a href="http://sip:1002@78.23.93.41:5060" target="_blank">sip:1002@78.23.93.41:5060</a>>;tag=2049258514<br> To: <<a href="http://sip:1002@78.23.93.41:5060" target="_blank">sip:1002@78.23.93.41:5060</a>>;tag=tag=ypUa3DUBSD9gm<br>
Call-ID: 58514@localhost<br> CSeq: 0 ACK<br> Content-Length: 0<br> <br> ------------------------------------------------------------------------<br><br><br>
<br></div></div>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br>