<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello,<br>
<br>
Which OpenSIPS version are you using ?<br>
You could use get_timestamp [1] from the Core to get the current
second and microsecond,<br>
and set the two variables at INVITE time, and set them as db_extra
[2] .<br>
<br>
Then, at BYE time call again the get_timestamp function, store
them in some AVPs and set those AVPs in [3]. This way you should
get both the INVITE and BYE timestamps with microseconds precision
in the CDR record.<br>
<br>
[1]
<a class="moz-txt-link-freetext" href="http://www.opensips.org/Documentation/Script-CoreFunctions-1-10#toc18">http://www.opensips.org/Documentation/Script-CoreFunctions-1-10#toc18</a><br>
[2]
<a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/1.10.x/acc.html#id295028">http://www.opensips.org/html/docs/modules/1.10.x/acc.html#id295028</a><br>
[3]
<a class="moz-txt-link-freetext" href="http://www.opensips.org/html/docs/modules/1.10.x/acc.html#id295056">http://www.opensips.org/html/docs/modules/1.10.x/acc.html#id295056</a><br>
<br>
Best Regards,<br>
<pre class="moz-signature" cols="72">Vlad Paiu
OpenSIPS Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a> </pre>
On 12.04.2014 23:44, Maciej Bylica wrote:<br>
</div>
<blockquote
cite="mid:CACynCY6PZDB0kr4DfdhLfp0uAyj=atv8h-JQpQiXhSt5-TaCtQ@mail.gmail.com"
type="cite">
<div dir="ltr">Hello Ryan,
<div><br>
</div>
<div>I am using dialog accounting, so each row is fully
qualified cdr record, not only single transaction of a call.</div>
<div>Couldn't i just use two extra db variables which will
gather the $time inside INVITE {} and BYE {}?</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Mac</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">2014-04-12 6:39 GMT+02:00 Ryan Mitchell
<span dir="ltr"><<a moz-do-not-send="true"
href="mailto:rjm@tcl.net" target="_blank">rjm@tcl.net</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<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>
<div class="h5">
<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
moz-do-not-send="true"
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>2014-04-10 22:03 GMT+02:00 Ryan
Mitchell <span dir="ltr"><<a
moz-do-not-send="true"
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>
<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
moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:Users@lists.opensips.org"
target="_blank">Users@lists.opensips.org</a><br>
<a moz-do-not-send="true"
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
moz-do-not-send="true"
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>
<br>
_______________________________________________<br>
Users mailing list<br>
<a moz-do-not-send="true"
href="mailto:Users@lists.opensips.org"
target="_blank">Users@lists.opensips.org</a><br>
<a moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:Users@lists.opensips.org"
target="_blank">Users@lists.opensips.org</a><br>
<a moz-do-not-send="true"
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 moz-do-not-send="true"
href="mailto:rjm@tcl.net" target="_blank">rjm@tcl.net</a>><br>
Telecom Logic, LLC<br>
<br>
</div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
Users mailing list<br>
<a moz-do-not-send="true"
href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a moz-do-not-send="true"
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>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
</body>
</html>