[OpenSIPS-Users] OpenSIPS 3.1 DB logging INVITEs but not BYEs
Kingsley Tart
kingsley at dns99.co.uk
Fri Apr 9 11:45:00 EST 2021
Hi,
I found that changing this:
modparam("acc", "early_media", 1)
to this:
modparam("acc", "early_media", 0)
Has stopped the multiple records. With early_media on, a 180 or 183
created a new record.
I already have that info in custom fields anyway by having this (just
testing, so "doodle" was as good a name as any at the time :) ):
onreply_route[doodle] {
if (t_check_status("^1[0-9][0-9]$")) {
switch ($T_reply_code) {
case 180: $acc_extra(t_ringing) = $Ts; break;
case 183: $acc_extra(t_progress) = $Ts; break;
}
} else if (t_check_status("^2[0-9][0-9]$")) {
$acc_extra(t_answer) = $Ts;
} else {
$acc_extra(t_clear) = $Ts;
}
}
though the t_clear field only gets logged for missed calls, not
answered ones (but the call duration for answered calls IS logged in
the duration field, so I suppose t_clear is superfluous in the acc
table, really). I tried putting the setting of $acc_extra(t_clear) into
event_route[E_DLG_STATE_CHANGED] when new state=5 but this didn't work
either.
I don't actually mind not getting the BYE logged specifically as long
as I can tell when it happened (as I can from the duration field). It's
just that I was following an example in Bogdan's book about OpenSIPS
2.1 that seemed to expect a BYE to be logged separately.
Cheers,
Kingsley.
On Fri, 2021-04-09 at 14:10 +0300, Răzvan Crainea wrote:
> Hi, Marcin, Kingsley!
>
> Indeed, if you'll be running only do_accounting("db", "cdr"), you will
> only get one record, at the end of the call, containing the `INVITE`
> method. That's more or less hardcoded there, and can't be changed.
> Giving a second thought about it, I somehow agree that's not 100%
> suggestive or correct, although I was the one who wrote that code :).
> The idea was to create a CDR format compatible with previous formats of
> acc, which were requiring a method. But since a call consists of several
> methods, the easiest way to pick one was to pick the first one, namely
> INVITE. Hence the CDR always has an INVITE method.
> If you have other thoughts on this, any feedback is welcome.
>
> Best regards,
>
> Răzvan Crainea
> OpenSIPS Core Developer
> http://www.opensips-solutions.com
>
> On 4/8/21 8:26 PM, Marcin Groszek wrote:
> > At initial invite some information are stored like a start time, this is
> > needed to calculate the duration at the call end.
> >
> > I believe if you do: do_accounting("db","cdr") this will write only 1
> > invite entry in acc at the end of the call,
> >
> > but if you do: do_accounting("db") this will write your invite and bye
> > as 2 entries in acc table.
> >
> > make a call, select * from acc at your db hung up the call and select
> > again you will see when the entries are written.
> >
> > You may also use ngrep -port 3306 -dlo to monitor db access by opensips
> > but you have to change localhost to 127.0.0.1 in modparam.
> >
> > modparam("acc", "db_url", "mysql://opensips:opensipsrw@127.0.0.1/opensips")
> >
> >
> >
> > On 4/8/2021 11:09 AM, Kingsley Tart wrote:
> > > I would prefer a single record as well. I don't understand why using
> > > the dialog module makes it write a new "INVITE" record at BYE time
> > > instead of either writing a BYE record, or allowing me to update it
> > > with a few custom fields, one of which would be t_end or something.
> > >
> > > Cheers,
> > > Kingsley.
> > >
> > > On Thu, 2021-04-08 at 09:17 -0500, Marcin Groszek wrote:
> > > > 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 <kingsley at dns99.co.uk>
> > > > > 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.
> > >
> > > _______________________________________________
> > > Users mailing list
> > > Users at lists.opensips.org
> > > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> > >
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
More information about the Users
mailing list