Hello!
I'm trying to set max call duration, but after 5 seconds call is continues.
Kamailio version: 4.3.2
Here's part of my config file:

#!define CC_FLAG 29
...
modparam("cnxcc", "credit_check_period", 1)
modparam("cnxcc", "redis", "addr=127.0.0.1;port=6379;db=1")

modparam("dialog", "hash_size", 2048)
modparam("dialog", "default_timeout", 3600)
modparam("dialog", "db_mode", 0)
modparam("dialog", "dlg_flag", DLG_FLAG)
...
if ((is_method("INVITE")) && (is_request()) && (!has_totag())) {
    route(CNXCC);
}
route[CNXCC]
{
        setflag(DLG_FLAG);
        if (!is_method("INVITE"))
                        return;

        $var(client)         = $fU;
        $var(max_time)  = 5;

        if (!cnxcc_set_max_time("$var(client)", "$var(max_time)")) {
                xlog("Error setting up credit control");
                return;
        }
}

event_route[dialog:failed] {
        xlog("L_INFO", "********END CALL*********$DLG_lifetime*******************");
}

event_route[dialog:end] {
        xlog("L_INFO", "******END CALL************$DLG_lifetime****************");
}

event_route[dialog:start] {
        xlog("L_INFO", "***********************DIALOG STARTED****************************");
}

event_route[cnxcc:call-shutdown]
{
        $var(duration)  = $TS - $dlg(start_ts);
        xlog("L_INFO", *****END CALL***BALANCE IS EMPTY************$var(duration)*************");
}


Tell me please, where I made a mistake.
Thank you for a response.