<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Daniel,<br>
      <br>
      Yes, transaction is on the final response - fro INVITE you want to
      account when the call was accepted, not when it was dialed. If you
      want for the BYE to account when the request was received, use
      extra accounting to store the timestamp (ms also) of receiving the
      BYE (via script operations). When you correlate the INVITE with
      the BYE, you will calculate the duration from the 200 OK INVITE to
      the BYE request.<br>
      <br>
      Or much simpler just use dialog based accounting which is already
      doing this.<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a>

OpenSIPS Bootcamp 2017, Houston, US
  <a class="moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html">http://opensips.org/training/OpenSIPS_Bootcamp_2017.html</a>
</pre>
    <div class="moz-cite-prefix">On 07/27/2017 12:05 AM, Daniel Zanutti
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAN0jgiMwgQMVYfDr-fMC6VAmSSCuoFHm7C=a6=1yGABhnprOVw@mail.gmail.com">
      <div dir="ltr">Hi Bogdan
        <div><br>
        </div>
        <div>So on transaction accounting, the record is written after
          transaction receives final response. So it's not written as
          soon I receive BYE, but when I receive the 200OK of the BYE.<br>
        </div>
        <div><br>
        </div>
        <div>My customer is complaining that the call is taking 200ms
          more and our system is charging 1 sec more than on his
          billing. On million calls, this is generating a some thousands
          difference.</div>
        <div><br>
        </div>
        <div>Thanks for the information! <br>
        </div>
        <div><br>
        </div>
        <div>Regards</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Jul 25, 2017 at 6:36 AM,
          Bogdan-Andrei Iancu <span dir="ltr"><<a
              href="mailto:bogdan@opensips.org" target="_blank"
              moz-do-not-send="true">bogdan@opensips.org</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> <tt>Hi Daniel,<br>
                <br>
                There are 3 types of accountings in OpenSIPS - per
                message, per transaction, per dialog.<br>
                <br>
                For the per message, it is clear :) . When doing
                per-transaction accounting, the ACC record is written
                when the transaction is completed with a final response
                (>=200) on the UAS side (towards caller). For the
                dialog based accounting, the time reference (for ending
                the call) is the reception of BYE request; still the CDR
                is written on the BYE final reply (as OpenSIPS allows
                you to collect CDR info from the BYE replies too).<br>
                <br>
                Best regards,<br>
              </tt>
              <pre class="m_-2251000385425811833moz-signature" cols="72">Bogdan-Andrei Iancu
  OpenSIPS Founder and Developer
  <a class="m_-2251000385425811833moz-txt-link-freetext" href="http://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">http://www.opensips-solutions.<wbr>com</a>

OpenSIPS Bootcamp 2017, Houston, US
  <a class="m_-2251000385425811833moz-txt-link-freetext" href="http://opensips.org/training/OpenSIPS_Bootcamp_2017.html" target="_blank" moz-do-not-send="true">http://opensips.org/training/<wbr>OpenSIPS_Bootcamp_2017.html</a>
</pre>
              <div>
                <div class="h5">
                  <div class="m_-2251000385425811833moz-cite-prefix">On
                    07/20/2017 10:49 PM, Daniel Zanutti wrote:<br>
                  </div>
                  <blockquote type="cite">
                    <div dir="ltr">Hi Alex
                      <div><br>
                      </div>
                      <div>I'm having a billing problem from receiving
                        BYE to 200 OK is taking more than 500ms. If BYE
                        is accounted when it's received, great!</div>
                      <div><br>
                      </div>
                      <div>Are you absolutely sure it works this way?</div>
                      <div><br>
                      </div>
                      <div>Thanks</div>
                    </div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On Thu, Jul 20, 2017 at
                        4:26 PM, Alex Balashov <span dir="ltr"><<a
                            href="mailto:abalashov@evaristesys.com"
                            target="_blank" moz-do-not-send="true">abalashov@evaristesys.com</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">My understanding is
                          that this is a rather simple module without
                          sophisticated state componentry, and that it
                          logs things immediately as received, in the
                          same iteration of message processing.<br>
                          <br>
                          -- Alex<br>
                          <br>
                          --<br>
                          Principal, Evariste Systems LLC (<a
                            href="http://www.evaristesys.com"
                            rel="noreferrer" target="_blank"
                            moz-do-not-send="true">www.evaristesys.com</a>)<br>
                          <br>
                          Sent from my Google Nexus.<br>
                          <div class="m_-2251000385425811833HOEnZb">
                            <div class="m_-2251000385425811833h5"><br>
                              ______________________________<wbr>_________________<br>
                              Users mailing list<br>
                              <a href="mailto:Users@lists.opensips.org"
                                target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a><br>
                              <a
                                href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users"
                                rel="noreferrer" target="_blank"
                                moz-do-not-send="true">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a><br>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                    </div>
                    <br>
                    <fieldset
                      class="m_-2251000385425811833mimeAttachmentHeader"></fieldset>
                    <br>
                    <pre>______________________________<wbr>_________________
Users mailing list
<a class="m_-2251000385425811833moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a class="m_-2251000385425811833moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-<wbr>bin/mailman/listinfo/users</a>
</pre>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>