Hello,
another addition to the dialog module is the new pseudo-variable class
$dlg(...)
http://www.kamailio.org/dokuwiki/doku.php/pseudovariables:devel#dlg_attr
With it you can get access to all attributes of current processed
dialog, e.g., caller and callee URI, start time, flags...
A typical use case is to write full cdr when the BYE comes over - the
dialog stores the start time and you can get the end time via $Ts. You
can either write the acc record at dialog ending or update the start acc
event written when INVITE was processed - you have access to the
call-id, from tag and to tag in the right order and one shot of
sql_query() will do it.
Cheers,
Daniel