For CDR purposes, the duration of a call is for how long that call was in conversation, which is reflected by $DLG_lifetime: http://www.kamailio.org/docs/modules/3.1.x/modules_k/dialog.html#id2745926 There's no need for 'fancy' duration computation like $var(elapsed) = ( $Ts - $dlg(start_ts) );
Regards, Ovidiu Sas On Thu, Oct 14, 2010 at 12:22 PM, Nathan Angelacos <nan...@nothome.org> wrote: > Hi Nicolas, > > On 10/14/10 08:50, "Nicolas Rüger" wrote: >> >> Hello, >> >> I'm trying to get dialog module working.. >> >> ...my problem is that nothing is stored in the database in table "dialog" >> yet. I'm looking for CDRs there... >> >> Can anyone please help me, so that I can see the CDRs in the database!??? >> > The dialog module keeps track of in progress dialogs (calls); so what would > be in the database are active calls, not CDRs. > > You'll need to (manually) record the status of the dialog at the end of the > dialog: > >> >> I inserted in kamailio.cfg: >> >> [...] >> >> loadmodule "dialog.so" >> >> [...] >> >> modparam("dialog", "db_url", "mysql://XXX:x...@localhost/openser") >> modparam("dialog", "db_mode", 1) >> modparam("dialog", "dlg_flag", 4) >> modparam("dialog", "dlg_match_mode", 1) >> >> [...] >> >> route { >> if (is_method("INVITE")) { >> dlg_manage(); >> } >> } > > Actually, you want dlg_manage() to be called for every message, not just > "INVITES" > > route { > dlg_manage(); > } > >> >> [...] >> > > Then, when you see a "BYE", you can record the CDR, something like: > > ($dlg() vars are in the pseudovariables docs) > > > route { > dlg_manage(); > > if (is_method("BYE")) { > $var(elapsed) = ( $Ts - $dlg(start_ts) ); > xlog ("L_INFO", "Completed $dlg(from_uri) to $dlg(to_uri) - > $var(elapsed) duration"); > } > } > >> >> I'm actually not sure what "dlg_flag" is good for, but kamailio doesn't >> start without. >> > > As Timo mentioned, "dlg_flag" is the thing that kamailio uses to actually > make the dialog module start tracking "dialogs" and not "transactions" > >> Thanks for your help... > > FWIW, since the db_mode is for "dialog changes", db_mode 4 can be hard on > your system - every change in state is reflected in the database. > > We use db_mode 3 in production for for performance reasons. >> >> Regards, >> >> Nicolas >> > > > _______________________________________________ > 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 > _______________________________________________ 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