Hello,
I have a problem with proxy authentication.

My user agent registers itself with proxy without a problem. However 
when I want it to redirect a call, the following happens:

1) REFER is sent to proxy
2) Proxy answers with 407
3) In nua_r_refer event I use this code to answer the challenge:

const char* realm = 
msg_params_find(sip->sip_proxy_authenticate->au_params, "realm=");
sprintf(authString, "Digest:%s:%s:%s", realm, proxy->username, 
proxy->password);
nua_authenticate(proxy->proxyHandle, NUTAG_AUTH(authString), TAG_END());

4) Then I get 904 "No matching challenge"

proxy structure from which I get the username, password and handle is 
the same that I used to do the initial authentication with. I even tried 
to create new handle but that didn't help anything.

authString is 'Digest:"":username:password' (the realm is really empty)

Belov are sip messages logs. Registration with proxy is included...

Adding nameserver: 10.0.0.1
send 473 bytes to udp/[10.0.0.51]:5060 at 13:10:25.999258:
   ------------------------------------------------------------------------
   REGISTER sip:10.0.0.51:5060 SIP/2.0
   Via: SIP/2.0/UDP 10.0.0.9;rport;branch=z9hG4bK52vQBKrD7ZpFK
   Max-Forwards: 70
   From: <sip:[EMAIL PROTECTED]>;tag=5cNrS94U0rQea
   To: <sip:[EMAIL PROTECTED]>
   Call-ID: 93344db1-4069-122b-2780-39a48cb53b8d
   CSeq: 94212576 REGISTER
   Contact: <sip:10.0.0.9>
   User-Agent: OptimTalk / 1.6
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, 
NOTIFY,
REFER, UPDATE, INFO, REGISTER
   Supported: timer, 100rel, path
   Content-Length: 0

   ------------------------------------------------------------------------
recv 374 bytes from udp/[10.0.0.51]:10074 at 13:10:26.046133:
   ------------------------------------------------------------------------
   SIP/2.0 401 Unauthorized
   WWW-Authenticate: Digest 
qop="auth",nonce="a3b7eb4e3ee6386fdc4457113188c4f4",
realm=""
   To: <sip:[EMAIL PROTECTED]>;tag=0fe78084e91e670de6a4f7505e6ad615
   From: <sip:[EMAIL PROTECTED]>;tag=5cNrS94U0rQea
   Call-ID: 93344db1-4069-122b-2780-39a48cb53b8d
   CSeq: 94212576 REGISTER
   Via: SIP/2.0/UDP 10.0.0.9;rport;branch=z9hG4bK52vQBKrD7ZpFK
   Content-Length: 0

   ------------------------------------------------------------------------
send 705 bytes to udp/[10.0.0.51]:5060 at 13:10:26.046133:
   ------------------------------------------------------------------------
   REGISTER sip:10.0.0.51:5060 SIP/2.0
   Via: SIP/2.0/UDP 10.0.0.9;rport;branch=z9hG4bK6BpgDe9g48c2e
   Max-Forwards: 70
   From: <sip:[EMAIL PROTECTED]>;tag=5cNrS94U0rQea
   To: <sip:[EMAIL PROTECTED]>
   Call-ID: 93344db1-4069-122b-2780-39a48cb53b8d
   CSeq: 94212577 REGISTER
   Contact: <sip:10.0.0.9>
   User-Agent: OptimTalk / 1.6
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, 
NOTIFY,
REFER, UPDATE, INFO, REGISTER
   Supported: timer, 100rel, path
   Authorization: Digest username="556", realm="", 
nonce="a3b7eb4e3ee6386fdc4457
113188c4f4", cnonce="kz3XGUBpEiuAKDmkjLU7jQ", algorithm=MD5, 
uri="sip:10.0.0.51:
5060", response="4cbbbe6adf51b8d6d12228725402714d", qop=auth, nc=00000001
   Content-Length: 0

   ------------------------------------------------------------------------
recv 315 bytes from udp/[10.0.0.51]:10074 at 13:10:26.093008:
   ------------------------------------------------------------------------
   SIP/2.0 200 OK
   Contact: <sip:10.0.0.9>;expires=1800
   To: <sip:[EMAIL PROTECTED]>;tag=6ac48445fe9f43cf0f8817bf03449bc7
   From: <sip:[EMAIL PROTECTED]>;tag=5cNrS94U0rQea
   Call-ID: 93344db1-4069-122b-2780-39a48cb53b8d
   CSeq: 94212577 REGISTER
   Via: SIP/2.0/UDP 10.0.0.9;rport;branch=z9hG4bK6BpgDe9g48c2e
   Content-Length: 0

   ------------------------------------------------------------------------
recv 488 bytes from udp/[10.0.0.51]:10074 at 13:10:50.499258:
   ------------------------------------------------------------------------
   ACK sip:10.0.0.9 SIP/2.0
   Via: SIP/2.0/UDP 
10.0.0.51;branch=z9hG4bK1034c4d8d286e62ed5baf52b2e88e4b7f878
b69db17088e46726339daef5d235
   Via: SIP/2.0/UDP 
10.0.0.9:49152;branch=z9hG4bK0a000009000000cb4790a55a000067a
0000000d8;rport
   From: "unknown" <sip:[EMAIL PROTECTED]>;tag=2b2513062ca
   To: <sip:[EMAIL PROTECTED]>;tag=2f36d8cd36887a3bfa4e6919d1ab18e5
   Call-ID: 3503EE8A233A49C1B501AD9C70BC8E4D0x0a000009
   CSeq: 1 ACK
   Max-Forwards: 69
   User-Agent: SJphone/1.65.377a (SJ Labs)
   Content-Length: 0

   ------------------------------------------------------------------------
nua(04FC7FF8): strange ACK from <sip:[EMAIL PROTECTED]>
recv 1191 bytes from udp/[10.0.0.51]:10074 at 13:10:50.593008:
   ------------------------------------------------------------------------
   INVITE sip:10.0.0.9 SIP/2.0
   Proxy-Authorization: Digest 
username="555",realm="",nonce="d61a607be306be6ec7
226e266a1649f7",uri="sip:[EMAIL 
PROTECTED]",response="53e7df248daf28a4ece7cd1bd8bbae
c6",cnonce="71ba1306376",qop=auth,nc=00000001
   Record-Route: <sip:10.0.0.51;lr;transport=UDP>
   Via: SIP/2.0/UDP 
10.0.0.51;branch=z9hG4bKbccefbe430e058fa95103b889c9f2193f25e
c854af5ceca6a73e9513a970447b
   Via: SIP/2.0/UDP 
10.0.0.9:49152;branch=z9hG4bK0a000009000000cc4790a55a00006bf
9000000db;rport
   From: "unknown" <sip:[EMAIL PROTECTED]>;tag=2b2513062ca
   To: <sip:[EMAIL PROTECTED]>
   Contact: <sip:[EMAIL PROTECTED]:49152>
   Call-ID: 3503EE8A233A49C1B501AD9C70BC8E4D0x0a000009
   CSeq: 2 INVITE
   Max-Forwards: 69
   User-Agent: SJphone/1.65.377a (SJ Labs)
   Content-Length: 353
   Content-Type: application/sdp
   Supported: replaces,norefersub,timer
   Session-Expires: 1800

   v=0
   o=- 3409650650 3409650650 IN IP4 10.0.0.9
   s=SJphone
   c=IN IP4 10.0.0.9
   t=0 0
   m=audio 49186 RTP/AVP 3 97 98 8 0 101
   c=IN IP4 10.0.0.9
   a=rtpmap:3 GSM/8000
   a=rtpmap:97 iLBC/8000
   a=rtpmap:98 iLBC/8000
   a=fmtp:98 mode=20
   a=rtpmap:8 PCMA/8000
   a=rtpmap:0 PCMU/8000
   a=rtpmap:101 telephone-event/8000
   a=fmtp:101 0-16
   a=setup:active
   a=sendrecv
   ------------------------------------------------------------------------
send 669 bytes to udp/[10.0.0.51]:5060 at 13:10:50.593008:
   ------------------------------------------------------------------------
   SIP/2.0 180 Ringing
   Via: SIP/2.0/UDP 
10.0.0.51;branch=z9hG4bKbccefbe430e058fa95103b889c9f2193f25e
c854af5ceca6a73e9513a970447b
   Via: SIP/2.0/UDP 
10.0.0.9:49152;branch=z9hG4bK0a000009000000cc4790a55a00006bf
9000000db;rport
   Record-Route: <sip:10.0.0.51;lr;transport=UDP>
   From: "unknown" <sip:[EMAIL PROTECTED]>;tag=2b2513062ca
   To: <sip:[EMAIL PROTECTED]>;tag=6NeHU4NZX1D1N
   Call-ID: 3503EE8A233A49C1B501AD9C70BC8E4D0x0a000009
   CSeq: 2 INVITE
   Contact: <sip:10.0.0.9>
   User-Agent: OptimTalk / 1.6
   Accept: application/sdp
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, 
NOTIFY,
REFER, UPDATE, INFO, REGISTER
   Supported: timer, 100rel
   Content-Length: 0

   ------------------------------------------------------------------------
send 912 bytes to udp/[10.0.0.51]:5060 at 13:10:51.733633:
   ------------------------------------------------------------------------
   SIP/2.0 200 OK
   Via: SIP/2.0/UDP 
10.0.0.51;branch=z9hG4bKbccefbe430e058fa95103b889c9f2193f25e
c854af5ceca6a73e9513a970447b
   Via: SIP/2.0/UDP 
10.0.0.9:49152;branch=z9hG4bK0a000009000000cc4790a55a00006bf
9000000db;rport
   Record-Route: <sip:10.0.0.51;lr;transport=UDP>
   From: "unknown" <sip:[EMAIL PROTECTED]>;tag=2b2513062ca
   To: <sip:[EMAIL PROTECTED]>;tag=6NeHU4NZX1D1N
   Call-ID: 3503EE8A233A49C1B501AD9C70BC8E4D0x0a000009
   CSeq: 2 INVITE
   Contact: <sip:10.0.0.9>
   User-Agent: OptimTalk / 1.6
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, 
NOTIFY,
REFER, UPDATE, INFO, REGISTER
   Require: timer
   Supported: timer, 100rel
   Session-Expires: 1800;refresher=uac
   Min-SE: 120
   Content-Type: application/sdp
   Content-Disposition: session
   Content-Length: 144

   v=0
   o=- 5514491549026692689 6960445610684699468 IN IP4 10.0.0.9
   s=-
   c=IN IP4 10.0.0.9
   t=0 0
   m=audio 16648 RTP/AVP 0
   a=rtpmap:0 PCMU/8000
   ------------------------------------------------------------------------
send 598 bytes to udp/[10.0.0.51]:5060 at 13:10:51.780508:
   ------------------------------------------------------------------------
   REFER sip:[EMAIL PROTECTED]:49152 SIP/2.0
   Via: SIP/2.0/UDP 10.0.0.9;rport;branch=z9hG4bK7mF9e9Sm1H3ma
   Route: <sip:10.0.0.51;lr;transport=UDP>
   Max-Forwards: 70
   From: <sip:[EMAIL PROTECTED]>;tag=6NeHU4NZX1D1N
   To: "unknown" <sip:[EMAIL PROTECTED]>;tag=2b2513062ca
   Call-ID: 3503EE8A233A49C1B501AD9C70BC8E4D0x0a000009
   CSeq: 94212589 REFER
   Contact: <sip:10.0.0.9>
   User-Agent: OptimTalk / 1.6
   Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, PRACK, MESSAGE, SUBSCRIBE, 
NOTIFY,
REFER, UPDATE, INFO, REGISTER
   Supported: timer, 100rel
   Refer-To: <sip:[EMAIL PROTECTED]>
   Referred-By: <sip:10.0.0.9>
   Content-Length: 0

   ------------------------------------------------------------------------
recv 385 bytes from udp/[10.0.0.51]:10074 at 13:10:51.827383:
   ------------------------------------------------------------------------
   SIP/2.0 407 Proxy Authentication Required
   Proxy-Authenticate: Digest 
qop="auth",nonce="a3b7eb4e3ee6386fdc4457113188c4f4
",realm=""
   To: "unknown" <sip:[EMAIL PROTECTED]>;tag=2b2513062ca
   From: <sip:[EMAIL PROTECTED]>;tag=6NeHU4NZX1D1N
   Call-ID: 3503EE8A233A49C1B501AD9C70BC8E4D0x0a000009
   CSeq: 94212589 REFER
   Via: SIP/2.0/UDP 10.0.0.9;rport;branch=z9hG4bK7mF9e9Sm1H3ma
   Content-Length: 0

---------------------------------------------------------------------------
<----- Here I get 904 response
---------------------------------------------------------------------------

   ------------------------------------------------------------------------
recv 708 bytes from udp/[10.0.0.51]:10074 at 13:10:51.858633:
   ------------------------------------------------------------------------
   ACK sip:10.0.0.9 SIP/2.0
   Proxy-Authorization: Digest 
username="555",realm="",nonce="d61a607be306be6ec7
226e266a1649f7",uri="sip:[EMAIL 
PROTECTED]",response="53e7df248daf28a4ece7cd1bd8bbae
c6",cnonce="71ba1306376",qop=auth,nc=00000001
   Via: SIP/2.0/UDP 
10.0.0.51;branch=z9hG4bK27807e78203adbeee91de184b3fe1e4059c1
e14d785726d0c938e8b9790fdbbb
   Via: SIP/2.0/UDP 
10.0.0.9:49152;branch=z9hG4bK0a000009000000cc4790a55b0000262
5000000e1;rport
   From: "unknown" <sip:[EMAIL PROTECTED]>;tag=2b2513062ca
   To: <sip:[EMAIL PROTECTED]>;tag=6NeHU4NZX1D1N
   Contact: <sip:[EMAIL PROTECTED]:49152>
   Call-ID: 3503EE8A233A49C1B501AD9C70BC8E4D0x0a000009
   CSeq: 2 ACK
   Max-Forwards: 69
   User-Agent: SJphone/1.65.377a (SJ Labs)
   Content-Length: 0

-- 
Martin Drasar, Developer / Analyst
OptimSys, s.r.o.
[EMAIL PROTECTED]
Tel: +420 541 143 065
Fax: +420 541 143 066
http://www.optimsys.cz


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to