<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    can you add a debug message to acc module, compile, reinstall and
    test again? Send again the debug messages with parameter debug=4<br>
    <br>
    I am attaching the patch for master branch, should be easy to apply
    to 3.1 as well.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    On 9/13/11 11:33 AM, Daniel-Constantin Mierla wrote:
    <blockquote cite="mid:4E6F234D.200@gmail.com" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      Hello,<br>
      <br>
      On 9/13/11 11:21 AM, Ozren Lapcevic wrote:
      <blockquote
cite="mid:CAK1NKFt4-ktEH9jcf++hTtp7YJc6BG4sSBrT8s3eWrhQvVs3nw@mail.gmail.com"
        type="cite">Hi,<br>
        <br>
        <div class="im">On Tue, Sep 13, 2011 at 8:46 AM,
          Daniel-Constantin Mierla <span dir="ltr">&lt;<a
              moz-do-not-send="true" href="mailto:miconda@gmail.com"
              target="_blank">miconda@gmail.com</a>&gt;</span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hello,<br>
            <br>
            just to be sure, you used flag 2 for missed calls, right? I
            can see it set in onreply_route.<br>
          </blockquote>
        </div>
        <div><br>
          <br>
          Yes, I've used #!define FLT_ACCMISSED 2 and
          setflag(FLT_ACCMISSED) for missed calls. I checked the flag in
          onreply_route and failure route and they are properly set. <br>
          <br>
          &nbsp;</div>
        <div class="im">
          <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt
            0.8ex;border-left:1px solid rgb(204, 204,
            204);padding-left:1ex"> That means the flags are ok now, the
            issue seems to be in other place. You don't set any of the
            accounting flags in request route block, isn't it? I mean,
            the first accounting flag (like accounting answered calls or
            missed calls) is set in failure route. If so, the acc does
            not register itself for a tm callback that is used for
            handling accounting events.<br>
          </blockquote>
        </div>
        <div><br>
          <br>
          Actually, I do set other accounting flags in following routes:<br>
          <br>
          #!define FLT_ACC 1<br>
          #!define FLT_ACCMISSED 2<br>
          #!define FLT_ACCFAILED 3<br>
          <br>
          #MAIN ROUTE
          <div class="im"><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (is_method("INVITE")) setflag(FLT_ACC); <br>
            <br>
          </div>
          <div class="im">route[WITHINDLG] {<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (has_totag()) {<br>
          </div>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (loose_route()) {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (is_method("BYE")) {
          <div class="im"><br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setflag(FLT_ACC); # do
            accounting ...<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setflag(FLT_ACCFAILED); #
            ... even if the transaction fails<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .....<br>
            <br>
          </div>
          route[LOCATION] {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # only for people who don't have multiple contacts (no
          serial forking, not used in reported scenario)
          <div class="im"> <br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ( is_method("INVITE") &amp;&amp;
            !(isflagset(FLT_USRPREF))) setflag(FLT_ACCMISSED);<br>
            }<br>
            <br>
          </div>
          #called only for serial forked calls<br>
          failure_route[FAIL_FORK] {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .....<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # if second branch set flag<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setflag(FLT_ACCMISSED);<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t_flush_flags();<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ....<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # if 3rd branch (voicemail) reset flag<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; resetflag(FLT_ACCMISSED);<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t_flush_flags();<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ....<br>
          }<br>
          <br>
          <br>
          Now that you've mentioned it, I've removed all other setflag()
          functions and kept only the ones in FAIL_FORK failure route.
          There is still no logging of the second branch. <br>
          <br>
          &nbsp;</div>
        <div class="im">
          <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt
            0.8ex;border-left:1px solid rgb(204, 204,
            204);padding-left:1ex"> Try to set acc flag for writing to
            syslog in route {...}, you can reset it in failure route or
            onreply_route. Of course, this as an workaround for now, I
            will look for a proper solution in case this is the problem.<br>
          </blockquote>
        </div>
        <br>
        <br>
        I'm not sure I can implement needed logic this way. I don't want
        to account 1st branch. If I set FLT_ACCMISSED flag in route
        {...} and reset it in on_reply and failure route, it will be too
        late, the missed call will already be accounted. Or, I'm missing
        something?<br>
      </blockquote>
      <br>
      It meant setting FLT_ACC (not FLT_ACCMISSED) in main route and
      reset it on onreply_route in case you didn't want to account
      successful transactions at all. But I see you actually set the acc
      flag in route block ... probably I have to dig further in the logs
      for more details. So far it looked like an issue if no acc module
      flags were set in request route block.<br>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Kamailio Advanced Training, Oct 10-13, Berlin: <a class="moz-txt-link-freetext" href="http://asipto.com/u/kat">http://asipto.com/u/kat</a>
<a class="moz-txt-link-freetext" href="http://linkedin.com/in/miconda">http://linkedin.com/in/miconda</a> -- <a class="moz-txt-link-freetext" href="http://twitter.com/miconda">http://twitter.com/miconda</a></pre>
  </body>
</html>