<div dir="ltr">Hi, all<div><br></div><div>It took some time to clean up the pjsua settings and collect the pcaps for both cases.</div><div><br></div><div>Here are the two pcap files.</div><div><br></div><div>call_failed_bye.pcap has the call trace when the BYE is handled with the following logic.</div><div><div><br></div><div>route[WITHINDLG] {</div><div><span class="" style="white-space:pre">      </span>if (has_totag()) {</div><div><span class="" style="white-space:pre">         </span>if (loose_route()) {<br></div><div><span class="" style="white-space:pre">                     </span>route(DLGURI);</div><div><span class="" style="white-space:pre">                     </span>if (is_method("BYE")) {</div><div><span class="" style="white-space:pre">                          </span>xlog("L_DBG", "=====BYE $ru from $fu $si:$sp to $du=====\n");</div><div><span class="" style="white-space:pre">                          </span>dlg_manage();</div><div><span class="" style="white-space:pre">                              </span>setflag(FLT_ACC); # do accounting ...</div><div><span class="" style="white-space:pre">                              </span>setflag(FLT_ACCFAILED); # ... even if the transaction fails</div></div><div><div><span class="" style="white-space:pre">                         </span>}</div><div><span class="" style="white-space:pre">                  </span>}</div></div><div>....</div><div><span style="white-space:pre">      </span>route(RELAY);<br></div><div>This generated a 500 error. </div><div><br></div><div>call_extra_bye.pcap is the call trace when the BYE is handled like this:</div><div><div>route[WITHINDLG] {</div><div><span class="" style="white-space:pre">    </span>if (has_totag()) {</div><div><span class="" style="white-space:pre">         </span>if (loose_route()) {</div><div><span class="" style="white-space:pre">                       </span>route(DLGURI);</div><div><span class="" style="white-space:pre">                     </span>if (is_method("BYE")) {</div><div><span class="" style="white-space:pre">                          </span>xlog("L_DBG", "=====BYE $ru from $fu $si:$sp to $du=====\n");</div><div><span class="" style="white-space:pre">                          </span>dlg_manage();</div><div><span class="" style="white-space:pre">                              </span>setflag(FLT_ACC); # do accounting ...</div><div><span class="" style="white-space:pre">                              </span>setflag(FLT_ACCFAILED); # ... even if the transaction fails</div><div><span class="" style="white-space:pre">                                </span># If BYE is coming from Kamailio  peer, route BYE by location</div><div><span class="" style="white-space:pre">                             </span>$var(peerlist)=$sel(cfg_get.trusted.peers);</div><div><span class="" style="white-space:pre">                                </span>$var(i) = 0;</div><div><span class="" style="white-space:pre">                               </span>while($var(i)<$(var(peerlist){param.count})) {</div><div><span class="" style="white-space:pre">                                  </span>xlog("L_DBG", "=====$(var(peerlist){param.count})=====$(var(peerlist){param.valueat,$var(i)})=====\n");</div><div><span class="" style="white-space:pre">                                        </span>if(src_ip==$(var(peerlist){param.valueat,$var(i)})) {</div><div><span class="" style="white-space:pre">                                              </span>lookup("location");</div><div><span class="" style="white-space:pre">                                              </span>xlog("L_DBG", "=====BYE from $fu $si:$sp to $du=====\n");</div><div><span class="" style="white-space:pre">                                              </span>break;</div><div><span class="" style="white-space:pre">                                     </span>}</div><div><span class="" style="white-space:pre">                                  </span>$var(i) = $var(i) + 1;</div><div><span class="" style="white-space:pre">                             </span>}</div><div><span class="" style="white-space:pre">                  </span>}</div></div><div>...</div><div><span style="white-space:pre">       </span>route(RELAY);<br></div><div><br></div><div>This got the BYE and 200 OK for the BYE. But there was an extra BYE at the end, which resulted in 481 Call/Transaction Does Not Exist. </div><div>Wonder if the 481 was caused by pjsua not sending ACK for the 200 OK of BYE.</div><div><br></div><div>Just to recap the use case. We're trying to set up two kamailio servers sharing the same database(db_mode=3).</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">kamailio server 1(k1): <a href="http://10.0.1.30:5060">10.0.1.30:5060</a></span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">kamailio server 2(k2): <a href="http://10.0.1.32:5060">10.0.1.32:5060</a></span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">sip client c1: sip:</span><a href="mailto:16317@10.0.1.30">16317@10.0.1.30</a><span style="color:rgb(0,0,0);white-space:pre-wrap">, client ip: 10.0.1.254</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">sip client c2: sip:</span><a href="mailto:72316@10.0.1.30">72316@10.0.1.30</a><span style="color:rgb(0,0,0);white-space:pre-wrap">, client ip: 10.0.1.254</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">c1 is registered with k1.</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">c2 is registered with k2. The expected call flow is as follows:</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">When c1 calls c2, the expected call flow is as follows:</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">INVITE:</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">c1------>k1------>k2------>c2</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">200 OK:</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">c1<------k1<------k2<------c2</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">BYE</span></div><div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">c1<------k1<------k2<------c2</span></div></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div>But we have the above-mentioned issue with BYE handling at k1.</div><div><br></div><div>Thanks</div><div><br></div><div>Ding</div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 20, 2015 at 1:08 PM, 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    An alternative would be to test with tcp, from routing point of view
    should be the same if it is udp-tcp or udp-tls.<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="h5"><br>
    <br>
    <div>On 20/03/15 15:09, Vitaliy Aleksandrov
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <br>
      <div><br>
      </div>
      <blockquote type="cite">
        
        We use TLS for SIP. The Wireshark pcap would be encrypted. I’ll
        try to get a pcap anyway. Wonder if there is a way to dump pcap
        from inside kamailio.</blockquote>
      Wireshark can decrypt SIP signalling sent over TLS connections if
      you provide server's private key to it.<br>
      <br>
      <blockquote type="cite">
        <div><br>
          <div>All the requests within dialog are routed
            through 2 kamailio instances. We want to make sure each
            phone only sends requests through its registrar. </div>
          <div><br>
          </div>
          <div>I have included pjsua logs in subsequent emails
            in this thread. Those logs have SIP messages, but only
            provide client perspective. </div>
          <div><br>
          </div>
          <div>Thanks for the help,</div>
          <div><br>
          </div>
          <div>Ding</div>
          <div> <br>
            <div>
              <div><br>
                <div>
                  <blockquote type="cite">
                    <div>On Mar 20, 2015, at 3:00 AM,
                      Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>

                      wrote:</div>
                    <br>
                    <div>
                      
                      <div bgcolor="#FFFFFF" text="#000000">
                        Hello,<br>
                        <br>
                        <div>On 19/03/15 02:54,
                          Ding Ma wrote:<br>
                        </div>
                        <blockquote type="cite">
                          
                          <div dir="ltr">[...]
                            <div> <br>
                            </div>
                            <p class="MsoNormal">My first question is
                              why k1 loose_route sends the BYE to itself
                              instead of the client. Is this a bug? <br>
                            </p>
                          </div>
                        </blockquote>
                        <br>
                        can you get the pcap of such call? We have to
                        see the routing headers to say what is next hop
                        address.<br>
                        <br>
                        Are all the requests within dialog routed via
                        same instance of kamailio?<br>
                        <br>
                        <blockquote type="cite">
                          <div dir="ltr">
                            <p class="MsoNormal">My next question is
                              whether the above location routing for BYE
                              from peer kamailio a good/safe approach.</p>
                            <p class="MsoNormal">The SIP traces will be
                              sent later to avoid exceeding email size
                              limit.</p>
                          </div>
                        </blockquote>
                        Cheers,<br>
                        Daniel<br>
                        <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#%21/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>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a href="http://www.kamailioworld.com/" target="_blank">http://www.kamailioworld.com</a></pre>
                      </div>
                    </div>
                  </blockquote>
                </div>
                <br>
              </div>
            </div>
          </div>
        </div>
        <br>
        <fieldset></fieldset>
        <br>
        <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>
      </blockquote>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <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>
    </blockquote>
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<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>
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - <a href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a></pre>
  </div></div></div>

<br>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<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><br>
<br></blockquote></div><br></div></div></div>