Hi-

I am having a problem where if I parallel fork a call, my failure_route gets called after the caller hangs up.  I thought adding t_check_status("487") to the failure_route would take care of that, but it still t_relays when I don't want it to.  This only seems to be a problem if it parallel forks and one of the SIP targets is not available.  If I dial an alias with a single [not forked] target the t_check_status("487") works fine.

Here is my code.. any thoughts?

Thanks much.

Dan

route {

<<<< Registration code snipped for brevity >>>>

        if(lookup("aliases")) {
                xlog("L_NOTICE", "%ci: alias lookup changed uri to %ru\n");

                # If alias points outbound, forward it without question.
                if (!(uri==myself)) {
                        xlog("L_NOTICE", "%ci: outbound alias\n");
                        route(4);  # relay with hunt on failure
                        break;
                };
        };


        if ( (uri=~"^sip:911@.*") | (uri=~"^sip:011[0-9]+@.*") |
             (uri=~"^sip:1[0-9]{10}@.*") ) {

                        route(3);
                        break;
        };

        # Local location
        route(4); # relay with hunt on failure

} /* end of initial routing logic */

route[4] {
        xlog("L_INFO", "r4: Relay with Hunt\n");
        # If an invitation, we want to hunt on failure
        if(method == "INVITE") {
                t_on_failure("1");  # first hunt
        };

        if (!lookup("location")) {
                xlog("L_NOTICE", "%ci: no location for %ru\n");
        };

        append_hf("P-hint: relay\r\n");
        if (!t_relay()) {
                sl_reply_error();
                break;
        };
}


failure_route[1] {

        xlog("L_INFO", "failure+route+1 %ru\n");

        revert_uri();
        setflag(9);

        # Check to see if the call was cancelled
        if( t_check_status("487") | method == "CANCEL") {
                xlog("L_INFO", "t_check_status is 487\n");
                break;
        }

        prefix("h1-");
        if(lookup("hunt")) {  # Hunt table is an exact copy of aliases
                xlog("L_NOTICE",
                     "%ci: fail_r_1: hunt changed URI to %ru, relaying\n");
                append_branch();
                append_hf("P-hint: pt-hunt\r\n");
                t_relay();
                break;
        } else {
                xlog("L_NOTICE",
                     "%ci: r8: no further hunts, giving up\n");
                break;
        };

}