<div dir="ltr">Hello Mac,<div><br></div><div>Each row in the acc table is for a transaction. To make a proper CDR out of the data, you have to combine rows to find the start and end of the call. That can be harder than it sounds, especially with forking (parallel, or the more common case of serial forking when you are LCR routing or simply sending calls to alt destinations after a timeout). I wrote scripts that implement a simple dialog state machine to make sense of all the distinct legs of a call, though there should be an easier way with the auto-cdr / multi call-legs accounting feature of the acc module (anyone comment on this please?).</div>
<div><br></div><div>The time field in the acc table will be the timestamp of the response for the given transaction. If you assign an extra field for another timestamp, it will depend on where you assign that var in your script. In my case I assign it in the main routing section so the timestamp indicates the start of the transaction.</div>
<div><br></div><div>best regards,</div><div>Ryan</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 11, 2014 at 10:06 AM, Maciej Bylica <span dir="ltr"><<a href="mailto:mbsip@gazeta.pl" target="_blank">mbsip@gazeta.pl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Ryan,<div><br></div><div>One more question.</div><div>Currently i have some db extra attrs setup. My acc table looks like following:</div>
<div><p style="margin:0px;font-size:11px;font-family:Menlo">+------------+------------------+------+-----+---------+----------------+</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| Field | Type | Null | Key | Default | Extra |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">+------------+------------------+------+-----+---------+----------------+</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| id | int(10) unsigned | NO | PRI | NULL | auto_increment |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| method | char(16) | NO | | | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| from_tag | char(64) | NO | | | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| to_tag | char(64) | NO | | | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| callid | char(64) | NO | MUL | | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| sip_code | char(3) | NO | | | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| sip_reason | char(32) | NO | | | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| time | datetime | NO | | NULL | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| duration | int(11) unsigned | NO | | 0 | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| setuptime | int(11) unsigned | NO | | 0 | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| SourceAddr | char(30) | NO | | NULL | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| DestAddr | char(30) | NO | | NULL | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| Anum | char(30) | NO | | NULL | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| Bnum_rU | char(30) | NO | | NULL | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| Bnum_tU | char(30) | NO | | NULL | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">| created | datetime | YES | | NULL | |</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">+------------+------------------+------+-----+---------+----------------+</p><p style="margin:0px;font-size:11px;font-family:Menlo"><br></p><p style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(83,48,225)">
<span style="color:rgb(206,121,36)">modparam("acc", "db_extra", "SourceAddr=$si</span>; DestAddr=$rd; Anum=$fU; Bnum_rU=$rU; Bnum_tU=$tU")</p><p style="margin:0px;font-size:11px;font-family:Menlo">
<br></p><p style="margin:0px;font-size:11px;font-family:Menlo"><span style="font-family:arial;font-size:small">Now using additional data like $time will give me the exact moment the call is ended, nothing more, am i right?</span></p>
<p style="margin:0px">To have detailed call duration i need to know exact answer and disconnect timestamps.</p><p style="margin:0px"><br></p><p style="margin:0px">Btw: i am using<span style="font-family:Menlo;font-size:11px"> OpenSIPS (1.9.1-notls (x86_64/linux))</span></p>
<p style="margin:0px"><br></p><p style="margin:0px">Thanks,</p><p style="margin:0px">Mac</p></div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div class="">2014-04-10 22:03 GMT+02:00 Ryan Mitchell <span dir="ltr"><<a href="mailto:rjm@tcl.net" target="_blank">rjm@tcl.net</a>></span>:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Using db_extra to stuff custom data into your acc table, use the $time var with a format such as "%s.%N" or similar.<div>
<div class="h5"><div>
<br></div><div>Or, as you suggested, do it on the database level with a trigger or auto-update column.</div>
<div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Thu, Apr 10, 2014 at 10:01 AM, Maciej Bylica <span dir="ltr"><<a href="mailto:mbsip@gazeta.pl" target="_blank">mbsip@gazeta.pl</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><span style="white-space:nowrap;font-family:arial,sans-serif">Hello</span><br>
</div><div><font face="arial, sans-serif"><span style="white-space:nowrap"><br>
</span></font></div><div><font face="arial, sans-serif"><span style="white-space:nowrap">I just want to know how to achieve miliseconds precision for accounting module.</span></font></div>
<div><span style="white-space:nowrap;font-family:arial,sans-serif">This is quite important while trying to sum up total traffic duration with the accuracy of hundred of ms.</span><br></div><div><span style="white-space:nowrap;font-family:arial,sans-serif"><br>
</span></div><div><span style="white-space:nowrap;font-family:arial,sans-serif">As i see there is no rounding feature implemented as well, but heaving ms precision it could be done directly on DB level.</span></div><div>
<span style="white-space:nowrap;font-family:arial,sans-serif"><br>
</span></div><div><span style="white-space:nowrap;font-family:arial,sans-serif">Could somebody give me a hand.</span></div><div><span style="white-space:nowrap;font-family:arial,sans-serif"><br></span></div><div><span style="white-space:nowrap;font-family:arial,sans-serif">Thanks in advanced</span></div>
<div><span style="white-space:nowrap;font-family:arial,sans-serif">Mac</span></div><div><br></div><div><br></div></div>
<br></div></div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><div><br></div>-- <br>Ryan Mitchell <<a href="mailto:rjm@tcl.net" target="_blank">rjm@tcl.net</a>><br>Telecom Logic, LLC<br><br>
</font></span></div></div></div></div><div><div class="h5">
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></div></div></blockquote></div><br></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Ryan Mitchell <<a href="mailto:rjm@tcl.net" target="_blank">rjm@tcl.net</a>><br>Telecom Logic, LLC<br><br></div></div>