<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    I added some functions and variables to make these operations
    easier. The older version required to update the r-ruri branch and
    use append_branch(), with keeping backup or uri branch attributes in
    order to restore it.<br>
    <br>
    Now you have to fill the $sbranch(attribute) variable and then use
    either sbranch_push_ruri() or sbranch_append()<br>
    <br>
    First function is overwriting the r-uri branch, perhaps what you are
    looking for. See some examples at:<br>
    <br>
      -
<a class="moz-txt-link-freetext" href="http://kamailio.org/docs/modules/4.3.x/modules/pv.html#pv.f.sbranch_set_ruri">http://kamailio.org/docs/modules/4.3.x/modules/pv.html#pv.f.sbranch_set_ruri</a><br>
    <br>
    Let me know if works fine, as I didn't have time for extensive
    testing.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 17/04/15 16:23, Yuriy Gorlichenko
      wrote:<br>
    </div>
    <blockquote
cite="mid:CABSP_VfX4cUd9mmchcJXOWvc5q2+U-eUyOBCYe+OHOn5AgX=GQ@mail.gmail.com"
      type="cite">
      <div dir="ltr"><span style="font-size:12.8000001907349px">Hello. I
          thry to integrate redis for location module and first at all
          that I do - dublicate location to redis.</span><br
          style="font-size:12.8000001907349px">
        <br style="font-size:12.8000001907349px">
        <span style="font-size:12.8000001907349px">First At all I create
          analog of lookup procedure that use location but from redis. I
          take values from location and create branches by mannualy. All
          works good but branch route create dublicate of first branch.
          We talk about it already and I cnow that branch route creates
          first original Request and then create branches. So my
          question is how to disable creation of original URI?</span><br
          style="font-size:12.8000001907349px">
        <br style="font-size:12.8000001907349px">
        <span style="font-size:12.8000001907349px">My cfg part of
          creation branches is:</span><br
          style="font-size:12.8000001907349px">
        <span style="font-size:12.8000001907349px">First of all I create
          massive of needed endpoints and then create branches as
          bellow.</span><br style="font-size:12.8000001907349px">
        <br style="font-size:12.8000001907349px">
        <span style="font-size:12.8000001907349px">I create it with
          different сucles  "while" because websockets not blocked when
          creates dublicate INVITE, but some UDP endpoints can not take
          call because answer to kamailio 482 reply and CANCELs call. </span><br
          style="font-size:12.8000001907349px">
        <br style="font-size:12.8000001907349px">
        <span style="font-size:12.8000001907349px">It works fine when I
          logged on with wesocket device and UNP at one time. But when I
          logget with 2 UDP devices only this algorithm not worked.</span><br
          style="font-size:12.8000001907349px">
        <br style="font-size:12.8000001907349px">
        <span style="font-size:12.8000001907349px">Thanks for help.</span><br
          style="font-size:12.8000001907349px">
        <br style="font-size:12.8000001907349px">
        <br style="font-size:12.8000001907349px">
        <br style="font-size:12.8000001907349px">
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>$var(k)=0;</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO",
          "request URI is $ru");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>while ($var(k)<=
          $var(j)){</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>if
          ($(avp(device_contact)[$var(k)])=~"device"){</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO", "This
          is a classic UDP call to endpoint");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>if
          ($(avp(device_received)[$var(k)])==""){</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO",
          "Received string is EMPTY");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>$du="sip:"+$(avp(device_contact[$var(k)]){s.select,1,@});</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>}</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>else</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>{</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO",
          "Received string is {$avp(device_received)[$var(k)]}");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>$du=$(avp(device_received)[$var(k)]);</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>}</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>$var(UDP_contact)="sip:"+$(avp(device_contact[$var(k)]){s.select,1,@});</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>append_branch(<a class="moz-txt-link-rfc2396E" href="sip:$tU@$(du{s.select,1,:})">"sip:$tU@$(du{s.select,1,:})"</a>,"0.3");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO","Classic
          Destination URI is
          {$(avp(device_contact[$var(k)]){s.select,1,@})} for {$tU}}.
          Destination is {$du}\n");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>}</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>$var(k) = $var(k) + 1;</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>}</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"><br>
          </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"><br>
          </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"><br>
          </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>$var(k)=0;</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO",
          "request URI is $ru");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>while
          ($var(k)<=$var(j)){</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>if
          ($(avp(device_contact)[$var(k)])=~"transport=ws"){</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO", "This
          is a classic UDP call to endpoint");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO",
          "Received string is {$avp(device_received)[$var(k)]}");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>$du=$(avp(device_received)[$var(k)]);</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>append_branch(<a class="moz-txt-link-rfc2396E" href="sip:$tU@$(du{s.select,1,:})">"sip:$tU@$(du{s.select,1,:})"</a>,"0.7");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span></div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>xlog("L_INFO","Classic
          Destination URI is
          {$(avp(device_contact[$var(k)]){s.select,1,@})} for {$tU}}.
          Destination is {$du}\n");</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>}</div>
        <div style="font-size:12.8000001907349px"><span
            style="white-space:pre-wrap"> </span>$var(k) = $var(k) + 1;</div>
      </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 World Conference, May 27-29, 2015
Berlin, Germany - <a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>