[Freeswitch-dev] Trouble registering SIP client

Anthony Minessale anthony.minessale at gmail.com
Sat Jan 24 16:15:49 PST 2009


consider this code:

This is what we do to auth: say your uri is sip:bar.com

first we compute uri digest which is the md5 hash of the string

REGISTER:sip:bar.com


Then depending on what you sent us we do another md5 hash with the following
info:




   if (nc && cnonce && qop) {
        input2 = switch_mprintf("%q:%q:%q:%q:%q:%q", a1_hash, nonce, nc,
cnonce, qop, uridigest);
    } else {
        input2 = switch_mprintf("%q:%q:%q", a1_hash, nonce, uridigest);
    }




On Sat, Jan 24, 2009 at 2:07 PM, Roland Zagler <r.zagler at zakotel.com> wrote:

> Hi mike,
>
> thanks for taking a look, here is the trace of a softphone called
> firefly registering with the same creds,
> the only difference is the ip the client runs on, I tested it already to
> register from the
> same ip, which didn't work. I also tried adding the "cnonce" and "nc"
> parameters inside the authorization
> header, also without success.
>
> btw: I can register to an asterisk server using the same java client
> code without probs.
>
> thx again,
> Roland
>
>
>
> tport_wakeup_pri(0x80f3580): events IN
> tport_recv_event(0x80f3580)
> tport_recv_iovec(0x80f3580) msg 0xb34025c8 from (udp/10.0.4.60:5060) has
> 428 bytes, veclen = 1
> recv 428 bytes from udp/[10.0.4.2]:5060 at 20:01:08.463700:
>
> ------------------------------------------------------------------------
>   REGISTER sip:10.0.4.60:5060;transport=udp SIP/2.0
>   To: "roland"<sip:roland at 10.0.4.60:5060;transport=udp>
>   From: "roland"<sip:roland at 10.0.4.60 <sip%3Aroland at 10.0.4.60>
> >;tag=78399c75
>    Via: SIP/2.0/UDP
> 10.0.4.2:5060;branch=z9hG4bK-d87543-0b5fac2e346e151d-1--d87543-;rport
>   Call-ID: f85a4202fd310527 at YXBvbGxv
>   CSeq: 1 REGISTER
>   Contact: <sip:roland at 10.0.4.2:5060>;expires=7200
>   Expires: 7200
>   Max-Forwards: 70
>   User-Agent: Firefly 2.0
>   Content-Length: 0
>
>
> ------------------------------------------------------------------------
> tport_deliver(0x80f3580): msg 0xb34025c8 (428 bytes) from
> udp/10.0.4.2:5060/sip next=(nil)
> nta: received REGISTER sip:10.0.4.60:5060;transport=udp SIP/2.0 (CSeq 1)
> nta: canonizing sip:10.0.4.60:5060 with contact
> nta: REGISTER (1) going to a default leg
> nua: nua_stack_process_request: entering
> nua: nh_create: entering
> nua: nh_create_handle: entering
> nua: nua_stack_set_params: entering
> soa_clone(static::0x80f1740, 0x80eea10, 0x81258f0) called
> soa_set_params(static::0x811b558, ...) called
> nua: nua_application_event: entering
> nua: nua_respond: entering
> nua(0x81258f0): sent signal r_respond
> 2009-01-24 21:01:08 [DEBUG] sofia_reg.c:883 sofia_reg_handle_register()
> Requesting Registration from: [roland at 10.0.4.60]
> nua: nua_handle_destroy: entering
> nua(0x81258f0): sent signal r_destroy
> nua: nua_handle_magic: entering
> nua: nua_handle_destroy: entering
> nua: nua_stack_set_params: entering
> soa_set_params(static::0x811b558, ...) called
> tport_tsend(0x80f3580) tpn = UDP/10.0.4.2:5060
> tport_resolve addrinfo = 10.0.4.2:5060
> tport_by_addrinfo(0x80f3580): not found by name UDP/10.0.4.2:5060
> tport_vsend returned 651
> send 651 bytes to udp/[10.0.4.2]:5060 at 20:01:08.550818:
>
> ------------------------------------------------------------------------
>   SIP/2.0 401 Unauthorized
>   Via: SIP/2.0/UDP
> 10.0.4.2:5060;branch=z9hG4bK-d87543-0b5fac2e346e151d-1--d87543-;rport=50
> 60
>   From: "roland"<sip:roland at 10.0.4.60 <sip%3Aroland at 10.0.4.60>
> >;tag=78399c75
>   To: "roland"
> <sip:roland at 10.0.4.60:5060;transport=udp>;tag=QmNHXB98gttgB
>   Call-ID: f85a4202fd310527 at YXBvbGxv
>    CSeq: 1 REGISTER
>   User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-11480
>   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE,
> NOTIFY, REFER, UPDATE, REGISTER, INFO, PUBLISH
>   Supported: timer, precondition, path, replaces
>   WWW-Authenticate: Digest realm="10.0.4.60",
> nonce="bd912f5c-ea51-11dd-8d93-318210ee3033", algorithm=MD5, qop="auth"
>    Content-Length: 0
>
>
> ------------------------------------------------------------------------
> nta: sent 401 Unauthorized for REGISTER (1)
> nta: timer set to 32000 ms
> nta_leg_destroy((nil))
> soa_destroy(static::0x811b558) called
> tport_wakeup_pri(0x80f3580): events IN
> tport_recv_event(0x80f3580)
> tport_recv_iovec(0x80f3580) msg 0x812b358 from (udp/10.0.4.60:5060) has
> 668 bytes, veclen = 1
> recv 668 bytes from udp/[10.0.4.2]:5060 at 20:01:08.553542:
>
> ------------------------------------------------------------------------
>   REGISTER sip:10.0.4.60:5060;transport=udp SIP/2.0
>   To: "roland"<sip:roland at 10.0.4.60:5060;transport=udp>
>   From: "roland"<sip:roland at 10.0.4.60 <sip%3Aroland at 10.0.4.60>
> >;tag=78399c75
>    Via: SIP/2.0/UDP
> 10.0.4.2:5060;branch=z9hG4bK-d87543-f16d4916bb41f15a-1--d87543-;rport
>   Call-ID: f85a4202fd310527 at YXBvbGxv
>   CSeq: 2 REGISTER
>   Contact: <sip:roland at 10.0.4.2:5060>;expires=7200
>   Expires: 7200
>   Max-Forwards: 70
>   User-Agent: Firefly 2.0
>   Authorization: Digest
> username="roland",realm="10.0.4.60",nonce="bd912f5c-ea51-11dd-8d93-31821
> 0ee3033",uri="sip:10.0.4.60:5060;transport=udp",response="f25e2b5a110923
> 4bae13b5976abe3129",cnonce="137481EB",nc=00000001,qop=auth,algorithm=MD5
>   Content-Length: 0
>
>
> ------------------------------------------------------------------------
> tport_deliver(0x80f3580): msg 0x812b358 (668 bytes) from
> udp/10.0.4.2:5060/sip next=(nil)
> nta: received REGISTER sip:10.0.4.60:5060;transport=udp SIP/2.0 (CSeq 2)
> nta: canonizing sip:10.0.4.60:5060 with contact
> nta: REGISTER (2) going to a default leg
> nua: nua_stack_process_request: entering
> nua: nh_create: entering
> nua: nh_create_handle: entering
> nua: nua_stack_set_params: entering
> soa_clone(static::0x80f1740, 0x80eea10, 0xb342a660) called
> soa_set_params(static::0xb342fc18, ...) called
> nua: nua_application_event: entering
> 2009-01-24 21:01:08 [DEBUG] sofia_reg.c:971 sofia_reg_handle_register()
> Register:
> From:    [roland at 10.0.4.60]
> Contact: ["roland" <sip:roland at 10.0.4.2:5060>]
> Expires: [7200]
> nua: nua_respond: entering
> nua(0xb342a660): sent signal r_respond
> nua: nua_handle_destroy: entering
> nua(0xb342a660): sent signal r_destroy
> nua: nua_handle_magic: entering
> nua: nua_handle_destroy: entering
> nua: nua_stack_set_params: entering
> soa_set_params(static::0xb342fc18, ...) called
> tport_tsend(0x80f3580) tpn = UDP/10.0.4.2:5060
> tport_resolve addrinfo = 10.0.4.2:5060
> tport_by_addrinfo(0x80f3580): not found by name UDP/10.0.4.2:5060
> tport_vsend returned 611
> send 611 bytes to udp/[10.0.4.2]:5060 at 20:01:08.559893:
>
> ------------------------------------------------------------------------
>   SIP/2.0 200 OK
>    Via: SIP/2.0/UDP
> 10.0.4.2:5060;branch=z9hG4bK-d87543-f16d4916bb41f15a-1--d87543-;rport=50
> 60
>   From: "roland"<sip:roland at 10.0.4.60 <sip%3Aroland at 10.0.4.60>
> >;tag=78399c75
>   To: "roland"
> <sip:roland at 10.0.4.60:5060;transport=udp>;tag=rXeaZ6Sce3g3p
>   Call-ID: f85a4202fd310527 at YXBvbGxv
>   CSeq: 2 REGISTER
>   Contact: <sip:roland at 10.0.4.2:5060>;expires=7200
>   Date: Sat, 24 Jan 2009 20:01:08 GMT
>    User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-11480
>   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE,
> NOTIFY, REFER, UPDATE, REGISTER, INFO, PUBLISH
>   Supported: timer, precondition, path, replaces
>   Content-Length: 0
>
>
> ------------------------------------------------------------------------
> nta: sent 200 OK for REGISTER (2)
> nta_leg_destroy((nil))
> soa_destroy(static::0xb342fc18) called
>
> -----Original Message-----
> From: freeswitch-dev-bounces at lists.freeswitch.org
> [mailto:freeswitch-dev-bounces at lists.freeswitch.org] On Behalf Of
> Michael Jerris
> Sent: Saturday, January 24, 2009 8:19 PM
> To: freeswitch-dev at lists.freeswitch.org
> Subject: Re: [Freeswitch-dev] Trouble registering SIP client
>
> can you post the trace that works?  I have a feeling your setting up
> your auth hash that you are sending wrong, perhaps the code where you
> build that would help someone see the error.
>
> Mike
>
> On Jan 24, 2009, at 12:08 PM, Roland Zagler wrote:
>
> > Hi everybody,
> >
> > I am writing a Java SIP ua (based on mjsip 1.6) that is supposed to
> > register to freeswitch.
> > Unfortunately I am not able to register and I cannot find the problem,
> > although a softphone
> > (X-Lite) CAN register by using the same creds. The credentials
> > are:
> >
> > SIP username: roland
> > SIP password: roland
> > SIP realm: 10.0.4.60
> >
> > There is no acl activated.
> >
> > The freeswitch versions I have tested are 1.0.2 and the trunk of today
> > (11480).
> >
> > I hope someone on the list could take a look on the trace I attached
> > below and give
> > me a hint what goes wrong.
> >
> > Thank you very much in advance.
> >
> > Roland
> >
> >
> >
> >
> > tport_wakeup_pri(0x81042c8): events IN
> > tport_recv_event(0x81042c8)
> > tport_recv_iovec(0x81042c8) msg 0xb3415ed8 from (udp/10.0.4.60:5060)
> > has
> > 373 bytes, veclen = 1
> > recv 373 bytes from udp/[10.0.2.51]:32816 at 17:01:30.461289:
> >
> >
> ------------------------------------------------------------------------
> >   REGISTER sip:10.0.4.60:5060 SIP/2.0
> >   Via: SIP/2.0/UDP 10.0.2.51:32816;rport;branch=z9hG4bK33562
> >   Max-Forwards: 70
> >   To: "roland" <sip:roland at 10.0.4.60:5060>
> >   From: "roland" <sip:roland at 10.0.4.60:5060>;tag=z9hG4bK84430669
> >   Call-ID: 218108472980 at 10.0.2.51
> >   CSeq: 1 REGISTER
> >   Contact: <sip:roland at 10.0.2.51:32816>
> >   Expires: 3600
> >   User-Agent: ZaKoSIP v1.2
> >   Content-Length: 0
> >
> >
> >
> ------------------------------------------------------------------------
> > tport_deliver(0x81042c8): msg 0xb3415ed8 (373 bytes) from
> > udp/10.0.2.51:5060/sip next=(nil)
> > nta: received REGISTER sip:10.0.4.60:5060 SIP/2.0 (CSeq 1)
> > nta: canonizing sip:10.0.4.60:5060 with contact
> > nta: REGISTER (1) going to a default leg
> > nua: nua_stack_process_request: entering
> > nua: nh_create: entering
> > nua: nh_create_handle: entering
> > nua: nua_stack_set_params: entering
> > soa_clone(static::0x80fe270, 0x80f9448, 0xb3402b30) called
> > soa_set_params(static::0xb341ba78, ...) called
> > nua: nua_application_event: entering
> > nua: nua_respond: entering
> > nua(0xb3402b30): sent signal r_respond
> > 2009-01-24 18:01:30 [DEBUG] sofia_reg.c:883
> > sofia_reg_handle_register()
> > Requesting Registration from: [roland at 10.0.4.60]
> > nua: nua_handle_destroy: entering
> > nua(0xb3402b30): sent signal r_destroy
> > nua: nua_handle_magic: entering
> > nua: nua_handle_destroy: entering
> > nua: nua_stack_set_params: entering
> > soa_set_params(static::0xb341ba78, ...) called
> > tport_tsend(0x81042c8) tpn = UDP/10.0.2.51:32816
> > tport_resolve addrinfo = 10.0.2.51:32816
> > tport_by_addrinfo(0x81042c8): not found by name UDP/10.0.2.51:32816
> > tport_vsend returned 620
> > send 620 bytes to udp/[10.0.2.51]:32816 at 17:01:30.586602:
> >
> >
> ------------------------------------------------------------------------
> >   SIP/2.0 401 Unauthorized
> >   Via: SIP/2.0/UDP 10.0.2.51:32816;rport=32816;branch=z9hG4bK33562
> >   From: "roland" <sip:roland at 10.0.4.60:5060>;tag=z9hG4bK84430669
> >   To: "roland" <sip:roland at 10.0.4.60:5060>;tag=aZa7matyy5Uca
> >   Call-ID: 218108472980 at 10.0.2.51
> >   CSeq: 1 REGISTER
> >   User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-11480
> >   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE,
> > NOTIFY, REFER, UPDATE, REGISTER, INFO, PUBLISH
> >   Supported: timer, precondition, path, replaces
> >   WWW-Authenticate: Digest realm="10.0.4.60",
> > nonce="a5608fcc-ea38-11dd-8437-6d678b851040", algorithm=MD5,
> > qop="auth"
> >   Content-Length: 0
> >
> >
> >
> ------------------------------------------------------------------------
> > nta: sent 401 Unauthorized for REGISTER (1)
> > nta: timer set to 32000 ms
> > nta_leg_destroy((nil))
> > soa_destroy(static::0xb341ba78) called
> > tport_wakeup_pri(0x81042c8): events IN
> > tport_recv_event(0x81042c8)
> > tport_recv_iovec(0x81042c8) msg 0xb3444050 from (udp/10.0.4.60:5060)
> > has
> > 575 bytes, veclen = 1
> > recv 575 bytes from udp/[10.0.2.51]:32816 at 17:01:30.614376:
> >
> >
> ------------------------------------------------------------------------
> >   REGISTER sip:10.0.4.60:5060 SIP/2.0
> >   Via: SIP/2.0/UDP 10.0.2.51:32816;rport;branch=z9hG4bK33562
> >   Max-Forwards: 70
> >   To: "roland" <sip:roland at 10.0.4.60:5060>
> >   From: "roland" <sip:roland at 10.0.4.60:5060>;tag=z9hG4bK84430669
> >   Call-ID: 218108472980 at 10.0.2.51
> >   CSeq: 2 REGISTER
> >   Contact: <sip:roland at 10.0.2.51:32816>
> >   Expires: 3600
> >   User-Agent: ZaKoSIP v1.2
> >   Authorization: Digest username="roland", realm="10.0.4.60",
> > nonce="a5608fcc-ea38-11dd-8437-6d678b851040", uri="sip:
> > 10.0.4.60:5060",
> > algorithm=MD5, qop=auth, response="2f26d787c68ac2a342a4b1d7bb49a1a0"
> >   Content-Length: 0
> >
> >
> >
> ------------------------------------------------------------------------
> > tport_deliver(0x81042c8): msg 0xb3444050 (575 bytes) from
> > udp/10.0.2.51:5060/sip next=(nil)
> > nta: received REGISTER sip:10.0.4.60:5060 SIP/2.0 (CSeq 2)
> > nta: canonizing sip:10.0.4.60:5060 with contact
> > nta: REGISTER (2) going to a default leg
> > nua: nua_stack_process_request: entering
> > nua: nh_create: entering
> > nua: nh_create_handle: entering
> > nua: nua_stack_set_params: entering
> > soa_clone(static::0x80fe270, 0x80f9448, 0xb3445690) called
> > soa_set_params(static::0xb341ba78, ...) called
> > nua: nua_application_event: entering
> > 2009-01-24 18:01:30 [DEBUG] sofia_reg.c:869
> > sofia_reg_handle_register()
> > Send challenge for [roland at 10.0.4.60]
> > nua: nua_respond: entering
> > nua(0xb3445690): sent signal r_respond
> > nua: nua_handle_destroy: entering
> > nua(0xb3445690): sent signal r_destroy
> > nua: nua_handle_magic: entering
> > nua: nua_handle_destroy: entering
> > nua: nua_stack_set_params: entering
> > soa_set_params(static::0xb341ba78, ...) called
> > tport_tsend(0x81042c8) tpn = UDP/10.0.2.51:32816
> > tport_resolve addrinfo = 10.0.2.51:32816
> > tport_by_addrinfo(0x81042c8): not found by name UDP/10.0.2.51:32816
> > tport_vsend returned 500
> > send 500 bytes to udp/[10.0.2.51]:32816 at 17:01:30.617125:
> >
> >
> ------------------------------------------------------------------------
> >   SIP/2.0 403 Forbidden
> >   Via: SIP/2.0/UDP 10.0.2.51:32816;rport=32816;branch=z9hG4bK33562
> >   From: "roland" <sip:roland at 10.0.4.60:5060>;tag=z9hG4bK84430669
> >   To: "roland" <sip:roland at 10.0.4.60:5060>;tag=B83Zp5a2UejZN
> >   Call-ID: 218108472980 at 10.0.2.51
> >   CSeq: 2 REGISTER
> >   User-Agent: FreeSWITCH-mod_sofia/1.0.trunk-11480
> >   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE,
> > NOTIFY, REFER, UPDATE, REGISTER, INFO, PUBLISH
> >   Supported: timer, precondition, path, replaces
> >   Content-Length: 0
> >
> >
> >
> ------------------------------------------------------------------------
> > nta: sent 403 Forbidden for REGISTER (2)
> > nta_leg_destroy((nil))
> > soa_destroy(static::0xb341ba78) called
>
>
> _______________________________________________
> Freeswitch-dev mailing list
> Freeswitch-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
> _______________________________________________
> Freeswitch-dev mailing list
> Freeswitch-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>



-- 
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
iax:guest at conference.freeswitch.org/888
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:213-799-1400
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20090124/c21e06d1/attachment-0001.html 


More information about the Freeswitch-dev mailing list