<h2>Issue:</h2>

<p>Asynchronous Route Blocks gets executed as a failure_route, even though there never ever was a failure.</p>

<h2>Version:</h2>

<p>GIT Trunk (dev), not checked earlier versions.</p>

<h2>Example Config / how to reproduce</h2>

<p>I've got the following main route:</p>

<pre><code>route {
        [...]
    if (is_method("PUBLISH") && search("^(Event|o)([ \t]*):([ \t]*)reg")) {
                route(PUBLISH);
                break;
        }

    async_sleep("1");

    #Set DLG flag to track dialogs using dialog2
    if (!is_method("REGISTER|SUBSCRIBE"))
        setflag(FLT_DIALOG);
        [...]
}
</code></pre>

<p>With debugger module enabled, it shows as follows in syslog:</p>

<pre><code>Aug 17 15:41:09 ubuntu-2gb-fra1-01 [6968]: ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=397 a=25 n=is_method
Aug 17 15:41:09 ubuntu-2gb-fra1-01 [6968]: ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=407 a=16 n=if
Aug 17 15:41:09 ubuntu-2gb-fra1-01 [6968]: ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=402 a=25 n=is_method
Aug 17 15:41:09 ubuntu-2gb-fra1-01 [6968]: ERROR: *** cfgtrace:request_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=407 a=25 n=async_sleep
Aug 17 15:41:09 ubuntu-2gb-fra1-01 [6975]: ERROR: *** cfgtrace:failure_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=414 a=16 n=if
Aug 17 15:41:09 ubuntu-2gb-fra1-01 [6975]: ERROR: *** cfgtrace:failure_route=[DEFAULT_ROUTE] c=[/etc/kamailio/kamailio.cfg] l=410 a=25 n=is_method
</code></pre>

<hr>

<p>Why is route_type suddenly a failure-route? At a different part of my logic, this leads to unexpected results.</p>

<p>Looking at modules/tm/t_suspend.c (lines 277 ff.), I see the reason:</p>

<pre><code>        route_type_bk = get_route_type();
        set_route_type(FAILURE_ROUTE);
        /* execute the pre/post -script callbacks based on original route block */
        if (exec_pre_script_cb(&faked_req, cb_type)>0) {
            if (run_top_route(route, &faked_req, 0)<0)
                LM_ERR("failure inside run_top_route\n");
            exec_post_script_cb(&faked_req, cb_type);
        }
        set_route_type(route_type_bk);
</code></pre>

<p>Any particular reason, why the route-type is explicitly set to FAILURE_ROUTE?</p>

<p>Thanks,<br>
Carsten</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/750">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZXTZ4daW0gkTQD8RgbH_-hccDLz-ks5qgxYMgaJpZM4JmfRw">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZU1Qn0KFGPszo5dEhY4QYqqf4HZ8ks5qgxYMgaJpZM4JmfRw.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/750"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<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://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Async Routes and Route-Types (#750)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/750"}}}</script>