Hi,

when I use t_reply("505", "Error"); in my failure route, the response is not forwarded and following is written into a log:

kamailio[26216]: WARNING: tm [t_lookup.c:1559]: t_unref(): WARNING: script writer didn't release transaction

plus next line is written exactly 416000 times into a log afterwards:

kamailio[32685]: CRITICAL: dialog [dlg_hash.c:794]: log_next_state_dlg(): bogus event 4 in state 5 for dlg 0xb4af6588 [2575:7017] with clid '121d44f0-6555f4c8' and tags 'd12546d053aadc68o2' ''

My point is to change the incoming code from users and append a Q.850 reason code.
Is there any other way how to do this or a way how to fix this?
I'm using Kamilio 4.0.4 on Debian 7.1


The code is as follows:
failure_route[MANAGE_FAILURE]
{
        if (t_is_canceled()) {
                exit;
        }
        if($T_reply_code == 408 && isflagset(10))
        {
                xlog("Ringing timeout");
                append_to_reply("Reason: Q.850;cause=28\r\n");
                t_reply("505", "Error");
        }
}