<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>change operations over parts of sip headers are not simple "set"
      operations, see these FAQ items for a better understanding of what
      happens there:</p>
    <p>  *
<a class="moz-txt-link-freetext" href="https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers_or">https://www.kamailio.org/wiki/tutorials/faq/main#why_changes_made_to_headers_or</a><br>
        *
<a class="moz-txt-link-freetext" href="https://www.kamailio.org/wiki/tutorials/faq/main#why_parts_of_fromto_header_app">https://www.kamailio.org/wiki/tutorials/faq/main#why_parts_of_fromto_header_app</a></p>
    <p>I just added the second one to be more focused on this specific
      case.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 14.10.20 21:00, Sam Ware wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAC914cJ9vO4ACGoOY9SHAYVYbz8U6frE2=ob2HMbWEnvS4=djg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Wondering if this is intended behavior.  We have a
        customer doing some craziness with the TO header.  They are
        including their tech prefix in the TO header as well as the
        RURI.  It doesn't cause any issue in our systems but apparently
        it does with one of our vendors.  In an effect to prevent the
        issue, we thought we would check if the tech prefix was added on
        the TO header and remove it.  
        <div><br>
        </div>
        <div>Initially, I tried this by changing the $tU variable.  </div>
        <div><br>
        </div>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <div>$avp(tp_len) = $(avp(techprefix){s.len}) + 1; # Get the
            Length of the Tech Prefix and add 1 for the # or *</div>
          <div>$tU = $(tU{s.strip, $avp(tp_len)});<br>
          </div>
        </blockquote>
        <div><br>
        </div>
        The result ended up with the duplication of the DNIS: sut
        <<a class="moz-txt-link-freetext" href="sip:911999#">sip:911999#</a><a
          href="http://1812555111118125551111@172.16.3.45:5060"
          moz-do-not-send="true">1812555111118125551111@172.16.3.45:5060</a>>
        <div>Where 911999# was the tech prefix and 18125551111 is the
          DNIS which was still an issue for the vendor.</div>
        <div><br>
        </div>
        <div>Through additional reading, I found the suggestion to use
          the uac_replace_to function in the UAC module which I
          implemented as follows:</div>
        <div><br>
        </div>
        <div>
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
            <div>$avp(new_to_hdr_uri) =
              $(tu{re.subst,/<a class="moz-txt-link-freetext" href="sip:(.*">sip:(.*</a>[\*#])(.*)/<a class="moz-txt-link-freetext" href="sip:\2/">sip:\2/</a>});<br>
            </div>
            <div>uac_replace_to("$avp(new_to_hdr_uri)");<br>
            </div>
          </blockquote>
          <div><br>
          </div>
          This resulted in the original TO header username to be
          appended at the end of the uri: sut <<a
            href="http://sip:18125551111@172.16.3.45:5060911999#18125551111"
            moz-do-not-send="true">sip:18125551111@172.16.3.45:5060911999#18125551111</a>></div>
        <div><br>
        </div>
        <div>Wondering if I am doing something wrong or this is the way
          these functions are designed to protect the TO header contents
          for Dialog matching.<br>
          <div><br clear="all">
            <div><br>
            </div>
            -- <br>
            <div dir="ltr" class="gmail_signature"
              data-smartmail="gmail_signature">Sam  D Ware<br>
              <br>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
  </body>
</html>