Because you are using dialog that invite entry in acc table is written at the time of bye. I prefer a single entry in acc table for each call, not 2
Best regards: Marcin Groszek > On Apr 8, 2021, at 8:15 AM, Kingsley Tart <[email protected]> wrote: > > Thanks, though that didn't seem to have made any difference :( > > It *is* logging durations though (something you mentioned in your other > email). > > Cheers, > Kingsley. > >> On Thu, 2021-04-08 at 07:10 -0500, Marcin Groszek wrote: >> remove >> >> t_newtran(); >> >> >>> On 4/8/2021 5:55 AM, Kingsley Tart wrote: >>> Hi, >>> >>> I'm using OpenSIPS 3.1 with logging to DB and using the dialog >>> module. >>> >>> It is logging INVITE messages, but not BYE and I can't see why. I'm >>> new >>> to OpenSIPS so this is puzzling me a bit. >>> >>> >>> This is what I'm setting in the acc module: >>> >>> loadmodule "acc.so" >>> modparam("acc", "early_media", 1) >>> modparam("acc", "report_cancels", 1) >>> modparam("acc", "detect_direction", 0) >>> modparam("acc", "db_url", "mysql://blah...") >>> >>> >>> My main route script starts with this: >>> >>> script_trace(1, "method $rm"); >>> >>> >>> I'm doing this when an INVITE comes in: >>> >>> t_newtran(); >>> create_dialog("pPB"); >>> do_accounting("db", "cdr|missed|failed"); >>> >>> >>> I have this, but it made no difference (although "BYE RECEIVED" did >>> appear in the opensips log): >>> >>> if (is_method("BYE")) { >>> # do accounting even if the transaction fails >>> xlog("BYE RECEIVED"); >>> do_accounting("db", "cdr|missed|failed"); >>> } >>> >>> >>> I have this event route: >>> >>> event_route[E_DLG_STATE_CHANGED] { >>> switch ($param(7)) { >>> case 1: >>> xlog("** DLG ** INVITE SENT"); >>> break; >>> case 2: >>> xlog("** DLG ** PROVISIONAL REPLY"); >>> break; >>> case 3: >>> xlog("** DLG ** PROVISIONALLY ANSWERED"); >>> break; >>> case 4: >>> xlog("** DLG ** CONFIRMED ANSWERED"); >>> break; >>> case 5: >>> xlog("** DLG ** BYE RECEIVED - ENDED"); >>> break; >>> } >>> } >>> >>> >>> and I see this in the opensips log when the call ends (I see >>> "do_accounting" in the trace): >>> >>> /usr/sbin/opensips[22551]: ** DLG ** BYE RECEIVED - ENDED >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:225][core if] -> (method BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:220][module validate_dialog] -> >>> (method BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:230][core if] -> (method BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:225][module is_method] -> (method >>> BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:238][core if] -> (method BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:230][module is_method] -> (method >>> BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:233][module do_accounting] -> >>> (method BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:238][route relay] -> (method BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:431][core if] -> (method BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:428][module t_relay] -> (method >>> BYE) >>> /usr/sbin/opensips[22552]: [Script >>> Trace][/etc/opensips/opensips.cfg:431][core exit] -> (method BYE) >>> >>> >>> But the acc table only ever gets INVITEs logged; here are records >>> for >>> the last 2 test calls: >>> >>> MariaDB [opensips]> SELECT id,method,callid,sip_code FROm acc ORDER >>> BY >>> id DESC LIMIT 4; >>> +-----+--------+--------------------------------------+----------+ >>>> id | method | callid | sip_code | >>> >>> +-----+--------+--------------------------------------+----------+ >>>> 234 | INVITE | 18d9cfb9-5add-4824-9d19-b828c10df9f4 | 200 | >>>> 233 | INVITE | 18d9cfb9-5add-4824-9d19-b828c10df9f4 | 183 | >>>> 232 | INVITE | a3a3f3b3-3ac0-45de-8cb7-f208b2d420d0 | 200 | >>>> 231 | INVITE | a3a3f3b3-3ac0-45de-8cb7-f208b2d420d0 | 183 | >>> >>> +-----+--------+--------------------------------------+----------+ >>> >>> >>> Am I missing something obvious? >>> >>> Cheers, >>> Kingsley. >>> >>> >>> _______________________________________________ >>> Users mailing list >>> [email protected] >>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users >>> > > > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > _______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
