The lack of values in some of the standard pseudo variables is a limitation of the dialog module which does not provide  the necessary information in the event route block in cases when the call is forced to end.

You can calculate the duration using:

 $var(duration)  = $TS - $dlg(start_ts);

Regards,
Carlos





On Sat, Jul 20, 2013 at 2:07 AM, Jayesh Nambiar <jayesh1017@gmail.com> wrote:
Hello,
Is there a straight forward way of getting the duration of the call in cnxcc-call-shutdown event. The $DLG_lifetime returns NULL as the dialog does not exist. I dont get the value of $DLG_lifetime even in dialog:end event when the call ends through cnxcc module. Even the cdr flag of acc module doesn't get the duration and it logs, invalid values !!
Currently, I am storing the timestamp in htable when the call is answered and then subtract it from the current timestamp in the cnxcc:shutdown event route to get the duration. Something like this:

onreply_route[MANAGE_REPLY] {
    xdbg("incoming reply\n");
 
    if(status=="200") {
        $sht(ts=>$ci) = $Ts;
    }
}

event_route[cnxcc:call-shutdown] {
    
    $var(duration) = $TS-$sht(ts=>$ci);
    sht_rm_name_re("ts=>$ci");
    
    xlog("L_INFO", "Duration of call was $var(duration)");
}


Any more correct way of doing this would be very helpful.

Thanks,

--- Jayesh

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




--
Carlos
http://caruizdiaz.com
+595981146623