<div dir="ltr">Hi Daniel,<div><br></div><div>I made a mistake with my formatting when I pasted here. I am calling append_branch() before t_load_contacts. I've attached a view of the entire route including where I was using drop; below. Also a packet capture that shows Kamailio forwarding the reply from the cnam provider back to the phone. I've discovered t_cancel_branches("this") and that seems to be doing the job of killing the second branch as well as the reply to the phone.</div><div><br></div><div>My main issue right now is serializing the branches, append_branch creates an additional branch but t_load_contacts fails. I've tried appending multiple branches and also using seturi to replicate the documentation as closely as possible with no luck.</div><div><br></div><div><div style="font-size:12.8px">route[CNAM_DIPS] {</div><div style="font-size:12.8px">  if ($avp(direction) == "in") {</div><span class="im" style="font-size:12.8px"><div>    t_on_branch("CNAM_DIPS");</div><div>    t_on_reply("CNAM_DIPS");</div><div>    t_on_failure("CNAM_DIPS");</div></span><div style="font-size:12.8px">    $var(reply_count) = 0;<br></div><div style="font-size:12.8px"><div>    append_branch("sip:<a href="tel:2152974400" value="+12152974400" target="_blank">8888888888</a>@<span style="font-size:small">222.22.222.22</span>:5060;trans-type=5", "0.5");</div><div>    #t_load_contacts();</div><div>    t_next_contacts();</div><div>    t_relay();</div><div>    break;</div></div><div style="font-size:12.8px"><div>  }</div><div>}</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>branch_route[CNAM_DIPS] {</div><div>  $var(modified_from) = "sip:" + $fU + "@<a href="http://sip.core.com/" target="_blank">sip.core.com</a>";</div><div>  uac_replace_from("$var(modified_from)");</div><div>}</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>onreply_route[CNAM_DIPS] {</div><div>  $var(reply_count) = $var(reply_count) + 1;</div><div>  if (t_check_status("380")) {</div><div>    $avp(cnam) = $(hdr(P-Asserted-Identity){<a href="http://nameaddr.name/" target="_blank">nameaddr.name</a>});</div><div>  } else {</div><div>      xlog("L_ERROR", "INFO: Received bad reply (on_reply_route[CNAM_DIPS]):"); </div><div>  };</div><div><div>  if ($var(reply_count) = 1) {</div><div>    t_cancel_branches("this");</div><div>  }</div></div><div>  #drop;</div><div>}</div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><div>failure_route[CNAM_DIPS] {</div><div>  if (!t_next_contacts()) {</div><div>    xlog("L_ERR", "ERROR: Gateway failure (failure_route[CNAM_DIPS]): Failed to ship call");</div><div>    exit;</div><div>  } else {</div><div>      t_next_contacts();</div><div>      t_relay();</div><div>  };</div><div>}</div></div></div><div><br></div><div><div><br></div><div>Packet capture using drop in the on_reply route rather than t_cancel_branches("this"):</div><div><br></div><div><div>U 2016/07/04 08:46:41.223295 44.444.4.444:5060 -> 333.33.33.3:5060</div><div>INVITE <a href="http://sip:+12222222222@core.com:5060">sip:+12222222222@core.com:5060</a> SIP/2.0.</div><div>Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.</div><div>From: "UNKNOWN" <sip:+13333333333@44.444.4.444;isup-oli=62>;tag=gK046fcff6.</div><div>To: <<a href="mailto:sip%3A2222222222@core.com">sip:2222222222@core.com</a>>.</div><div>Call-ID: 1698991986_66771899@44.444.4.444.</div><div>CSeq: 468700 INVITE.</div><div>Max-Forwards: 70.</div><div>Allow: INVITE,ACK,CANCEL,BYE,OPTIONS.</div><div>Accept: application/sdp.</div><div>Contact: "UNKNOWN" <sip:+13333333333@44.444.4.444:5060>.</div><div>P-Asserted-Identity: "UNKNOWN" <sip:+13333333333@44.444.4.444:5060>.</div><div>Supported: replaces.</div><div>Content-Length:   281.</div><div>Content-Disposition: session; handling=required.</div><div>Content-Type: application/sdp.</div><div>.</div><div>v=0.</div><div>o=Sonus_UAC 807784 731434 IN IP4 44.444.4.444.</div><div>s=SIP Media Capabilities.</div><div>c=IN IP4 55.555.5.55.</div><div>t=0 0.</div><div>m=audio 54018 RTP/AVP 0 18 101.</div><div>a=rtpmap:0 PCMU/8000.</div><div>a=rtpmap:18 G729/8000.</div><div>a=fmtp:18 annexb=no.</div><div>a=rtpmap:101 telephone-event/8000.</div><div>a=fmtp:101 0-15.</div><div>a=sendrecv.</div><div>a=ptime:20.</div><div><br></div><div><br></div><div>U 2016/07/04 08:46:41.230033 333.33.33.3:5060 -> 44.444.4.444:5060</div><div>SIP/2.0 100 trying -- your call is important to us.</div><div>Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.</div><div>From: "UNKNOWN" <sip:+13333333333@44.444.4.444;isup-oli=62>;tag=gK046fcff6.</div><div>To: <<a href="mailto:sip%3A2222222222@core.com">sip:2222222222@core.com</a>>.</div><div>Call-ID: 1698991986_66771899@44.444.4.444.</div><div>CSeq: 468700 INVITE.</div><div>Server: kamailio (4.2.7 (x86_64/linux)).</div><div>Content-Length: 0.</div><div>.</div><div><br></div><div><br></div><div>U 2016/07/04 08:46:41.234143 333.33.33.3:5060 -> <a href="http://222.22.222.22:5060">222.22.222.22:5060</a></div><div>INVITE sip:8888888888@222.22.222.22:5060;trans-type=5 SIP/2.0.</div><div>Record-Route: <sip:333.33.33.3;lr;ftag=gK046fcff6;vsf=AAAAAAAAAAAAAAAAAAAAAABFXl4cUF5cXABSXl87aXN1cC1vbGk9NjI->.</div><div>Via: SIP/2.0/UDP 333.33.33.3;branch=z9hG4bK8ac3.daa229dcb24f16332fa5a21927e9a72f.0.</div><div>Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.</div><div>From: "UNKNOWN" <<a href="mailto:sip%3A%2B13333333333@sip.core.com">sip:+13333333333@sip.core.com</a>>;tag=gK046fcff6.</div><div>To: <<a href="mailto:sip%3A2222222222@core.com">sip:2222222222@core.com</a>>.</div><div>Call-ID: 1698991986_66771899@44.444.4.444.</div><div>CSeq: 468700 INVITE.</div><div>Max-Forwards: 69.</div><div>Allow: INVITE,ACK,CANCEL,BYE,OPTIONS.</div><div>Accept: application/sdp.</div><div>Contact: "UNKNOWN" <sip:+13333333333@44.444.4.444:5060>.</div><div>P-Asserted-Identity: "UNKNOWN" <sip:+13333333333@44.444.4.444:5060>.</div><div>Supported: replaces.</div><div>Content-Length:   281.</div><div>Content-Disposition: session; handling=required.</div><div>Content-Type: application/sdp.</div><div>P-hint: branch_route CNAM_DIPS.</div><div>.</div><div>v=0.</div><div>o=Sonus_UAC 807784 731434 IN IP4 44.444.4.444.</div><div>s=SIP Media Capabilities.</div><div>c=IN IP4 55.555.5.55.</div><div>t=0 0.</div><div>m=audio 54018 RTP/AVP 0 18 101.</div><div>a=rtpmap:0 PCMU/8000.</div><div>a=rtpmap:18 G729/8000.</div><div>a=fmtp:18 annexb=no.</div><div>a=rtpmap:101 telephone-event/8000.</div><div>a=fmtp:101 0-15.</div><div>a=sendrecv.</div><div>a=ptime:20.</div><div><br></div><div><br></div><div>U 2016/07/04 08:46:41.367868 <a href="http://222.22.222.22:5060">222.22.222.22:5060</a> -> 333.33.33.3:5060</div><div>SIP/2.0 380 cnam lookup.</div><div>Via: SIP/2.0/UDP 333.33.33.3;branch=z9hG4bK8ac3.daa229dcb24f16332fa5a21927e9a72f.0.</div><div>Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.</div><div>From: "UNKNOWN" <<a href="mailto:sip%3A%2B13333333333@sip.core.com">sip:+13333333333@sip.core.com</a>>;tag=gK046fcff6.</div><div>To:  <<a href="mailto:sip%3A2222222222@core.com">sip:2222222222@core.com</a>>;tag=CNAM-16688-1467636671937.</div><div>Call-ID: 1698991986_66771899@44.444.4.444.</div><div>CSeq: 468700 INVITE.</div><div>Contact: "CNAM" <<a href="mailto:sip%3Acnam_gw@10.212.16.30">sip:cnam_gw@10.212.16.30</a>>; transport=udp.</div><div>Max-Forwards: 10.</div><div>P-Asserted-Identity: "Unavailable" <<a href="mailto:sip%3A%2B13333333333@sip.core.com">sip:+13333333333@sip.core.com</a>>.</div><div>Content-Length: 0.</div><div>.</div><div><br></div><div><br></div><div>U 2016/07/04 08:46:41.368421 333.33.33.3:5060 -> <a href="http://222.22.222.22:5060">222.22.222.22:5060</a></div><div>ACK sip:8888888888@222.22.222.22:5060;trans-type=5 SIP/2.0.</div><div>Via: SIP/2.0/UDP 333.33.33.3;branch=z9hG4bK8ac3.daa229dcb24f16332fa5a21927e9a72f.0.</div><div>From: "UNKNOWN" <<a href="mailto:sip%3A%2B13333333333@sip.core.com">sip:+13333333333@sip.core.com</a>>;tag=gK046fcff6.</div><div>To:  <<a href="mailto:sip%3A2222222222@core.com">sip:2222222222@core.com</a>>;tag=CNAM-16688-1467636671937.</div><div>Call-ID: 1698991986_66771899@44.444.4.444.</div><div>CSeq: 468700 ACK.</div><div>Max-Forwards: 69.</div><div>Content-Length: 0.</div><div>.</div><div><br></div><div><br></div><div>U 2016/07/04 08:46:44.227076 333.33.33.3:5060 -> 44.444.4.444:5060</div><div>SIP/2.0 380 cnam lookup.</div><div>Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.</div><div>From: "UNKNOWN" <sip:+13333333333@44.444.4.444;isup-oli=62>;tag=gK046fcff6.</div><div>To:  <<a href="mailto:sip%3A2222222222@core.com">sip:2222222222@core.com</a>>;tag=CNAM-16688-1467636671937.</div><div>Call-ID: 1698991986_66771899@44.444.4.444.</div><div>CSeq: 468700 INVITE.</div><div>Contact: "CNAM" <<a href="mailto:sip%3Acnam_gw@10.212.16.30">sip:cnam_gw@10.212.16.30</a>>; transport=udp.</div><div>Max-Forwards: 10.</div><div>P-Asserted-Identity: "Unavailable" <<a href="mailto:sip%3A%2B13333333333@sip.core.com">sip:+13333333333@sip.core.com</a>>.</div><div>Content-Length: 0.</div><div>P-hint: onreply CNAM_DIPS.</div><div>.</div></div><div><br></div><div><br></div><div><br></div></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><p style="margin-top:8px;margin-bottom:8px;font-family:Helvetica,Verdana,Arial,sans-serif;font-size:0.85em;color:rgb(51,51,51);line-height:1.4"><span style="font-size:0.85em;line-height:1.4">___</span><br></p><p style="margin-top:8px;margin-bottom:8px;font-family:Helvetica,Verdana,Arial,sans-serif;font-size:1.1em;color:rgb(51,51,51);line-height:1.4">John Petrini</p><p style="margin-top:8px;margin-bottom:8px;font-family:Helvetica,Verdana,Arial,sans-serif;font-size:0.85em;color:rgb(51,51,51);line-height:1.6">NOC Systems Administrator   //   <strong>CoreDial, LLC</strong>   //   <a href="http://coredial.com/" title="CoreDial" style="color:rgb(35,104,179);text-decoration:none" target="_blank">coredial.com</a>   //   <a href="https://twitter.com/coredial" target="_blank"><img src="http://cdn2.hubspot.net/hub/210539/file-2353637622-gif/email/twitter-1.gif" alt="Twitter" style="vertical-align:text-bottom"></a>   <a href="http://www.linkedin.com/company/99631" target="_blank"><img src="http://cdn2.hubspot.net/hub/210539/file-2351103565-gif/email/linkedin-1.gif" alt="LinkedIn" style="vertical-align:text-bottom"></a>   <a href="https://plus.google.com/104062177220750809525/posts" target="_blank"><img src="http://cdn2.hubspot.net/hub/210539/file-2353637617-gif/email/googleplus-1.gif" alt="Google Plus" style="vertical-align:text-bottom"></a>   <a href="http://success.coredial.com/blog" target="_blank"><img src="http://cdn2.hubspot.net/hub/210539/file-2351103560-gif/email/rss-1.gif" alt="Blog" style="vertical-align:text-bottom"></a> <br>Hillcrest I, 751 Arbor Way, Suite 150, Blue Bell PA, 19422 <br><strong>P: </strong><a style="color:rgb(35,104,179)">215.297.4400</a> x232   //   <strong>F: </strong><a style="color:rgb(35,104,179)">215.297.4401</a>   //   <strong>E: </strong><a href="mailto:jpetrini@coredial.com" style="color:rgb(35,104,179);text-decoration:none" target="_blank">jpetrini@coredial.com</a></p><p style="color:rgb(0,0,0);font-family:'Times New Roman';font-size:medium"><a href="http://cta-redirect.hubspot.com/cta/redirect/210539/4c492538-6e4b-445e-9480-bef676787085" target="_blank"><img src="https://no-cache.hubspot.com/cta/default/210539/4c492538-6e4b-445e-9480-bef676787085.png" alt="Exceptional people. Proven Processes. Innovative Technology. Discover CoreDial - watch our video" style="border-width:0px"></a></p><p style="padding-top:15px;padding-bottom:15px;max-width:600px;font-family:Helvetica,Verdana,Arial,sans-serif;font-size:0.6em;color:rgb(51,51,51);line-height:1.4">The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission,  dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.</p></div></div></div></div><a href="http:///" target="_blank"></a></div></div></div></div></div>
<br><div class="gmail_quote">On Mon, Jul 4, 2016 at 7:15 AM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p>I expect that you have to call append_branch() before doing
      t_load_contacts().</p>
    <p>Then, where do you execute drop() for the sip reply? Kamailio is
      dropping the replies if you call drop() -- this is a feature since
      2005-2006 (openser 1.1.x or so), if I recall it properly at this
      moment, I may even be the developer for this feature. Anyhow, it
      should work fine if used in reply_route or onreply_route -- I used
      for a new config last week inside reply_route to fix issues with a
      broken gateway that doesn't like 183 before 180.</p>
    <p>Maybe you can provide a pcap as well as relevant configuration
      file snippets for use of the drop().</p>
    <p>Cheers,<br>
      Daniel<br>
    </p><div><div class="h5">
    <br>
    <div>On 02/07/16 15:49, John Petrini wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr"><span style="font-size:12.8px">Hello,</span>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">I'm trying to append a branch,
          assign it a q value so it has priority and serialize the new
          branch and the main branch.</div>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">The goal is to send the new branch
          off to our CNAM provider, capture the CNAM in their reply to
          an $avp then drop the branch, stick the cnam in the main
          branch and allow the call to continue as normal. We do this
          currently using OpenSIPS with serialize_branches(1) but the of
          load_contacts() behavior seems to be different than
          serialize_branches.</div>
        <div style="font-size:12.8px"><br>
        </div>
        <div style="font-size:12.8px">route[CNAM_DIPS]</div>
        <div style="font-size:12.8px">
          <div>  t_on_branch("CNAM_DIPS");</div>
          <div>  t_on_reply("CNAM_DIPS");</div>
          <div>  t_on_failure("CNAM_DIPS");</div>
          <div>  t_load_contacts();</div>
          <div>  t_next_contacts();</div>
          <div> 
            append_branch(<a>"sip:2223334444@22.33.444.55:5600;trans-type=5"</a>,
            "0.5");</div>
          <div>  relay();</div>
          <div>  break;</div>
          <div><br>
          </div>
          <div>Two problems. First when t_next_contacts is called I get
            the following error:</div>
          <div>ERROR: pv [pv_branch.c:58]: pv_get_branchx(): error
            accessing branch [0]<br>
          </div>
          <div>So it looks like the branches aren't actually being
            loaded?</div>
          <div><br>
          </div>
          <div>Second problem is that despite the first error my call
            goes out on the branch I appended and I get a reply from the
            CNAM provider but Kamailio forwards that reply back to the
            phone causing the phone to send a second invite. In OpenSIPs
            we just called drop, to drop the branch and let the main
            branch continue but this doesn't seem to work in Kamailio.</div>
          <div><br>
          </div>
          <div>I've read and reread the documentaion but it doesn't seem
            to behave the way the documentation says it should. Is there
            something I'm missing? Is there a better way to accomplish
            this in Kamailio?</div>
          <div><br>
          </div>
          <div>Thank You,</div>
        </div>
        <div>
          <div data-smartmail="gmail_signature">
            <div dir="ltr">
              <div dir="ltr">
                <div>
                  <div dir="ltr">
                    <div dir="ltr">
                      <div dir="ltr">
                        <p style="margin-top:8px;margin-bottom:8px;font-family:Helvetica,Verdana,Arial,sans-serif;font-size:0.85em;color:rgb(51,51,51);line-height:1.4"><span style="font-size:0.85em;line-height:1.4">___</span><br>
                        </p>
                        <p style="margin-top:8px;margin-bottom:8px;font-family:Helvetica,Verdana,Arial,sans-serif;font-size:1.1em;color:rgb(51,51,51);line-height:1.4">John
                          Petrini</p>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><span class=""><pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a 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>
    </span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a> - <a href="http://www.kamailio.org" target="_blank">http://www.kamailio.org</a>
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a></pre>
  </font></span></div>

</blockquote></div><br></div>