<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p>just to clarify -- did you tried and there were some issues, or
      just pure validation of the regex in the subst?</p>
    <p>If the second, I would rather use subdt_hf(), but not sure it's
      in 4.3 or added later. Then instead of \2, I would use $tU (To
      header username).</p>
    <p>Likely you can also completely avoid substitution operations, by
      doing:</p>
    <p>remove_hf("To");</p>
    <p>insert_hf("To: <a class="moz-txt-link-rfc2396E" href="sip:$tU@$rd:rp"><sip:$tU@$rd:rp></a>;tag=$tt\r\n");<br>
    </p>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 24/10/16 12:54, Charles Phillips
      wrote:<br>
    </div>
    <blockquote
      cite="mid:C3F9F310-C6EE-4ACC-B723-CD84942899E5@rustybike.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      I need a sanity check if you don’t mind… Â I am setting up a
      stateless proxy for several (separate, not load balanced) Asterisk
      servers behind Kamailio 4.2 (with domain and dispatcher). Â All
      works as expected except when called party hangs up, as Asterisk
      seems to address the BYE â€œTo” (that is sent to the calling party)
      to the originating domain, and not the IP of the UA (as it does in
      other cases). Â When this happens, stateless Kamailio does not seem
      to know how to route them, which makes sense. Â I assume I would
      need to rewrite the â€œTo” field on BYE message so that it contains
      the UA’s IP (to match the BYE’s that are routed correctly). Â The
      RURI header contains the IP/port of the UA, so I am attempting to
      use it and here is where I am stuck…
      <div class=""><br class="">
      </div>
      <div class="">Here is the subst from onreply_route:</div>
      <div class=""><br class="">
      </div>
      <div class="">
        <div class=""><span class="Apple-tab-span" style="white-space:pre">           </span>
          Â  Â if (is_method("BYE")) {</div>
        <div class=""><span class="Apple-tab-span" style="white-space:pre">                           </span>xlog("L_NOTICE",
          "BYE Detected \n");</div>
        <div class=""><span class="Apple-tab-span" style="white-space:pre">                           </span>subst('/^To:(.*)<a class="moz-txt-link-rfc2396E" href="sip:(.*)@(.*)"><sip:(.*)@(.*)></a>(.*)$/To:
          <<a moz-do-not-send="true" href="sip:%5C2@$rd:$rp" class="">sip:\2@$rd:$rp</a>>\4/ig');</div>
        <div class=""><span class="Apple-tab-span" style="white-space:pre">                   </span>}</div>
        <div class=""><br class="webkit-block-placeholder">
        </div>
        <div class="">
          <div style="font-variant-ligatures: normal;
            font-variant-position: normal; font-variant-numeric: normal;
            font-variant-alternates: normal; font-variant-east-asian:
            normal; orphans: auto; text-align: start; text-indent: 0px;
            widows: auto; word-wrap: break-word; -webkit-nbsp-mode:
            space; -webkit-line-break: after-white-space;" class="">
            <div style="color: rgb(0, 0, 0); font-family: Helvetica;
              font-size: 12px; font-style: normal; font-variant-caps:
              normal; font-weight: normal; letter-spacing: normal;
              text-transform: none; white-space: normal; word-spacing:
              0px; -webkit-text-stroke-width: 0px;" class="">Here is the
              â€œTo”:</div>
            <div style="color: rgb(0, 0, 0); font-family: Helvetica;
              font-size: 12px; font-style: normal; font-variant-caps:
              normal; font-weight: normal; letter-spacing: normal;
              text-transform: none; white-space: normal; word-spacing:
              0px; -webkit-text-stroke-width: 0px;" class=""><br
                class="">
            </div>
            <div class="">  Â  To: "Test User 2" <<a
                moz-do-not-send="true"
                href="sip:102@zxcv.asdf.qwerty.net" class="">sip:102@zxcv.asdf.qwerty.net</a>>;tag=8AB53900B9646F1DF05330E7FBF846C8
              Â </div>
            <div class=""><br class="">
            </div>
            <div class="">Any obvious glaring mistakes here? Â Would I
              then need additional logic to forward the BYE on?</div>
            <div class=""><br class="">
            </div>
            <div class="">My apologies if this is wordy, or
              nonsensical...</div>
            <div class=""><br class="">
            </div>
            <div class=""><br class="">
            </div>
            <div class=""><br class="">
            </div>
            <div style="color: rgb(0, 0, 0); font-family: Helvetica;
              font-size: 12px; font-style: normal; font-variant-caps:
              normal; font-weight: normal; letter-spacing: normal;
              text-transform: none; white-space: normal; word-spacing:
              0px; -webkit-text-stroke-width: 0px;" class=""><br
                class="">
            </div>
          </div>
          <br class="Apple-interchange-newline" style="color: rgb(0, 0,
            0); font-family: Helvetica; font-size: 12px; font-style:
            normal; font-variant: normal; font-weight: normal;
            letter-spacing: normal; orphans: auto; text-align: start;
            text-indent: 0px; text-transform: none; white-space: normal;
            widows: auto; word-spacing: 0px; -webkit-text-stroke-width:
            0px;">
          <br class="Apple-interchange-newline">
        </div>
        <br class="">
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Oct 24-26, 2016 - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>