[Freeswitch-users] My sip client program gets fail to login

Shamun toha md shamun.toha at gmail.com
Tue Dec 21 02:14:50 MSK 2010


My nonce is correct i guess here is the formula i am using:
nonce="e6942c46-0c8d-11e0-a946-13f4f379a0fc",
uri="sip:78.23.93.41",
response="294b6b91485aaa66e917c1378736267b"

   /** Calculates the digest-response.
     * <p> If the "qop" value is "auth" or "auth-int":
     * <br>   KD ( H(A1), unq(nonce) ":" nc ":" unq(cnonce) ":" unq(qop) ":"
H(A2) )
     *
     * <p> If the "qop" directive is not present:
     * <br>   KD ( H(A1), unq(nonce) ":" H(A2) )
     */
   public String getResponse()
   {  String secret=HEX(MD5(A1()));
      StringBuffer sb=new StringBuffer();
      if (nonce!=null) sb.append(nonce);
      sb.append(":");
      if (qop!=null)
      {  if (nc!=null) sb.append(nc);
         sb.append(":");
         if (cnonce!=null) sb.append(cnonce);
         sb.append(":");
         sb.append(qop);
         sb.append(":");
      }
      sb.append(HEX(MD5(A2())));
      String data=sb.toString();
      return HEX(KD(secret,data));
   }




On Mon, Dec 20, 2010 at 11:55 PM, Michael Collins <msc at freeswitch.org>wrote:

> 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.
>
> -MC
>
> On Mon, Dec 20, 2010 at 2:47 PM, Shamun toha md <shamun.toha at gmail.com>wrote:
>
>> 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 ?
>>
>>
>> recv 407 bytes from udp/[78.23.93.41]:5091 at 22:42:15.817398:
>>
>> ------------------------------------------------------------------------
>>    REGISTER sip:78.23.93.41 SIP/2.0
>>    Via: SIP/2.0/UDP localhost:5091;rport;branch=z9hG4bK2049230244
>>    Max-forwards: 70
>>    From: "1002" <sip:1002 at 78.23.93.41 <sip%3A1002 at 78.23.93.41>
>> >;tag=2049230244
>>    To: <sip:1002 at 78.23.93.41 <sip%3A1002 at 78.23.93.41>>
>>    Call-ID: @localhost
>>    CSeq: 400 REGISTER
>>    Contact: <sip:1002 at localhost:5091>;expires=3600
>>    Allow:
>> INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,REFER,NOTIFY,SUBSCRIBE,INFO,MESSAGE
>>    User-agent: test
>>    Content-Length: 0
>>
>>
>> ------------------------------------------------------------------------
>> send 634 bytes to udp/[78.23.93.41]:5091 at 22:42:16.072075:
>>
>> ------------------------------------------------------------------------
>>    SIP/2.0 401 Unauthorized
>>    Via: SIP/2.0/UDP
>> localhost:5091;rport=5091;branch=z9hG4bK2049230244;received=78.23.93.41
>>    From: "1002" <sip:1002 at 78.23.93.41 <sip%3A1002 at 78.23.93.41>
>> >;tag=2049230244
>>    To: <sip:1002 at 78.23.93.41 <sip%3A1002 at 78.23.93.41>>;tag=XD2H1ja8U4jyr
>>    Call-ID: @localhost
>>    CSeq: 400 REGISTER
>>    User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-828960a 2010-09-25
>> 12-51-42 -0500
>>    Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO,
>> REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
>>    Supported: timer, precondition, path, replaces
>>    WWW-Authenticate: Digest realm="78.23.93.41",
>> nonce="64da83a6-0c8a-11e0-a943-13f4f379a0fc", algorithm=MD5, qop="auth"
>>    Content-Length: 0
>>
>>
>> ------------------------------------------------------------------------
>> recv 540 bytes from udp/[78.23.93.41]:5091 at 22:42:16.091547:
>>
>> ------------------------------------------------------------------------
>>    REGISTER sip:78.23.93.41 SIP/2.0
>>    Via: SIP/2.0/UDP localhost:5091;rport;branch=z9hG4bK2049230244
>>    To: <sip:1002 at 78.23.93.41 <sip%3A1002 at 78.23.93.41>>
>>    From: "1002" <sip:1002 at 78.23.93.41 <sip%3A1002 at 78.23.93.41>
>> >;tag=2049230244
>>    Call-ID: @localhost
>>    CSeq: 402 REGISTER
>>    Contact: <sip:1002 at localhost:5091>;expires=3600
>>    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"
>>    User-agent: test
>>    Content-Length: 0
>>
>>
>> ------------------------------------------------------------------------
>> 2010-12-20 23:42:16.328313 [WARNING] sofia_reg.c:1088 SIP auth failure
>> (REGISTER) on sofia profile 'internal' for [1002 at 78.23.93.41] from ip
>> 78.23.93.41
>> send 512 bytes to udp/[78.23.93.41]:5091 at 22:42:16.330038:
>>
>> ------------------------------------------------------------------------
>>    SIP/2.0 403 Forbidden
>>    Via: SIP/2.0/UDP
>> localhost:5091;rport=5091;branch=z9hG4bK2049230244;received=78.23.93.41
>>    From: "1002" <sip:1002 at 78.23.93.41 <sip%3A1002 at 78.23.93.41>
>> >;tag=2049230244
>>    To: <sip:1002 at 78.23.93.41 <sip%3A1002 at 78.23.93.41>>;tag=ypUa3DUBSD9gm
>>    Call-ID: @localhost
>>    CSeq: 402 REGISTER
>>    User-Agent: FreeSWITCH-mod_sofia/1.0.head-git-828960a 2010-09-25
>> 12-51-42 -0500
>>    Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, UPDATE, INFO,
>> REGISTER, REFER, NOTIFY, PUBLISH, SUBSCRIBE
>>    Supported: timer, precondition, path, replaces
>>    Content-Length: 0
>>
>>
>> ------------------------------------------------------------------------
>> recv 268 bytes from udp/[78.23.93.41]:5091 at 22:42:16.334712:
>>
>> ------------------------------------------------------------------------
>>    ACK sip:1002 at 78.23.93.41:5060 SIP/2.0
>>    Via: SIP/2.0/UDP null:5091;rport;branch=z9hG4bK2049258514
>>    From: 1002 <sip:1002 at 78.23.93.41:5060>;tag=2049258514
>>    To: <sip:1002 at 78.23.93.41:5060>;tag=tag=ypUa3DUBSD9gm
>>    Call-ID: 58514 at localhost
>>    CSeq: 0 ACK
>>    Content-Length: 0
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>>
>> _______________________________________________
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101221/3a216be6/attachment.html 


More information about the FreeSWITCH-users mailing list