<h3>Description</h3>
<p>In a project, we implemented parts of our routing logic with javascript. We don't use KEMI at the moment. So most of the routing logic still happens in kamailio.cfg. We have implemented the t_relay part in JS, and after that we want to stop the execution of the routing logic. In kamailio config we would do that with return or exit. In our implementation we used KSR.x.exit(), but the execution of the kamailio config continues.</p>
<p>This is how our kamailio config section looks like:</p>
<pre><code> # No Accounting special calls
if ( $fU =~ "^1234567$") {
resetflag(doAccounting);
}
if (!jsdt_run("routeSomeCallsHere")) {
xlog("L_ERR", "JS Call of routeSomeCallsHere route failed.\n");
}
# routing decision
route(makeRoutingDecision);
</code></pre>
<p>This is what the JS does:</p>
<pre><code>function relayPacket() {
KSR.dbg("Sending out packet " + KSR.pv.get("$rm") + " statefully.\n");
if (KSR.tm.t_relay() < 0) {
KSR.err("statefulForward: error to <" + KSR.pv.get("$tu") + "> from <" + KSR.pv.get("$fu") + ">\n");
if (KSR.is_method_in("IA")) {
KSR.rtpengine.rtpengine_delete0();
}
KSR.sl.sl_reply_error();
KSR.x.exit();
return false;
}
KSR.info("DONE relaying!!!");
KSR.x.exit();
return true;
};
</code></pre>
<p>Looks to us as if KSR.x.exit() does not work in our scenario. Did we miss something? In the end, Kamailio sends out two INVITEs, one from JS and one from the old routing logic.</p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>version: kamailio 5.1.4 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 4.7.2
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>
<p>Debian Wheezy</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1936">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZOE7WRVJFNVS4T7P7DPSATNXANCNFSM4HICEW3Q">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABO7UZIF7VCMXHXMFJZJCEDPSATNXANCNFSM4HICEW3Q.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"app_jsdt: KSR.x.exit() not working as intended (#1936)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1936"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1936",
"url": "https://github.com/kamailio/kamailio/issues/1936",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>