<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Daniel,<br><br><div>Sorry to bug you just wondered if had a chance to consider the branching question?</div><div><br></div><div>Main thing is does append_branch work on 4.0 ?</div><div><br></div><div>And also the best way to implement branch routes?</div><div><br></div><div>Thanks</div><div><br></div><div>Jon</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><br>

<style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
<div dir="ltr">Hello,<div><br></div><div>I am getting there!</div><div><br></div><div>I am not using a branch routing block at present, I am doing modifications using values I pull from the location table.</div><div><br></div><div>So my question may be slightly different but very much branch related.</div><div><br></div><div><div>So I have two contacts;</div><div><br></div><div><br></div><div>Contact:: <sip:1009@213.123.211.158:15060;transport=udp;registering_acc=91_208_141_34>;q=;expires=60;flags=0x0;cflags=0x0;state=1;socket=<udp:xx.xx.xx.xx:5060>;methods=0xFFFFFFFF;user_agent=<Contact1>;reg-id=0</div><div>Contact:: <sip:1009@213.123.211.158:5061;transport=udp>;q=;expires=3191;flags=0x0;cflags=0xC0;state=1;socket=<udp:xx.xx.xx.xx:5060>;methods=0xFFFFFFFF;received=<sip:213.123.211.158:49827>;user_agent=<Contact2>;+sip.instance=<urn:uuid:00000000-0000-0000-0000-58bfea20a6bd>;reg-id=0</div><div><br></div><div>Then using reg_fetch_contacts I get for each registered contact;</div><div><br></div><div> xlog("callee=>user_agent: $(ulc(callee=>user_agent)[$var(i)])\n");</div><div>    xlog("callee=>received: $(ulc(callee=>received)[$var(i)])\n");</div><div>    xlog("callee=>addr1:   $(ulc(callee=>addr)[$var(i)])\n");</div><div><br></div><div>And define some variables as a result for each contact;</div><div><br></div><div>    $var(ua1) =  $(ulc(callee=>user_agent)[$var(i)]);</div><div>    $var(ua1add) = $(ulc(callee=>received)[$var(i)]);</div><div>    $var(ua1aor) = $(ulc(callee=>addr)[$var(i)]);</div><div><br></div><div><br></div><div>I then use these  to set $du and $ru in the main routing, I do this for contact2 above, so I send to the recieved port (49827), identifying this by user agent type.</div><div><br></div><div>This works fine however branch[0] was sending an INVITE TO 1009@213.123.211.158:5061, contact2 also, and not contact1 (port 15060), so I have added;</div><div><br></div><div>$(branch(dst_uri)[0]) = $var(ua1aor);</div><div><br></div><div>So I now get parallel forking as follows;</div><div><br></div><div>INVITE sip:1009-@213.123.211.158:49827    < This is what I want, for Contact2</div><div>INVITE sip:1009-@213.123.211.158:15060    < Again routes to Contact1 after modifiying the branch parameter.</div><div>INVITE sip:1009-@213.123.211.158:5061     < Still sends out original branch value.</div><div><br></div><div><br></div><div>And can see from debug, my branch [0] is modifed, but branch [1] is also created;</div><div><br></div><div>new branch [0] to sip:1009@213.123.211.158:49827</div><div>new branch [1] to sip:1009@213.123.211.158:5061</div><div><br></div><div>So I now have 3 invites for 2 devices.</div><div><br></div><div>Whats the best approach to clean this up or implement in the first place, my main question is probably around branch modification/control.</div><div><br></div><div>Thanks, sorry for long question.</div><div><br></div><div>Jon</div></div><div><br><br><div><hr id="ecxstopSpelling">Date: Tue, 13 May 2014 16:04:21 +0200<br>From: miconda@gmail.com<br>To: sr-users@lists.sip-router.org<br>Subject: Re: [SR-Users] reg_fetch_contacts for multiple devices registered<br><br>
  
    
  
  
    Hello,<br>
    <br>
    are you using a branch_route block?<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="ecxmoz-cite-prefix">On 13/05/14 13:28, Jonathan Hunter
      wrote:<br>
    </div>
    <blockquote cite="mid:DUB127-W63DC0E76AA51E23799ADDFBD340@phx.gbl">
      <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}


--></style>
      <div dir="ltr"><br>
        <div><br>
        </div>
        <div>Hi Guys,</div>
        <div><br>
        </div>
        <div>Following on from my initial query, I have indexing working
          for reg_fetch_contacts, however now I am </div>
        <div>having issues with branching.</div>
        <div><br>
        </div>
        <div>First, is append_branches() still applicable to kamailio
           4.0.6 ? As when I use its not recognised.</div>
        <div><br>
        </div>
        <div>Also I have two contacts registered, contact 0 and contact
          1.</div>
        <div><br>
        </div>
        <div>Contact 0 was registered first, then contact 1.</div>
        <div><br>
        </div>
        <div>Now I perform manipulation on the main branch after
          identifying the user agent for contact 1, and the main</div>
        <div>branch request is sent out as I wish, this uses branch [0]
          when running debug to the $ru/$du I have modified.</div>
        <div><br>
        </div>
        <div>However with branch [1] this isnt modified which is fine,
          but uses the contact AOR from Contact 1 and not Contact 0.</div>
        <div><br>
        </div>
        <div>Is this normal behaviour and I just need to improve my
          logic?</div>
        <div><br>
        </div>
        <div>Any advise on parallel branching where you extract certain
          credentials from location table, then as a result</div>
        <div>manipulate the $ru and $du as a result, but dont affect any
          other multiple registrations that would be great!</div>
        <div><br>
        </div>
        <div>Many thanks</div>
        <div><br>
        </div>
        <div>Jon</div>
        <div><br>
        </div>
        <div>
          <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}


--></style>
          <div dir="ltr">
            <div><br>
              <br>
              <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}


--></style>
              <div dir="ltr">Hi Guys,
                <div><br>
                </div>
                <div>I was wondering if anyone could help?</div>
                <div><br>
                </div>
                <div>I am currently using reg_fetch_contacts to
                  manipulate signaling based on the user agent device
                  being used, therefore I use the result of;</div>
                <div><br>
                </div>
                <div>
                  <div>if(reg_fetch_contacts("location", "$ru",
                    "callee"))</div>
                  <div>{</div>
                  <div><span style="font-size:12pt;"> 
                      xlog("callee=>user_agent
                      $ulc(callee=>user_agent)\n");</span></div>
                  <div><span style="font-size:12pt;">}</span></div>
                  <div><span style="font-size:12pt;"><br>
                    </span></div>
                  <div><span style="font-size:12pt;"><br>
                    </span></div>
                  <div><span style="font-size:12pt;">I then use  
                      $ulc(callee=>user_agent) to make routing
                      decisions.</span></div>
                </div>
                <div><span style="font-size:12pt;"><br>
                  </span></div>
                <div><span style="font-size:12pt;">This seems to only
                    return the user-agent device being used for the
                    first registration at that AOR, as I have two
                    devices registered, a Cisco, and a jitsi client, and
                    it only returns the user_agent of the jitsi client I
                    registered first.</span></div>
                <div><span style="font-size:12pt;"><br>
                  </span></div>
                <div><span style="font-size:12pt;">Is it possible to
                    return the user agents of all the devices registered
                    against an AOR so I can manage decisions
                    accordingly?</span></div>
                <div><span style="font-size:12pt;"><br>
                  </span></div>
                <div><span style="font-size:12pt;">Many thanks</span></div>
                <div><span style="font-size:12pt;"><br>
                  </span></div>
                <div><span style="font-size:12pt;">Jon</span></div>
                <div><span style="font-size:12pt;"><br>
                  </span></div>
                <div><span style="font-size:12pt;"><br>
                  </span></div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="ecxmimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="ecxmoz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="ecxmoz-signature">-- 
Daniel-Constantin Mierla - <a class="ecxmoz-txt-link-freetext" href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
<a class="ecxmoz-txt-link-freetext" href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a class="ecxmoz-txt-link-freetext" href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
  

<br>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</div></div>                                     </div>
<br>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</div>                                         </div></body>
</html>