<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>not a cnxcc user here ... anyhow, few questions to see where this
      can lead:</p>
    <p> - is only the update to redis that doesn't work? are calls
      terminated/charged as expected?</p>
    <p> - when the call is ended, are there any updates?</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 20.12.17 11:59, Donat Zenichev
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CANLwQCmasUTwan3Vg2JjhvH-w==ECXW_2R20RwxBebMD7_R-=w@mail.gmail.com">
      <div dir="ltr">
        <div>Hi community.</div>
        <div><br>
        </div>
        <div>
          <div>Have a problem with cnxcc call monitoring.</div>
          <div>__set_max_credit() allocates new call as expected:</div>
          <div><br>
            "DEBUG: cnxcc [cnxcc_mod.c:444]:
            __dialog_created_callback(): Flag is not set for this
            message. Ignoring<br>
          </div>
          <div>DEBUG: cnxcc [cnxcc_mod.c:1569]: __set_max_credit():
            Setting up new call for client [2], max-credit[0.100000],
            cost-per-sec[0.010000], initial-pulse [6], final-pulse [6],
call-id[<a class="moz-txt-link-abbreviated" href="mailto:2f77fd103d0bfa28718d896876b373fe@b2b.user.agent:50600">2f77fd103d0bfa28718d896876b373fe@b2b.user.agent:50600</a>]<br>
          </div>
          <div>DEBUG: cnxcc [cnxcc_mod.c:1470]: set_ctrl_flag(): Flag
            set!<br>
          </div>
          <div>DEBUG: cnxcc [cnxcc_redis.c:313]: redis_get_int(): Got
            INT value: concurrent_calls=0i<br>
          </div>
          <div>DEBUG: cnxcc [cnxcc_redis.c:68]:
            redis_get_or_create_credit_data(): credit_data with ID=[2]
            DOES NOT exist in the cluster, creating it...<br>
          </div>
          <div>DEBUG: cnxcc [cnxcc_redis.c:92]:
            redis_insert_credit_data(): Inserting credit_data_t using ID
            [2]<br>
          </div>
          <div>DEBUG: cnxcc [cnxcc_mod.c:1125]:
            __get_or_create_credit_data_entry(): Credit entry didn't
            exist. Allocated new entry [0x7f17668f6d70]<br>
          </div>
          <div>DEBUG: cnxcc [cnxcc_mod.c:1255]:
            __alloc_new_call_by_money(): New call allocated for client
            [2]".<br>
          </div>
          <div><br>
          </div>
          <div>So that I can see values inside redis:<br>
          </div>
          <div>
            <div><a href="http://redis.callision.info:6389"
                moz-do-not-send="true">redis.callision.info:6389</a>>
              HGETALL cnxcc:money:2</div>
            <div> 1) "concurrent_calls"</div>
            <div> 2) "0"</div>
            <div> 3) "consumed_amount"</div>
            <div> 4) "0.000000"</div>
            <div> 5) "ended_calls_consumed_amount"</div>
            <div> 6) "0.000000"</div>
            <div> 7) "max_amount"</div>
            <div> 8) "0.000000"</div>
            <div> 9) "number_of_calls"</div>
            <div>10) "1"</div>
            <div>11) "type"</div>
            <div>12) "1"</div>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>But cnxcc doesn't update credit amount during the call.</div>
          <div><br>
          </div>
          <div>modparam("debugger", "mod_level", "cnxcc=4") but there
            are no rows in kamailio log like:</div>
          <div><br>
          </div>
          <div>
            <div>"DEBUG: cnxcc [cnxcc_check.c:94]:
              check_calls_by_money(): ec=0.000000, ca=0.600000,
              ca2=0.600000</div>
            <div>DEBUG: cnxcc [cnxcc_check.c:107]:
              check_calls_by_money(): Client [some_client] |
              Ended-Calls-Credit-Spent: 0.000000  TotalCredit/MaxCredit:
              0.600000/3.000000".</div>
          </div>
        </div>
        <div><br>
        </div>
        <div>cnxcc parameters:<br>
          <div>modparam("cnxcc", "dlg_flag", FLG_DLG)</div>
          <div>modparam("cnxcc", "redis",
            "addr=redis.youwillnever.find;port=6389;db=0")</div>
          <div>modparam("cnxcc", "credit_check_period", 1)</div>
        </div>
        <div><br>
        </div>
        <div>function that performs credit setup:<br>
          <div>if
(!cnxcc_set_max_credit("$var(setid)","$var(credit)","$var(cost_per_sec)","$var(i_pulse)","$var(f_pulse)"))
            {</div>
          <div>                xlog("L_WARN", "----- cnxcc: $fU - Error
            setting up credit control - R=$ru ID=$ci\n");</div>
          <div>                sl_send_reply("402", "Payment Required");</div>
          <div>        }</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Why is it so? And as see, all values are set zero. Seems to
          be problem with redis inserts.<br>
          Any ideas are highly appreciated. Thanks.</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div>
                  <div dir="ltr"><font
                      style="background-color:rgb(255,255,255)"
                      color="#0b5394">-- <br>
                      BR, Donat Zenichev
                      <br>
                      Wnet VoIP team<br>
                      Tel Ukraine:  +380(44) 5-900-800
                      <br>
                      Tel USA: +164(67) 8-174-17<br>
                      <a href="http://wnet.ua" target="_blank"
                        moz-do-not-send="true">https://w-net.us/</a></font></div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </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 - March 5-7, 2018, Berlin - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - May 14-16, 2018 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>