<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>I expect that the code value is taken from status of the
      transaction, which at that time has 200ok ranked with more
      priority. I will check the code and if it proves to be this case,
      I will come up with a fix.<br>
    </p>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 09.11.17 10:42, Marco Capetta wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:b293de3d-3a07-5ec0-6b10-f3b26f610725@sipwise.com">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <font face="Helvetica, Arial, sans-serif">Hello,<br>
        <br>
        no we didn't try 5.0.X versions yet.<br>
        <br>
        To investigate deeper the issue, I added some additional log
        lines in the acc module. In particular, I did the following:<br>
        <br>
      </font><tt>/* is this reply of interest for accounting ? */</tt><tt><br>
      </tt><tt>static inline int should_acc_reply(struct sip_msg *req,
        struct sip_msg *rpl,</tt><tt> </tt><tt>int code)</tt><tt><br>
      </tt><tt>{</tt><tt><br>
      </tt><tt>   ...</tt><tt><br>
      </tt><tt>   ...</tt><tt><br>
      </tt><tt>    str req_callid, rpl_callid;</tt><tt><br>
      </tt><tt>    get_callid(req, &req_callid);</tt><tt><br>
      </tt><tt>    get_callid(rpl, &rpl_callid);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>    LM_ERR("++++++++++ early_media set to %d and code set
        to %d - call_id req: %.*s - call_id rpl: %.*s\n", early_media,
        code, req_callid.len, req_callid.s, rpl_callid.len,
        rpl_callid.s);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>    if ( code<200 && !(early_media &&</tt><tt><br>
      </tt><tt>                      
        parse_headers(rpl,HDR_CONTENTLENGTH_F, 0) == 0 &&</tt><tt><br>
      </tt><tt>                       rpl->content_length &&
        get_content_length(rpl) > 0)) {</tt><tt><br>
      </tt><tt>        LM_ERR("++++++++++ We will NOT account this reply
        - call_id req: %.*s - call_id rpl: %.*s\n", req_callid.len,
        req_callid.s, rpl_callid.len, rpl_callid.s);</tt><tt><br>
      </tt><tt>        return 0;</tt><tt><br>
      </tt><tt>    }</tt><tt><br>
      </tt><tt><br>
      </tt><tt>    LM_ERR("++++++++++ We will account this reply -
        call_id req: %.*s - call_id rpl: %.*s\n", req_callid.len,
        req_callid.s, rpl_callid.len, rpl_callid.s);</tt><tt><br>
      </tt><tt><br>
      </tt><tt>    return 1; /* seed is through, we will account this
        reply */</tt><tt><br>
      </tt><tt>}</tt><font face="Helvetica, Arial, sans-serif"><br>
        <br>
        In case of a "normal" call I have:<br>
      </font><tt><br>
      </tt><tt>Nov 9 08:52:23 sp2 proxy[12072]: ERROR: acc
        [acc_logic.c:413]: should_acc_reply(): ++++++++++ early_media
        set to 0 and code set to 183 - call_id req:
        f4227b9a898b482887d9aebdf7137061 - call_id rpl:
        f4227b9a898b482887d9aebdf7137061<br>
        Nov 9 08:52:23 sp2 proxy[12072]: ERROR: acc [acc_logic.c:418]:
        should_acc_reply(): ++++++++++ We will NOT account this reply -
        call_id req: f4227b9a898b482887d9aebdf7137061 - call_id rpl:
        f4227b9a898b482887d9aebdf7137061<br>
        Nov 9 08:52:23 sp2 proxy[12072]: NOTICE: <script>:
        NAT-Reply - S=183 - Session Progress M=INVITE
        IP=172.30.52.98:5060 (172.30.52.132:5080)
        ID=f4227b9a898b482887d9aebdf7137061 UA='<null>'<br>
        Nov 9 08:52:23 sp2 proxy[12072]: ERROR: acc [acc_logic.c:413]:
        should_acc_reply(): ++++++++++ early_media set to 0 and code set
        to 183 - call_id req: f4227b9a898b482887d9aebdf7137061 - call_id
        rpl: f4227b9a898b482887d9aebdf7137061<br>
        Nov 9 08:52:23 sp2 proxy[12072]: ERROR: acc [acc_logic.c:418]:
        should_acc_reply(): ++++++++++ We will NOT account this reply -
        call_id req: f4227b9a898b482887d9aebdf7137061 - call_id rpl:
        f4227b9a898b482887d9aebdf7137061<br>
        Nov 9 08:52:24 sp2 proxy[12073]: ERROR: acc [acc_logic.c:413]:
        should_acc_reply(): ++++++++++ early_media set to 0 and code set
        to 200 - call_id req: f4227b9a898b482887d9aebdf7137061 - call_id
        rpl: f4227b9a898b482887d9aebdf7137061<br>
        Nov 9 08:52:24 sp2 proxy[12073]: ERROR: acc [acc_logic.c:422]:
        should_acc_reply(): ++++++++++ We will account this reply -
        call_id req: f4227b9a898b482887d9aebdf7137061 - call_id rpl:
        f4227b9a898b482887d9aebdf7137061<br>
        Nov 9 08:52:24 sp2 proxy[12073]: NOTICE: <script>:
        NAT-Reply - S=200 - OK M=INVITE IP=172.30.52.98:5060
        (172.30.52.132:5080) ID=f4227b9a898b482887d9aebdf7137061
        UA='<null>'<br>
        Nov 9 08:52:24 sp2 proxy[12073]: ERROR: acc [acc_logic.c:413]:
        should_acc_reply(): ++++++++++ early_media set to 0 and code set
        to 200 - call_id req: f4227b9a898b482887d9aebdf7137061 - call_id
        rpl: f4227b9a898b482887d9aebdf7137061<br>
        Nov 9 08:52:24 sp2 proxy[12073]: ERROR: acc [acc_logic.c:422]:
        should_acc_reply(): ++++++++++ We will account this reply -
        call_id req: f4227b9a898b482887d9aebdf7137061 - call_id rpl:
        f4227b9a898b482887d9aebdf7137061</tt><tt><br>
      </tt><font face="Helvetica, Arial, sans-serif"><br>
      </font><font face="Helvetica, Arial, sans-serif"><font
          face="Helvetica, Arial, sans-serif">In case of a call with the
          issue I have:<br>
        </font><tt><br>
        </tt></font><tt> </tt><tt>Nov 8 23:42:38 sp2 proxy[12068]:
        ERROR: acc [acc_logic.c:413]: should_acc_reply(): ++++++++++
        early_media set to 0 and code set to 183 - call_id req:
        eb22b398fda649ec92abd98c85534914 - call_id rpl:
        eb22b398fda649ec92abd98c85534914 </tt><tt><br>
      </tt><tt>Nov 8 23:42:38 sp2 proxy[12068]: ERROR: acc
        [acc_logic.c:418]: should_acc_reply(): ++++++++++ We will NOT
        account this reply - call_id req:
        eb22b398fda649ec92abd98c85534914 - call_id rpl:
        eb22b398fda649ec92abd98c85534914<br>
        Nov 8 23:42:38 sp2 proxy[12068]: NOTICE: <script>:
        NAT-Reply - S=183 - Session Progress M=INVITE
        IP=172.30.52.98:5060 (172.30.52.132:5080)
        ID=eb22b398fda649ec92abd98c85534914 UA='<null>'<br>
        Nov 8 23:42:38 sp2 proxy[12073]: ERROR: acc [acc_logic.c:413]:
        should_acc_reply(): ++++++++++ early_media set to 0 and code set
        to 200 - call_id req: eb22b398fda649ec92abd98c85534914 - call_id
        rpl: eb22b398fda649ec92abd98c85534914<br>
        Nov 8 23:42:38 sp2 proxy[12073]: ERROR: acc [acc_logic.c:422]:
        should_acc_reply(): ++++++++++ We will account this reply -
        call_id req: eb22b398fda649ec92abd98c85534914 - call_id rpl:
        eb22b398fda649ec92abd98c85534914<br>
        Nov 8 23:42:38 sp2 proxy[12073]: NOTICE: <script>:
        NAT-Reply - S=200 - OK M=INVITE IP=172.30.52.98:5060
        (172.30.52.132:5080) ID=eb22b398fda649ec92abd98c85534914
        UA='<null>'<br>
        Nov 8 23:42:38 sp2 proxy[12068]: ERROR: acc [acc_logic.c:413]:
        should_acc_reply(): ++++++++++ early_media set to 0 and code set
        to 200 - call_id req: eb22b398fda649ec92abd98c85534914 - call_id
        rpl: eb22b398fda649ec92abd98c85534914<br>
        Nov 8 23:42:38 sp2 proxy[12068]: ERROR: acc [acc_logic.c:422]:
        should_acc_reply(): ++++++++++ We will account this reply -
        call_id req: eb22b398fda649ec92abd98c85534914 - call_id rpl:
        eb22b398fda649ec92abd98c85534914<br>
        Nov 8 23:42:38 sp2 proxy[12073]: ERROR: acc [acc_logic.c:413]:
        should_acc_reply(): ++++++++++ early_media set to 0 and code set
        to 200 - call_id req: eb22b398fda649ec92abd98c85534914 - call_id
        rpl: eb22b398fda649ec92abd98c85534914<br>
        Nov 8 23:42:38 sp2 proxy[12073]: ERROR: acc [acc_logic.c:422]:
        should_acc_reply(): ++++++++++ We will account this reply -
        call_id req: eb22b398fda649ec92abd98c85534914 - call_id rpl:
        eb22b398fda649ec92abd98c85534914</tt><br>
      <font face="Helvetica, Arial, sans-serif"><br>
        It seems that in the second call the provisional response is
        evaluated from acc module after the 200 message has been
        received, so the sip code is 200 instead of 183.<br>
        <br>
        Thanks<br>
        Marco<br>
        <br>
      </font><br>
      <div class="moz-cite-prefix">On 11/09/2017 10:20 AM,
        Daniel-Constantin Mierla wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:c1d2e35a-9c16-793c-cd3b-74b6efc52abc@gmail.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        <p>Hello,<br>
        </p>
        <br>
        <div class="moz-cite-prefix">On 09.11.17 09:50, Marco Capetta
          wrote:<br>
        </div>
        <blockquote type="cite"
          cite="mid:03d7946b-a149-858c-312f-79a0b8add358@sipwise.com">
          <meta http-equiv="content-type" content="text/html;
            charset=utf-8">
          <font face="Helvetica, Arial, sans-serif">Dear All,</font><br>
          <font face="Helvetica, Arial, sans-serif"><br>
            I'm facing a strange problem with the call accounting
            module: even if in my configuration I have the parameter: <br>
                 modparam("acc", "early_media", 0)<br>
            I can find some ACC records with sip_code 180 or 183.<br>
            <br>
            <br>
            I investigated those cases and this issue seems to happen
            when an endpoint sends an 183 message immediately followed
            by a 200 OK.<br>
            <br>
            The issue seems started from kamailio version 4.4.1, but I
            cannot be really sure of this.<br>
            <br>
            Have you ever had a similar problem?<br>
            Do you have any suggestions on how to solve it?<br>
          </font><br>
        </blockquote>
        <font face="Helvetica, Arial, sans-serif">I haven't seen it so
          far and no other similar reports. Did it happen for you only
          in 4.4.x series or you have seen it with 5.0.x?<br>
          <br>
          Cheers,<br>
          Daniel<br>
        </font>
        <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com" moz-do-not-send="true">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com" moz-do-not-send="true">www.kamailioworld.com</a></pre>
      </blockquote>
      <br>
      <div class="moz-signature">-- <br>
        <div style="line-height:16px; margin:6px 0; padding:8px 8px 8px
          8px; border-top:1px #aeb1a6 dotted; border-bottom:1px #aeb1a6
          dotted; font-family: 'Lucida Sans', Lucida Grande, Verdana,
          Arial, Sans-Serif; font-size:11px; color:#555555;"> <strong
            style="color:#333333; text-transform:uppercase;
            font-size:10px;"> Marco Capetta </strong> <br>
          Operations Engineer
          <p> <a href="http://www.sipwise.com" style="color:rgb(0, 136,
              204) !important; text-decoration:none !important;
              border-bottom:1px dotted #AAA;" moz-do-not-send="true">
              Sipwise GmbH </a> , Campus 21/Europaring F15<br>
            AT-2345 Brunn am Gebirge </p>
          <p> Phone:  <a href="tel:+4313012044" style="color:rgb(0,
              136, 204) !important; text-decoration:none !important;
              border-bottom:1px dotted #AAA;" moz-do-not-send="true">
              +43(0)1 301 2044 </a> <br>
            Email:  <a href="mailto:mcapetta@sipwise.com"
              style="color:rgb(0, 136, 204) !important;
              text-decoration:none !important; border-bottom:1px dotted
              #AAA;" moz-do-not-send="true"> mcapetta@sipwise.com </a>
            <br>
            Website:  <a href="http://www.sipwise.com"
              style="color:rgb(0, 136, 204) !important;
              text-decoration:none !important; border-bottom:1px dotted
              #AAA;" moz-do-not-send="true"> www.sipwise.com </a> </p>
          <p> Particulars according Austrian Companies Code paragraph 14<br>
            "Sipwise GmbH" - Europaring F15 - 2345 Brunn am Gebirge<br>
            FN:305595f, Commercial Court Vienna, ATU64002206 </p>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Nov 13-15, 2017, in Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>