<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <font face="monospace">Hi Babak,<br>
      <br>
      Are you somehow doing any fix_nated_contact() for that 302 reply??
      (maybe in the onreply_route)<br>
      <br>
      Regards,<br>
    </font>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 5-16 Dec 2022, online
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/">https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/</a></pre>
    <div class="moz-cite-prefix">On 11/15/22 3:02 PM, Babak Yakhchali
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAD3oNZwXeKSGX4K1YgWPNDuyw4_WA9vABwHZdEVX=mjQ5Lofjw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi
        <div>I'm tryin to handle 302 redirect replies to opensips, In my
          failure route I have this:</div>
        <div><br>
        </div>
        <div>if (t_check_status("30[12]") &&
          $(<reply>hdr(X-xferByCharger))== "true") {<br>
          <br>
                xlog("failure_route: redirect by charger to
          $(<reply>hdr(Contact))");<br>
                ....<br>
          <br>
                if (get_redirects(1,1)){<br>
                    xlog("failure_route: after redirect ru:$ru and
          du:$du");<br>
                     t_relay();<br>
                }<br>
                  exit;<br>
          }<br>
        </div>
        <div><br>
        </div>
        <div>and the 302 msg is:</div>
        <div>2022/11/15 15:29:25.253868 <a href="http://10.0.0.82:5060"
            moz-do-not-send="true">10.0.0.82:5060</a> -> <a
            href="http://10.0.0.192:5060" moz-do-not-send="true">10.0.0.192:5060</a><br>
          SIP/2.0 302 Moved Temporarily<br>
          Via: SIP/2.0/UDP 10.0.0.192:5060;branch=z9hG4bK4897.63b48a64.0<br>
          Via: SIP/2.0/UDP
172.18.120.236:49276;received=80.191.36.252;rport=49276;branch=z9hG4bK14771<br>
          Max-Forwards: 69<br>
          From: "" <<a href="mailto:sip%3A123456@my-domain.com"
            moz-do-not-send="true">sip:123456@my-domain.com</a>>;tag=5447<br>
          To: <<a class="moz-txt-link-freetext" href="sip:123456@">sip:123456@</a>
          <a href="http://my-domain.com:5060" moz-do-not-send="true">my-domain.com:5060</a>>;tag=6Dyya5c1yvpQK<br>
          Call-ID: 21726<br>
          CSeq: 20 INVITE<br>
          <b>Contact: "unknown" <<a
              href="mailto:sip%3A123456@10.0.0.109"
              moz-do-not-send="true">sip:123456@10.0.0.109</a>></b><br>
          User-Agent:
          FreeSWITCH-mod_sofia/1.9.0+git~20190122T161705Z~5ac757ce54~64bit<br>
          Accept: application/sdp<br>
          Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO,
          UPDATE, REGISTER, REFER, NOTIFY<br>
          Supported: timer, path, replaces<br>
          Allow-Events: talk, hold, conference, refer<br>
          Reason: Q.850;cause=31;text="NORMAL_UNSPECIFIED"<br>
          Content-Length: 0<br>
          <br>
        </div>
        <div>and opensips logs:</div>
        <div>Nov 15 15:52:12 lta-opensips-stage
          /usr/sbin/opensips[40099]: DBG:uac_redirect:get_redirect:
          resume branch=0<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:uac_redirect:get_redirect: checking branch=0 (added=0)<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:uac_redirect:get_redirect: branch=0 is a redirect
          (added=0)<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:core:parse_headers: flags=ffffffffffffffff<br>
          <b>Nov 15 15:52:12 lta-opensips-stage
            /usr/sbin/opensips[40099]: DBG:uac_redirect:sort_contacts:
            sort_contacts: <<a
              href="http://sip:123456@10.0.0.82:5060"
              moz-do-not-send="true">sip:123456@10.0.0.82:5060</a>>
            q=10</b><br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:uac_redirect:shmcontact2dset: 1 contacts remaining after
          filtering and sorting<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:uac_redirect:shmcontact2dset: adding contact <<a
            href="http://sip:123456@10.0.0.82:5060"
            moz-do-not-send="true">sip:123456@10.0.0.82:5060</a>><br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:core:pv_get_dsturi: no destination URI<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:tracer:is_id_traced: trace=on dyn=off<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:tracer:is_id_traced: trace=on dyn=off<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:tracer:sip_context_trace_impl: name hep_tid, hash
          1710534437, type 0, traceable on<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:proto_hep:add_hep_chunk: Chunk with (id=17; vendor=0) not
          found! Creating!<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:proto_hep:add_hep_chunk: Hep chunk with (id=17; vendor=0)
          successfully built!<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          DBG:core:mk_proxy: doing DNS lookup...<br>
          Nov 15 15:52:12 lta-opensips-stage /usr/sbin/opensips[40099]:
          failure_route: after redirect <b><a
              href="http://ru:sip:123456@10.0.0.82:5060"
              moz-do-not-send="true">ru:sip:123456@10.0.0.82:5060</a>
            and du:<null></b><br>
        </div>
        <div><br>
        </div>
        <div>Reading uac_redirect docs I expect that Contact header to
          be used as a new destination but the original ru is used
          again!</div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>