Hi Dmitri,

In fact, this is all standard behavior, unfortunately. Imagine you would have a 
proxy instead of SEMS-SBC, and the credentials would come from the UAC on the 
other far end, then, there is no way for the proxy to guess which proxy to send 
it to. However, the classical way to work around this issue would be to 
introduce blacklisting, in a way to at least speed up the process. 
Unfortunately, SEMS does not have such a DNS blacklisting mechanism. But it 
would definitely be beneficial. So, if you feel like you could do it, please go 
ahead ;-)

Cheers
Raphael.

On 17.10.2012, at 15:30, Dmitry Sinina wrote:

> I'm using SEMS sbc dns srv rerouting + uac_auth.
> 
> I have domain( onat.edu.ua ) with 2 srv records.
> 
> >dig -t SRV _sip._udp.onat.edu.ua
> ;; ANSWER SECTION:
> _sip._udp.onat.edu.ua.  600     IN      SRV     0 0 5060 io.onat.edu.ua.
> _sip._udp.onat.edu.ua.  600     IN      SRV     0 0 5060 astx.onat.edu.ua.
> 
> also server  io.onat.edu.ua  which doesn't respond , (server doesn't work 
> special for testing)
> 
> If SEMS send requests to  astx.onat.edu.ua firstly, I have no problems with 
> it.
> But if io.on:at.edu.ua  is selected for first request and if authorizations 
> is turned on, we can see next
> 
> 
> [22428//home/sdi/projects/sems/core/sip/resolver.cpp:486] DEBUG: SRV:  
> TTL=600 _sip._udp.onat.edu.ua   P=<0> W=<0> P=<5060> T=<io.onat.edu.ua>
> [22428//home/sdi/projects/sems/core/sip/resolver.cpp:486] DEBUG: SRV:  
> TTL=600 _sip._udp.onat.edu.ua   P=<0> W=<0> P=<5060> T=<astx.onat.edu.ua>
> [22428//home/sdi/projects/sems/core/sip/resolver.cpp:452] DEBUG: A:  TTL=600 
> io.onat.edu.ua  193.186.15.22
> [22428//home/sdi/projects/sems/core/sip/trans_layer.cpp:910] DEBUG: 
> send_request to R-URI <sip:[email protected]>
> [22428//home/sdi/projects/sems/core/sip/parse_uri.cpp:332] DEBUG: Converted 
> URI port () to int (5060)
> [22428//home/sdi/projects/sems/core/sip/parse_via.cpp:525] DEBUG: parsed 
> branch: z9hG4bKT54ULayN
> [22428//home/sdi/projects/sems/core/sip/parse_via.cpp:548] DEBUG: has_rport: 1
> [22428//home/sdi/projects/sems/core/sip/trans_layer.cpp:980] DEBUG: Sending 
> to 193.186.15.22:5060 <INVITE sip:[email protected] SIP/2.0
> Via: SIP/2.0/U...>
> [22428//home/sdi/projects/sems/core/sip/transport.cpp:109] DEBUG: send  msg
> --++--
> INVITE sip:[email protected] SIP/2.0
> Via: SIP/2.0/UDP 192.168.0.222:5080;branch=z9hG4bKT54ULayN;rport
> From: "6786" <sip:[email protected]>;tag=54FC5CA7-507EA949000A8358-98F73700
> To: <sip:[email protected]>
> CSeq: 10 INVITE
> Call-ID: 312A7800-507EA949000A8360-98F73700
> Contact: <sip:192.168.0.222>
> Max-Forwards: 70
> Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,REFER,NOTIFY,SUBSCRIBE,INFO,MESSAGE
> Supported: replaces,norefersub,100rel
> Max-Forwars: 70
> User-Agent: YETI sbc
> Content-Type: application/sdp
> Content-Length: 337
> 
> v=0
> o=- 1310451886 99007291 IN IP4 192.168.0.222
> s=call
> c=IN IP4 192.168.0.222
> t=0 0
> m=audio 10000 RTP/AVP 98 97 8 0 3 101
> a=rtpmap:98 speex/16000
> a=rtpmap:97 speex/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:3 GSM/8000
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-15
> a=sendrecv
> a=ptime:20
> a=direction:both
> 
> 
> # SKIPPED .............
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:157] DEBUG: Transaction 
> timer expired: type=A, trans=0x12a36f0, eta=317, t=317
> [22516//home/sdi/projects/sems/core/sip/transport.cpp:109] DEBUG: send  msg
> # RETRANSMIT.........
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:188] DEBUG: New timer 
> of type A at time=367 (repeated=1)
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:140] DEBUG: Clearing 
> old timer of type A (this=0x12a3800)
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:157] DEBUG: Transaction 
> timer expired: type=A, trans=0x12a36f0, eta=367, t=367
> [22516//home/sdi/projects/sems/core/sip/transport.cpp:109] DEBUG: send  msg
> # RETRANSMIT.........
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:188] DEBUG: New timer 
> of type A at time=467 (repeated=2)
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:140] DEBUG: Clearing 
> old timer of type A (this=0x1028840)
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:157] DEBUG: Transaction 
> timer expired: type=A, trans=0x12a36f0, eta=467, t=467
> [22516//home/sdi/projects/sems/core/sip/transport.cpp:109] DEBUG: send  msg
> # RETRANSMIT.........
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:157] DEBUG: Transaction 
> timer expired: type=M, trans=0x12a36f0, eta=692, t=692
> [22516//home/sdi/projects/sems/core/sip/resolver.cpp:452] DEBUG: A:  TTL=600 
> astx.onat.edu.ua        193.186.15.18
> [22516//home/sdi/projects/sems/core/sip/transport.cpp:109] DEBUG: send  msg
> # RETRANSMIT to new destination - 193.186.15.18 - valid switch
> 
> NVITE sip:[email protected] SIP/2.0
> Via: SIP/2.0/UDP 192.168.0.222:5080;branch=z9hG4bKnHkpWaUi;rport
> From: "6786" <sip:[email protected]>;tag=54FC5CA7-507EA949000A8358-98F73700
> To: <sip:[email protected]>
> CSeq: 10 INVITE
> Call-ID: 312A7800-507EA949000A8360-98F73700
> Contact: <sip:192.168.0.222>
> Max-Forwards: 70
> Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,REFER,NOTIFY,SUBSCRIBE,INFO,MESSAGE
> Supported: replaces,norefersub,100rel
> Max-Forwars: 70
> User-Agent: YETI sbc
> Content-Type: application/sdp
> Content-Length: 337
> 
> v=0
> o=- 1310451886 99007291 IN IP4 192.168.0.222
> s=call
> c=IN IP4 192.168.0.222
> t=0 0
> m=audio 10000 RTP/AVP 98 97 8 0 3 101
> a=rtpmap:98 speex/16000
> a=rtpmap:97 speex/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:3 GSM/8000
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-15
> a=sendrecv
> a=ptime:20
> a=direction:both
> 
> --++--
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:188] DEBUG: New timer 
> of type A at time=717 (repeated=0)
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:140] DEBUG: Clearing 
> old timer of type A (this=0x1028840)
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:188] DEBUG: New timer 
> of type M at time=1092 (repeated=0)
> [22516//home/sdi/projects/sems/core/sip/sip_trans.cpp:140] DEBUG: Clearing 
> old timer of type M (this=0x12a3880)
> [22517//home/sdi/projects/sems/core/sip/udp_trsp.cpp:213] DEBUG: vv M [|] u 
> recvd msg via UDP vv
> --++--
> SIP/2.0 407 Proxy Authentication Required
> Via: SIP/2.0/UDP 
> 192.168.0.222:5080;branch=z9hG4bKnHkpWaUi;received=192.168.0.222;rport=5080
> From: "6786" <sip:[email protected]>;tag=54FC5CA7-507EA949000A8358-98F73700
> To: <sip:[email protected]>;tag=as75fde410
> Call-ID: 312A7800-507EA949000A8360-98F73700
> CSeq: 10 INVITE
> User-Agent: Asterisk PBX
> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
> Supported: replaces
> Proxy-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="071891a9"
> Content-Length: 0
> 
> # ACK received
> 
> [22428//home/sdi/projects/sems/core/AmSipDialog.cpp:387] DEBUG: onRxReply(rep 
> = 407 Proxy Authentication Required): transaction found!
> [22428//home/sdi/projects/sems/apps/sbc_sql/SBC.cpp:2139] DEBUG: onSipReply: 
> 407 Proxy Authentication Required (fwd=1)
> [22428//home/sdi/projects/sems/apps/sbc_sql/SBC.cpp:2140] DEBUG: onSipReply: 
> content-type =
> [22428//home/sdi/projects/sems/core/plug-in/uac_auth/UACAuth.cpp:133] DEBUG: 
> SIP reply with code 407 cseq 10 .
> [22428//home/sdi/projects/sems/core/plug-in/uac_auth/UACAuth.cpp:139] DEBUG:  
> UACAuth - processing with reply code 407
> [22428//home/sdi/projects/sems/core/plug-in/uac_auth/UACAuth.cpp:335] DEBUG: 
> realm='asterisk', nonce='071891a9', qop=''
> [22428//home/sdi/projects/sems/core/plug-in/uac_auth/UACAuth.cpp:381] DEBUG: 
> calculated response = 0e765eb8d3d099823453246e4f963543
> [22428//home/sdi/projects/sems/core/plug-in/uac_auth/UACAuth.cpp:402] DEBUG: 
> Auth req hdr: 'Proxy-Authorization: Digest username="123", realm="asterisk", 
> nonce="071891a9", uri="sip:[email protected]", 
> response="0e765eb8d3d0998250d94c6e4f9633d3", algorithm=MD5
> '
> [22428//home/sdi/projects/sems/core/AmOfferAnswer.cpp:69] DEBUG: setting SIP 
> dialog O/A status: None->None
> [22428//home/sdi/projects/sems/apps/sbc_sql/SBC.cpp:2166] DEBUG: 
> auth->onSendRequest cseq = 11
> [22428//home/sdi/projects/sems/core/plug-in/uac_auth/UACAuth.cpp:241] DEBUG: 
> adding 11 to list of sent requests.
> [22428//home/sdi/projects/sems/core/sip/parse_uri.cpp:332] DEBUG: Converted 
> URI port () to int (5060)
> [22428//home/sdi/projects/sems/core/sip/trans_layer.cpp:705] DEBUG: 
> next_hop:next_port is <onat.edu.ua:0>
> [22428//home/sdi/projects/sems/core/sip/trans_layer.cpp:716] DEBUG: checking 
> whether 'onat.edu.ua' is IP address...
> [22428//home/sdi/projects/sems/core/sip/trans_layer.cpp:729] DEBUG: no port 
> specified, looking up SRV '_sip._udp.onat.edu.ua'...
> [22428//home/sdi/projects/sems/core/sip/trans_layer.cpp:910] DEBUG: 
> send_request to R-URI <sip:[email protected]>
> [22428//home/sdi/projects/sems/core/sip/parse_uri.cpp:332] DEBUG: Converted 
> URI port () to int (5060)
> [22428//home/sdi/projects/sems/core/sip/parse_via.cpp:525] DEBUG: parsed 
> branch: z9hG4bKs03FAa~R
> [22428//home/sdi/projects/sems/core/sip/parse_via.cpp:548] DEBUG: has_rport: 1
> [22428//home/sdi/projects/sems/core/sip/trans_layer.cpp:980] DEBUG: Sending 
> to 193.186.15.22:5060 <INVITE sip:[email protected] SIP/2.0
> Via: SIP/2.0/U...>
> [22428//home/sdi/projects/sems/core/sip/transport.cpp:109] DEBUG: send  msg
> 
> ## Sems send invite with Proxy-Authorization BUT use broken gateway 
> again(193.186.15.22)
> 
> --++--
> INVITE sip:[email protected] SIP/2.0
> Via: SIP/2.0/UDP 192.168.0.222:5080;branch=z9hG4bKs03FAa~R;rport
> From: "6786" <sip:[email protected]>;tag=54FC5CA7-507EA949000A8358-98F73700
> To: <sip:[email protected]>
> CSeq: 11 INVITE
> Call-ID: 312A7800-507EA949000A8360-98F73700
> Contact: <sip:192.168.0.222>
> Max-Forwards: 70
> Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,PRACK,REFER,NOTIFY,SUBSCRIBE,INFO,MESSAGE
> Supported: replaces,norefersub,100rel
> Max-Forwars: 70
> User-Agent: YETI sbc
> Proxy-Authorization: Digest username="123", realm="asterisk", 
> nonce="071891a9", uri="sip:[email protected]", 
> response="0e765eb8d3d099823453246e4f963543", algorithm=MD5
> Content-Type: application/sdp
> Content-Length: 337
> 
> v=0
> o=- 1310451886 99007291 IN IP4 192.168.0.222
> s=call
> c=IN IP4 192.168.0.222
> t=0 0
> m=audio 10000 RTP/AVP 98 97 8 0 3 101
> a=rtpmap:98 speex/16000
> a=rtpmap:97 speex/8000
> a=rtpmap:8 PCMA/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:3 GSM/8000
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-15
> a=sendrecv
> a=ptime:20
> a=direction:both
> 
> 
> After few retransmits  Invite with Proxy-Authorization finally  was finally 
> sent to working gateway
> Maybe it have to send invite to gateway, which has respond with 470 before 
> (not doing repeating of  DNS SRV rerouting )?
> _______________________________________________
> Sems mailing list
> [email protected]
> http://lists.iptel.org/mailman/listinfo/sems

_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to