<div dir="ltr">B.H.<div><br></div><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 16, 2014 at 5:38 PM, Mordechay Kaganer <span dir="ltr"><<a href="mailto:mkaganer@gmail.com" target="_blank">mkaganer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;border-right-width:1px;border-right-color:rgb(204,204,204);border-right-style:solid;padding-left:1ex;padding-right:1ex">
<div dir="ltr">B.H.<div><br></div><div>Hello, all!</div><div><br></div><div>I'm trying to set up kamailio as a simple load balancer proxy between PSTN gateway and a cluster of asterisk servers - rather common use case IMHO. I'm completely new to kamailio.</div>

<div><br></div><div>I have started with the default kamailio.cfg that comes with Ubuntu package and added the dispatcher module as described in the docs (<a href="http://www.kamailio.org/docs/modules/4.0.x/modules/dispatcher.html" target="_blank">http://www.kamailio.org/docs/modules/4.0.x/modules/dispatcher.html</a>).</div>

<div><br></div><div>At the end, i got this up and running, but with one exception: if incoming call is not answered by the asterisk end (i.e. it is in ringing state), and then the gateway sends CANCEL request, kamailio is unable to recognize the transaction and is not forwarding the request to asterisk. The result is: the call is left "dangling" in the PBX and is not properly hang up.</div>

<div><br></div><div>When the gateway sends CANCEL to kamailio, i get the following log messages:</div><div><div> 4(25442) DEBUG: tm [t_lookup.c:769]: t_lookupOriginalT(): DEBUG: t_lookupOriginalT: searching on hash entry 31287</div>

<div> 4(25442) DEBUG: tm [t_lookup.c:492]: matching_3261(): DEBUG: RFC3261 transaction matching failed</div><div> 4(25442) DEBUG: tm [t_lookup.c:859]: t_lookupOriginalT(): DEBUG: t_lookupOriginalT: no CANCEL matching found!</div>

<div> 4(25442) DEBUG: tm [t_lookup.c:861]: t_lookupOriginalT(): DEBUG: t_lookupOriginalT completed</div><div> 4(25442) DEBUG: tm [tm.c:1039]: w_t_lookup_cancel(): lookup_original: t_lookupOriginalT returned: (nil)</div><div>

 4(25442) ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=485 a=25 n=xdbg</div><div> 4(25442) DEBUG: <script>: is_method(CANCEL): t_check_trans()==false 4(25442) ERROR: *** cfgtrace: c=[/etc/kamailio/kamailio.cfg] l=487 a=2 n=exit</div>

</div><div><br></div><div>The relevant script snippet is standard from the distro package:</div><div><div>        # CANCEL processing</div><div>        if (is_method("CANCEL"))</div><div>        {</div><div>                xdbg("is_method(CANCEL): entry");</div>

<div>                if (t_check_trans()) {</div><div>                        xdbg("is_method(CANCEL): t_check_trans()==true");</div><div>                        route(RELAY);</div><div>                } else {</div>

<div>                        xdbg("is_method(CANCEL): t_check_trans()==false");</div><div>                }</div><div>                exit;</div><div>        }</div></div><div><br></div><div>How can i fix this?</div>
</div></blockquote><div><br></div><div>Finally, i have found the source of the problem:</div><div><br></div><div><div>route[DISPATCH] {</div><div>        if(!ds_select_domain("1", "5"))</div><div>        {<br>
</div><div>                send_reply("404", "No destination");</div><div>                exit;</div><div>        }</div><div>        xlog("L_NOTICE", "--- DISPATCH: going to <$ru> via <$du>\n");</div>
<div>#        forward();</div><div>#        exit();<br></div><div>        route(RELAY);</div><div>}</div></div><div><br></div><div>By advice from some blog, i have put only forward(); exit(); instead of route(RELAY). This broke the transaction tracking.</div>
<div>With route(RELAY) everything works perfectly. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;border-right-width:1px;border-right-color:rgb(204,204,204);border-right-style:solid;padding-left:1ex;padding-right:1ex">
<div dir="ltr">
<div><br></div><div>Thanks!</div><span class=""><font color="#888888"><div><div><br></div>-- <br><div dir="ltr"><div style="direction:rtl"><span style="color:rgb(102,102,102)">משיח NOW!</span><br></div><font color="#666666">Moshiach is coming very soon, prepare yourself!</font><div dir="rtl">

<font color="#666666">יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד!</font></div></div>
</div></font></span></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><div style="direction:rtl"><span style="color:rgb(102,102,102)">משיח NOW!</span><br></div><font color="#666666">Moshiach is coming very soon, prepare yourself!</font><div dir="rtl">
<font color="#666666">יחי אדוננו מורינו ורבינו מלך המשיח לעולם ועד!</font></div></div>
</div></div>