Question

I'm trying to get Kamailio to log its CDRs to text files instead of a database. The calls route ok but I get nothing in my CDR directory. Here's what I think are the relevant bits of the kamailio.cfg file. Obviously that's not everything but most of it is the default that ships with the 3.3.1 distribution. The calls route according to the distribution file but nothing gets written in the /var/log/kamailio directory on call termination. Kamailio is running as kamailio:kamailio and the directory is owned by same. A wireshark trace shows correct signalling code order (invite to IVR, trying, 200, Bye) and there's audio.

Thanks.

`...
loadmodule "dialog.so"
loadmodule "db_flatstore.so"
...
modparam("acc", "db_url", "flatstore:/var/log/kamailio") 
modparam("acc", "early_media", 0)
modparam("acc", "report_ack", 0) 
modparam("acc", "report_cancels", 0)
modparam("acc", "detect_direction", 0)
modparam("acc", "log_flag", FLT_ACC)
modparam("acc", "log_missed_flag", FLT_ACCMISSED)
modparam("acc", "log_extra", 
modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
modparam("acc", "cdr_enable", 1)
modparam("acc", "cdr_flag", 3)
...
request_route {
    ...
        remove_hf("Route");
        if (is_method("INVITE")) {
                record_route();   
                setflag(FLT_ACC); 
                ds_select_dst("1","4");
                forward();
                exit();   
        }
        ...
}

`

Was it helpful?

Solution

Found the issue after being driven half potty. The problem lies with the "forward()" - the accounting record is not written in this case.

Instead of using forward() use

if (!t_relay()) {
    sl_reply_error();
}

and the accounting record gets magically written. My modparams for the acc module are also all over the place, but that's still a research-in-progress and doesn't affect the basic issue I had here.

If anyone cleverer than me could explain why the forward doesn't write the CDR then I'd be grateful if you could write a comment.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top