<HTML dir=ltr><HEAD><TITLE>Re: [OpenSIPS-Users] UAC_REDIRECT : get_redirects doesnot rewritehost</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.6001.18148" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText96943 dir=ltr>
<DIV dir=ltr><FONT face="Courier New" color=#000000 size=2>Hi, I found a fix to this problem, in some circumstances the contact header is already parsed when hiting shmcontact2dset() </FONT></DIV>
<DIV dir=ltr><FONT face="Courier New" color=#000000 size=2>however it is not parsed by parse_contact(), I have set a logging entry in there.</FONT></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr><FONT face="Courier New" size=2>My fix/workaround is simply to force it to parse again :</FONT> </DIV>
<DIV dir=ltr><FONT face="Courier New" size=2></FONT> </DIV>
<DIV dir=ltr><FONT face="Courier New" size=2> // start modification</FONT></DIV>
<DIV dir=ltr><FONT face="Courier New" color=#000000 size=2> int* b=0;<BR> contact_hdr->parsed =(void*)b;</FONT></DIV>
<DIV dir=ltr><FONT face="Courier New" color=#000000 size=2> // end modification<BR> /* parse the body of contact header */<BR> if (contact_hdr->parsed==0) {<BR> if ( parse_contact(contact_hdr)<0 ) {<BR> LM_ERR("contact hdr parse failed\n");<BR> ret = -1;<BR> goto restore;<BR> }<BR> if (dup==0)<BR> dup = 1;<BR> }<BR></FONT></DIV>
<DIV dir=ltr><FONT face="Courier New" color=#000000 size=2>Could we find out why it is parsed in a way that result in this confusion between</FONT></DIV>
<DIV dir=ltr><FONT face="Courier New" color=#000000 size=2>Contact and VIA header, this would be better.</DIV></FONT></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> users-bounces@lists.opensips.org on behalf of Julien Chavanton<BR><B>Sent:</B> Tue 18/08/2009 12:06 AM<BR><B>To:</B> OpenSIPS users mailling list; OpenSIPS users mailling list<BR><B>Subject:</B> Re: [OpenSIPS-Users] UAC_REDIRECT : get_redirectsdoesnot rewritehost<BR></FONT><BR></DIV>
<DIV dir=ltr>
<DIV id=idOWAReplyText66095 dir=ltr>
<DIV dir=ltr><FONT face=Verdana color=#000000 size=2>Hi Bogdan, I installed a test server with</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Verdana size=2>1.5.1</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2>1.5.2</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2>and the SVN </FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Verdana size=2>I have the same behavior, where the IP adress is not taken from the contact header but from somewhere else (maybe the VIA hdr)</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Verdana size=2>The setup I have in my lab :</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2>X-Lite(caller computer) and another X-Lite(called computer).</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2>I set X-Lite(called computer), to forward the call to another target <A href="mailto:new_target@1.1.1.1">new_target@1.1.1.1</A> for example.</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Verdana size=2>Maybe I should test with gateway instead of registered phones.</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2></FONT> </DIV>
<DIV dir=ltr><FONT face=Verdana size=2>Regards</FONT></DIV></DIV>
<DIV dir=ltr>
<DIV dir=ltr><BR></DIV></DIV>
<DIV dir=ltr>
<DIV dir=ltr>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr><FONT face=Tahoma size=2><B>From:</B> users-bounces@lists.opensips.org on behalf of Bogdan-Andrei Iancu<BR><B>Sent:</B> Fri 14/08/2009 8:51 AM<BR><B>To:</B> OpenSIPS users mailling list<BR><B>Subject:</B> Re: [OpenSIPS-Users] UAC_REDIRECT : get_redirects doesnot rewritehost<BR></FONT><BR></DIV></DIV>
<DIV>
<P><FONT size=2>Hi Julien,<BR><BR>Could you please try the latest 1.5 from SVN (1.5.2) ? I remember there<BR>were some fixes in the uac_redirect part and I want to be sure we are<BR>not troubleshooting it again.<BR><BR>What is really strange is that the IP in the printed contacts is<BR>actually the IP + port from VIA hdr :-/..<BR><BR>If upgrading is an issue for you, I can prepare some debuging patch to<BR>print more stuff and to see where the change comes from.<BR><BR>Regards,<BR>Bogdan<BR><BR>Julien Chavanton wrote:<BR>> I have activated full debug mode, sort_contacts() seems to find the<BR>> host somewhere else ?<BR>> Maybe this will help you understand what is going on<BR>> <BR>> <BR>> #<BR>> U 10.0.1.73:57226 -> 10.0.5.10:5060<BR>> SIP/2.0 302 Moved Temporarily.<BR>> Via: SIP/2.0/UDP 10.0.5.10;branch=z9hG4bK2714.0ee86a21.0.<BR>> Via: SIP/2.0/UDP<BR>> 10.0.1.73:57226;received=10.0.1.73;branch=z9hG4bK-d8754z-7048034193434959-1---d8754z-;rport=57226.<BR>> Contact: <sip:new_target@10.0.1.1:5060>.<BR>> To: "777"<sip:777@osip.domain.com>;tag=944d064a.<BR>> From: "777"<sip:777@osip.domain.com>;tag=d650bd17.<BR>> Call-ID: YmI3ZmQ0Mzk2MDE3OGY0M2FlNjVkNGVlY2EwZmI5NzM..<BR>> CSeq: 1 INVITE.<BR>> User-Agent: X-Lite release 1103d stamp 53117.<BR>> Content-Length: 0.<BR>> <BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]: ***FAILURE ROUTE<BR>> - REDIRECT ru[sip:777@10.0.1.73:57226;rinstance=c699f35c276783d3]**<BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]:<BR>> DBG:uac_redirect:get_redirect: resume branch=0<BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]:<BR>> DBG:uac_redirect:get_redirect: checking branch=0 (added=0)<BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]:<BR>> DBG:uac_redirect:get_redirect: branch=0 is a redirect (added=0)<BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]:<BR>> DBG:uac_redirect:sort_contacts: sort_contacts:<BR>> <sip:new_target@10.0.1.73:57226> q=10<BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]:<BR>> DBG:uac_redirect:shmcontact2dset: adding contact<BR>> <sip:new_target@10.0.1.73:57226><BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]:<BR>> DBG:core:parse_headers: flags=78<BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]: ACC: request<BR>> accounted:<BR>> timestamp=1250195007;method=INVITE;from_tag=d61cb370;to_tag=;call_id=NDA2ZmI4YmNmMjJmMGNjYjI4YjUxODUyNTNkZmUyNzQ.;code=;reason=redirect<BR>><BR>> Aug 13 21:23:27 osip /usr/local/sbin/opensips[16925]: ***FAILURE ROUTE<BR>> - REDIRECTED TO: sip:new_target@10.0.1.73:57226]** .<BR>> <BR>><BR>> ------------------------------------------------------------------------<BR>> *From:* users-bounces@lists.opensips.org on behalf of Julien Chavanton<BR>> *Sent:* Thu 13/08/2009 6:43 PM<BR>> *To:* OpenSIPS users mailling list; OpenSIPS users mailling list<BR>> *Subject:* Re: [OpenSIPS-Users] UAC_REDIRECT : get_redirects does not<BR>> rewritehost<BR>><BR>> Hi Bogdan,<BR>> <BR>> version: opensips 1.5.1-notls (x86_64/linux)<BR>> <BR>> failure_route[1] {<BR>> sip_trace();<BR>> if (t_check_status("302")) {<BR>> xlog("L_NOTICE", "***FAILURE ROUTE - REDIRECT<BR>> ru[$ru]**\n");<BR>> get_redirects("6:2","redirect");<BR>> xlog("L_NOTICE", "***FAILURE ROUTE - REDIRECTED TO:<BR>> $ru]**\n");<BR>> t_relay();<BR>> }<BR>> }<BR>> <BR>> Aug 13 18:44:17 osip /usr/local/sbin/opensips[16565]: ***FAILURE ROUTE<BR>> - REDIRECT ru[sip:777@10.0.1.73:57226;rinstance=c699f35c276783d3]**<BR>> Aug 13 18:44:17 osip /usr/local/sbin/opensips[16565]: ***FAILURE ROUTE<BR>> - REDIRECTED TO: ru[sip:new_target@10.0.1.73:57226]**<BR>> <BR>><BR>> ------------------------------------------------------------------------<BR>> *From:* users-bounces@lists.opensips.org on behalf of Bogdan-Andrei Iancu<BR>> *Sent:* Thu 13/08/2009 6:29 PM<BR>> *To:* OpenSIPS users mailling list<BR>> *Subject:* Re: [OpenSIPS-Users] UAC_REDIRECT : get_redirects does not<BR>> rewrite host<BR>><BR>> Hi Julien,<BR>><BR>> The get_redirects() function does replace the entire RURI with the<BR>> contact URI. My feeling is you (by mistake) rewrite the domain part<BR>> after the new RURI is set - try printing the RURI just after the<BR>> get_redirects() function.<BR>><BR>> BTW, what version of opensips are you using?<BR>><BR>> Regards,<BR>> Bogdan<BR>><BR>> Julien Chavanton wrote:<BR>> > I am looking to handle redirect 302 request, get_redirect does not<BR>> > replace the domain/host part of the new target ?<BR>> ><BR>> > How do we handle redirection to a different IP address ?<BR>> ><BR>> ><BR>> > Example :<BR>> ><BR>> > U 10.0.4.44:5060 -> 10.0.1.73:57226<BR>> > INVITE sip:777@10.0.1.73:57226;rinstance=c699f35c276783d3 SIP/2.0.<BR>> ><BR>> > U 10.0.1.73:57226 -> 10.0.4.44:5060<BR>> > SIP/2.0 302 Moved Temporarily.<BR>> > Contact: <sip:new_target@10.0.1.1:5060>.<BR>> ><BR>> > U 10.0.4.44:5060 -> 10.0.1.73:57226<BR>> > INVITE sip:new_target@10.0.1.73:57226 SIP/2.0.<BR>> > ------------------------------------------------------------------------<BR>> ><BR>> > _______________________________________________<BR>> > Users mailing list<BR>> > Users@lists.opensips.org<BR>> > <A href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</A><BR>> > <BR>><BR>><BR>> _______________________________________________<BR>> Users mailing list<BR>> Users@lists.opensips.org<BR>> <A href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</A><BR>><BR>> ------------------------------------------------------------------------<BR>><BR>> _______________________________________________<BR>> Users mailing list<BR>> Users@lists.opensips.org<BR>> <A href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</A><BR>> <BR><BR><BR>_______________________________________________<BR>Users mailing list<BR>Users@lists.opensips.org<BR><A href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</A><BR></FONT></P></DIV></DIV></BODY></HTML>