Hi all,

I'm trying to do a serial call forwarding
if callees don't answer.

I've added a field in a table which is the number
the users want to forward the call if they don't answer.

I've a shell script (myScript.sh) which works like that:
    If the forward mode is activated for the user, 
    then the address is overwritten and the script returns 0,
    else it returns 1.


My main route ends by "t_on_failure("1");" in my ser.cfg,
and I've write these  lines after the main route:

failure_route[1]
{
    if (exec_dset("/path/to/myscript/myScript.sh \"$SIP_HF_TO\""));
    {
       route(2);
    }
    break;
}

route[2]
{
    sl_send_reply("300","Redirect");
    break;
}

I also use the tm module and I've set the fr_inv_timer and the fr_timer to the values I wanted.


In my configuration :
    User 1 wants to forward the call to User 2.
    User 2 wants to forward the call to User 3.
    User 3 wants to forward the call to User 1.

When User 4 calls User 1, who doesn't answer, the call is well forwarded to User 2 after
5 ringings. User 2 doesn't answer and the call is well forwarded to User 3 . Etc.

So it works fine, if at least one of the callee answers.

But if the caller hangs up (sending a CANCEL to the callee), the phones  are always ringing and forwarding
the call in the same order.

Does anybody have an idea to solve this problem?

Thanks.

B.R.
Xavier.