<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    if you look to remove the users from location, then you can use:<br>
    <br>
    kamctl ul rm USERID<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 12/05/14 05:18, Carlos Ruiz Díaz
      wrote:<br>
    </div>
    <blockquote
cite="mid:CA+3gBc=M64_LxxiHYW3Jitm78HGKdXXikn9x-fuBY2nmm5-_3Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Yep, assignment failed because the variables
        contain floating point values and Kamailio does not handle well
        this kind of precision. 
        <div><br>
        </div>
        <div>I patched the module to add the check before initiating the
          call, it is in master.</div>
        <div><br>
        </div>
        <div>As a way of testing your code, replace those values with
          integer ones, like 5 and 6, and check if the call is actually
          terminated or even initiated. This will give you a quick
          diagnosis of your routing script.</div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>Carlos</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Sun, May 11, 2014 at 9:04 PM, Rene
          Montilva <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:renemontilva@gmail.com" target="_blank">renemontilva@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <p dir="ltr">Hi Carlos</p>
            <p dir="ltr"> kamailio version  4.1 </p>
            <div class="gmail_quote">El 11/05/2014 21:32, "Carlos Ruiz
              Díaz" <<a moz-do-not-send="true"
                href="mailto:carlos.ruizdiaz@gmail.com" target="_blank">carlos.ruizdiaz@gmail.com</a>>
              escribió:
              <div>
                <div class="h5"><br type="attribution">
                  <blockquote class="gmail_quote" style="margin:0 0 0
                    .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    <div dir="ltr">What Kamailio version are you using?</div>
                    <div class="gmail_extra"><br>
                      <br>
                      <div class="gmail_quote">On Sat, May 10, 2014 at
                        9:33 PM, Rene Montilva <span dir="ltr"><<a
                            moz-do-not-send="true"
                            href="mailto:renemontilva@gmail.com"
                            target="_blank">renemontilva@gmail.com</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">
                            <div>Hi Carlos<br>
                              <br>
                            </div>
                            <div>kamailio config:<br>
                              <br>
                              log("L_INFO", "saldo:$var(credit) y
                              seg:$var(cost_per_sec) ");<br>
                              <br>
                              <br>
                              if($var(cost_per_sec) > $var(credit)) {
                              <div><br>
                                               
                                sl_send_reply("402","payment required");<br>
                                                exit;<br>
                                        }<br>
                                <br>
                                <br>
                              </div>
                              <div>if
                                (!cnxcc_set_max_credit("$var(client)",<br>
                                "$var(credit)",<br>
                                "$var(cost_per_sec)",<br>
                                "$var(i_pulse)",<br>
                              </div>
                              "$var(f_pulse)")) {
                              <div><br>
                                        sl_send_reply("503",
                                "something's wrong in the server");<br>
                                        exit;<br>
                                <br>
                                        }<br>
                                <br>
                                <br>
                                <br>
                                <br>
                              </div>
                            </div>
                            <div><br>
                              i got this by syslog<br>
                              <br>
                              $var(credit) = "0.0005";<br>
                              $var(cost_per_sec) = "0.0006";<br>
                              <br>
                              <br>
                              <br>
                              #$var(credit) = $dbr(ra=>[0,0]); # 30$
                              of credit<br>
                              #$var(cost_per_sec) = $dbr(ra=>[0,1]);
                              # 1$ per sec
                              <div><br>
                                $var(i_pulse) = "1"; # 1$ to establish
                                the call<br>
                                $var(f_pulse) = "1"; # 1$ per second<br>
                                <br>
                              </div>
                              <div>if
                                (!cnxcc_set_max_credit("$var(client)",<br>
                                "$var(credit)",<br>
                                "$var(cost_per_sec)",<br>
                                "$var(i_pulse)",<br>
                              </div>
                              "$var(f_pulse)")) {<br>
                                      sl_send_reply("402", "Sin saldo
                              PAPA");<br>
                                      xlog("Error setting up credit
                              control");<br>
                                      exit;<br>
                                      }<br>
                              <br>
                              <br>
                              <br>
                              /usr/sbin/kamailio[13336]: INFO:
                              <script>: Setting up money based
                              credit control<br>
                              /usr/sbin/kamailio[13336]: INFO:
                              <script>: saldo:0.0005 y seg:0.0006
                              <br>
                              /usr/sbin/kamailio[13336]: WARNING:
                              <core> [rvalue.c:1016]:
                              rval_get_int(): automatic string to int
                              conversion for "0.0005" failed<br>
                              /usr/sbin/kamailio[13336]: WARNING:
                              <core> [rvalue.c:1920]:
                              rval_expr_eval_int(): rval expression
                              conversion to int failed (707,17-707,17)<br>
                              /usr/sbin/kamailio[13336]: WARNING:
                              <core> [rvalue.c:1016]:
                              rval_get_int(): automatic string to int
                              conversion for "0.0006" failed<br>
                              /usr/sbin/kamailio[13336]: WARNING:
                              <core> [rvalue.c:1920]:
                              rval_expr_eval_int(): rval expression
                              conversion to int failed (707,19-707,36)<br>
                              <br>
                            </div>
                            <br>
                            <div>it still established the call<br>
                              <br>
                              <br>
                            </div>
                            <div>with the function, kamailio doesn't
                              evaluate the variable<br>
                              <br>
                              if($var(cost_per_sec) > $var(credit)) {
                              <div><br>
                                               
                                sl_send_reply("402","payment required");<br>
                                                exit;<br>
                                        }<br>
                                <br>
                                <br>
                              </div>
                            </div>
                            <div><br>
                            </div>
                          </div>
                          <div>
                            <div>
                              <div class="gmail_extra">
                                <br>
                                <br>
                                <div class="gmail_quote">On Fri, May 9,
                                  2014 at 4:41 PM, Carlos Ruiz Díaz <span
                                    dir="ltr"><<a
                                      moz-do-not-send="true"
                                      href="mailto:carlos.ruizdiaz@gmail.com"
                                      target="_blank">carlos.ruizdiaz@gmail.com</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"><br>
                                      <div class="gmail_extra"><br>
                                        <br>
                                        <div class="gmail_quote">
                                          <div>On Fri, May 9, 2014 at
                                            3:52 PM, Rene Montilva <span
                                              dir="ltr"><<a
                                                moz-do-not-send="true"
                                                href="mailto:renemontilva@gmail.com"
                                                target="_blank">renemontilva@gmail.com</a>></span>
                                            wrote:<br>
                                            <blockquote
                                              class="gmail_quote"
                                              style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                              <div dir="ltr">
                                                <div>these are the
                                                  values before the
                                                  function call:<br>
                                                  <br>
                                                   /usr/sbin/kamailio[24933]:
                                                  INFO: <script>:
                                                  saldo:0.0005000000 y
                                                  seg:0.000666666666666667
                                                  <br>
                                                </div>
                                              </div>
                                            </blockquote>
                                            <div><br>
                                            </div>
                                          </div>
                                          <div>You are printing then
                                            before the assigment.</div>
                                          <div>
                                            <div>
                                              <br>
                                            </div>
                                            <div><span
                                                style="font-family:arial,sans-serif;font-size:12.727272033691406px"><i>xlog("L_INFO",
                                                  "saldo:$dbr(ra=>[0,0])
                                                  y
                                                  seg:$dbr(ra=>[0,1])
                                                  ");</i></span><br>
                                            </div>
                                            <div><span
                                                style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                              </span></div>
                                          </div>
                                          <div><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px">use </span></div>
                                          <div><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                            </span></div>
                                          <div><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px"><i>xlog("L_INFO",
                                                "saldo:$var(credit) y
                                                seg:$var(cost_per_second)
                                                ");</i></span><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                            </span></div>
                                          <div><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                            </span></div>
                                          <div><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px">I
                                              just run a test with your
                                              values, and they did work.</span></div>
                                          <div><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                            </span></div>
                                          <div><font face="arial,
                                              sans-serif">$var(credit) =
                                              "</font>0.0005<span
                                              style="font-family:arial,sans-serif">";</span></div>
                                          <div><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px">$var(cost_per_second)
                                              = "</span>0.0006<span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px">";</span></div>
                                          <div>
                                            <span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                            </span></div>
                                          <div><i
style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">if
(!cnxcc_set_max_credit("$var(client)",....</i><span
                                              style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                            </span></div>
                                          <div>
                                            <div> </div>
                                            <blockquote
                                              class="gmail_quote"
                                              style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                              <div dir="ltr">
                                                <div>
                                                  <br>
                                                </div>
                                                this function doesn't
                                                work, maybe are the long
                                                value:
                                                <div>
                                                  <br>
                                                  <div>
                                                    <div
                                                      style="font-family:arial,sans-serif;font-size:12.7273px"><i>if
                                                        ($var(credit) <b><</b>
                                                        $var(cost_per_second))
                                                        {</i></div>
                                                    <div
                                                      style="font-family:arial,sans-serif;font-size:12.7273px">
                                                      <i>     
                                                          sl_send_reply("402",
                                                        "payment
                                                        required");</i></div>
                                                    <div
                                                      style="font-family:arial,sans-serif;font-size:12.7273px"><i> 
                                                              exit;</i></div>
                                                    <div
                                                      style="font-family:arial,sans-serif;font-size:12.7273px">
                                                      <i>}</i></div>
                                                  </div>
                                                </div>
                                              </div>
                                            </blockquote>
                                            <div><br>
                                            </div>
                                          </div>
                                          <div>Did not get that, what
                                            does not work?</div>
                                          <div>
                                            <div>
                                              <div> </div>
                                              <blockquote
                                                class="gmail_quote"
                                                style="margin:0px 0px
                                                0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                                <div dir="ltr">
                                                  <div><br>
                                                  </div>
                                                </div>
                                                <div>
                                                  <div>
                                                    <div
                                                      class="gmail_extra"><br>
                                                      <br>
                                                      <div
                                                        class="gmail_quote">On
                                                        Fri, May 9, 2014
                                                        at 3:48 PM,
                                                        Carlos Ruiz Díaz
                                                        <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:carlos.ruizdiaz@gmail.com"
                                                          target="_blank">carlos.ruizdiaz@gmail.com</a>></span>
                                                        wrote:<br>
                                                        <blockquote
                                                          class="gmail_quote"
                                                          style="margin:0px
                                                          0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                                          <div dir="ltr">Oops,
                                                          correction:
                                                          <div>
                                                          <div><br>
                                                          </div>
                                                          <div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">
                                                          <i>if
                                                          ($var(credit)
                                                          <b><</b>
                                                          $var(cost_per_second))
                                                          {</i></div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">
                                                          <i>     
                                                            sl_send_reply("402",
                                                          "payment
                                                          required");</i></div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><i> 
                                                                exit;</i></div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">
                                                          <i>}</i></div>
                                                          </div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><i><br>
                                                          </i></div>
                                                          </div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><span
style="font-family:arial;font-size:small">By the way, please inform of
                                                          your results
                                                          after doing
                                                          your tests.</span><br>
                                                          </div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><span
style="font-family:arial;font-size:small"><br>
                                                          </span></div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><span
style="font-family:arial;font-size:small">Thanks,</span></div>
                                                          <div
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><span
style="font-family:arial;font-size:small">Carlos</span></div>
                                                          </div>
                                                          <div>
                                                          <div>
                                                          <div
                                                          class="gmail_extra"><br>
                                                          <br>
                                                          <div
                                                          class="gmail_quote">
                                                          On Fri, May 9,
                                                          2014 at 3:17
                                                          PM, Carlos
                                                          Ruiz Díaz <span
                                                          dir="ltr"><<a
moz-do-not-send="true" href="mailto:carlos.ruizdiaz@gmail.com"
                                                          target="_blank">carlos.ruizdiaz@gmail.com</a>></span>
                                                          wrote:<br>
                                                          <blockquote
                                                          class="gmail_quote"
                                                          style="margin:0px
                                                          0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                                          <div dir="ltr">
                                                          <div>Hello,</div>
                                                          <div><br>
                                                          </div>
                                                          <div>"i_pulse"
                                                          and "f_pulse"
                                                          are direct
                                                          translations
                                                          of the Spanish
                                                          (I noticed you
                                                          speak it)
                                                          phrases "pulso
                                                          inicial" and
                                                          "pulso final",
                                                          which I don't
                                                          think have the
                                                          same meaning
                                                          in English.
                                                          Updating the
                                                          docs and using
                                                          the proper
                                                          terminology
                                                          are pending
                                                          matters on
                                                          this module.<br>
                                                          </div>
                                                          <div><br>
                                                          </div>
                                                          <div>Both
                                                          values
                                                          represent the
                                                          initial and
                                                          interim costs
                                                          of the call,
                                                          in your case,
                                                          it is being
                                                          billed second
                                                          by second
                                                          (1:1),
                                                          subtracting "<span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">0.000666666666666667"
                                                          every second
                                                          from a pool of
                                                          credit that is
                                                          equal to "</span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">0.0006500000</span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">".</span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">The
                                                          message that's
                                                          being shown,
                                                          looks like a
                                                          precision loss
                                                          error, which
                                                          is unlikely
                                                          because I used
                                                          numbers even
                                                          smaller than
                                                          yours. Please
                                                          print the
                                                          values of
                                                          $var(credit)
                                                          and $var(</span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">cost_per_sec)
                                                          before calling
                                                          the cnxcc
                                                          function.</span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">Furthermore,
                                                          you should
                                                          also consider
                                                          checking your
                                                          values before
                                                          passing them
                                                          to the
                                                          function. For
                                                          example:</span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><b>1.
                                                          check if the
                                                          credit is
                                                          greater than
                                                          the cost per
                                                          second,
                                                          *before*.</b></span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><i>if
                                                          ($var(credit)
                                                          >
                                                          $var(cost_per_second))
                                                          {</i></span></div>
                                                          <div><i><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">   
                                                             </span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px"> </span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">sl_send_reply("402",
                                                          "payment
                                                          required");</span></i></div>
                                                          <div><i><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">   
                                                             </span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px"> </span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">exit;</span></i></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><i>}</i></span></div>
                                                          <div><br>
                                                          </div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">There's
                                                          no reason to
                                                          call the
                                                          function when
                                                          the conditions
                                                          are not met.
                                                          Cnxcc will
                                                          authorize the
                                                          call and hang
                                                          it immediately
                                                          (1 second
                                                          later). </span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">I
                                                          may need to
                                                          add this check
                                                          myself inside
                                                          the module.</span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><b>2.
                                                          make sure you
                                                          are rejecting
                                                          the call in
                                                          case of
                                                          module's
                                                          error. </b></span></div>
                                                          <div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></div>
                                                          <div><i><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">if
                                                          (!cnxcc_set_max_credit("$var(</span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">client)",</span><br
style="font-family:arial,sans-serif;font-size:12.727272033691406px">
                                                          <span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"> 
                                                           
                                                          "$var(credit)",</span><br
style="font-family:arial,sans-serif;font-size:12.727272033691406px">
                                                          <span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"> 
                                                           
                                                          "$var(cost_per_sec)",</span><br
style="font-family:arial,sans-serif;font-size:12.727272033691406px">
                                                          <span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"> 
                                                           
                                                          "$var(i_pulse)",</span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></i></div>
                                                          </div>
                                                          <div><i><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">   
                                                          "$var(f_pulse)")
                                                          {</span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></i></div>
                                                          <div><i><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">   
                                                             
                                                          sl_send_reply("503",
                                                          "something's
                                                          wrong in the
                                                          server");</span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></i></div>
                                                          <div><i><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">   
                                                             </span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px"> </span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px">exit;</span><span
style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></i></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><i>}</i></span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><i><br>
                                                          </i></span></div>
                                                          <div>
                                                          <span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">Regards,</span><br>
                                                          </div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px">Carlos</span></div>
                                                          <div><span
                                                          style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
                                                          </span></div>
                                                          <div><br>
                                                          </div>
                                                          </div>
                                                          <div>
                                                          <div>
                                                          <div
                                                          class="gmail_extra"><br>
                                                          <br>
                                                          <div
                                                          class="gmail_quote">On
                                                          Fri, May 9,
                                                          2014 at 2:45
                                                          PM, Rene
                                                          Montilva <span
                                                          dir="ltr"><<a
moz-do-not-send="true" href="mailto:renemontilva@gmail.com"
                                                          target="_blank">renemontilva@gmail.com</a>></span>
                                                          wrote:<br>
                                                          <blockquote
                                                          class="gmail_quote"
                                                          style="margin:0px
                                                          0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                                          <div dir="ltr">
                                                          <div>Hi Carlos<br>
                                                          </div>
                                                          <div><br>
                                                          This my
                                                          kamailio
                                                          config: <br>
                                                          <br>
                                                          #!ifdef
                                                          CNXCC_MONEY<br>
                                                          sql_query("ca",
                                                          "select *
                                                          from 
                                                          billing.sel_customer_credit('pepe','xxxxxxx","ra");<br>
                                                          <br>
                                                          xlog("L_INFO",
                                                          "Setting up
                                                          money based
                                                          credit
                                                          control");<br>
                                                          <br>
                                                          if($dbr(ra=>rows)>
                                                          0){<br>
                                                          xlog("L_INFO",
                                                          "saldo:$dbr(ra=>[0,0])
                                                          y
                                                          seg:$dbr(ra=>[0,1])
                                                          ");<br>
                                                          <br>
                                                          $var(credit) =
                                                          $dbr(ra=>[0,0]);
                                                          # 30$ of
                                                          credit<br>
                                                          $var(cost_per_sec)
                                                          =
                                                          $dbr(ra=>[0,1]);
                                                          # 1$ per sec<br>
                                                          $var(i_pulse)
                                                          = "1"; # 1$ to
                                                          establish the
                                                          call<br>
                                                          $var(f_pulse)
                                                          = "1"; # 1$
                                                          per second<br>
                                                          <br>
                                                          <br>
                                                          }<br>
                                                          <br>
                                                          sql_result_free
                                                          ("ra");<br>
                                                          <br>
                                                          # if only one
                                                          call is
                                                          established,
                                                          that call
                                                          should last 9
                                                          seconds.<br>
                                                          <br>
                                                          if
                                                          (!cnxcc_set_max_credit("$var(client)",<br>
"$var(credit)",<br>
"$var(cost_per_sec)",<br>
"$var(i_pulse)",<br>
                                                          <br>
                                                          <br>
                                                          <br>
                                                          </div>
                                                          <div>And this
                                                          are the values
                                                          by syslog info<br>
                                                          <br>
                                                          INFO:
                                                          <script>:
                                                          saldo:0.0006500000
                                                          y
                                                          seg:0.000666666666666667
                                                          <br>
                                                          ERROR: cnxcc
                                                          [cnxcc_mod.c:1425]:
                                                          set_max_credit():
                                                          credit value
                                                          must be >
                                                          0: 0.000000<br>
                                                          <br>
                                                          <br>
                                                          <br>
                                                          </div>
                                                          <div>                 
                                                          <br>
                                                          </div>
                                                          </div>
                                                          <div>
                                                          <div>
                                                          <div
                                                          class="gmail_extra"><br>
                                                          <br>
                                                          <div
                                                          class="gmail_quote">On
                                                          Fri, May 9,
                                                          2014 at 3:08
                                                          PM, Carlos
                                                          Ruiz Díaz <span
                                                          dir="ltr"><<a
moz-do-not-send="true" href="mailto:carlos.ruizdiaz@gmail.com"
                                                          target="_blank">carlos.ruizdiaz@gmail.com</a>></span>
                                                          wrote:<br>
                                                          <blockquote
                                                          class="gmail_quote"
                                                          style="margin:0px
                                                          0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                                          <div dir="ltr">
                                                          <div>Hi,</div>
                                                          <div><br>
                                                          </div>
                                                          Can you paste
                                                          the code you
                                                          are using,
                                                          with the
                                                          values that
                                                          each variable
                                                          contain at the
                                                          moment of
                                                          initiating the
                                                          call?
                                                          <div>
                                                          <br>
                                                          </div>
                                                          <div>Regards,</div>
                                                          </div>
                                                          <div
                                                          class="gmail_extra">
                                                          <br>
                                                          <br>
                                                          <div
                                                          class="gmail_quote">
                                                          <div>
                                                          <div>On Fri,
                                                          May 9, 2014 at
                                                          2:35 PM, Rene
                                                          Montilva <span
                                                          dir="ltr"><<a
moz-do-not-send="true" href="mailto:renemontilva@gmail.com"
                                                          target="_blank">renemontilva@gmail.com</a>></span>
                                                          wrote:<br>
                                                          </div>
                                                          </div>
                                                          <blockquote
                                                          class="gmail_quote"
                                                          style="margin:0px
                                                          0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
                                                          <div>
                                                          <div>
                                                          <div dir="ltr">
                                                          <div>
                                                          <div>Hi list<br>
                                                          <br>
                                                          </div>
                                                          I don't
                                                          understand
                                                          prepaid logic
                                                          calculation,
                                                          because when
                                                          my credit is 0
                                                          or lees than
                                                          cost per
                                                          second, the
                                                          call is
                                                          established
                                                          equal<br>
                                                          <br>
                                                          </div>
                                                          $var(i_pulse)
                                                          and
                                                          $var(f_pulse)
                                                          how this
                                                          works????<br>
                                                          <div><br>
                                                          <br>
                                                          </div>
                                                          </div>
                                                          <br>
                                                          </div>
                                                          </div>
_______________________________________________<br>
                                                          SIP Express
                                                          Router (SER)
                                                          and Kamailio
                                                          (OpenSER) -
                                                          sr-users
                                                          mailing list<br>
                                                          <a
                                                          moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                                          <a
                                                          moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                                          target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                                          <br>
                                                          </blockquote>
                                                          </div>
                                                          <span><font
                                                          color="#888888"><br>
                                                          <br
                                                          clear="all">
                                                          <div><br>
                                                          </div>
                                                          -- <br>
                                                          <div dir="ltr">Carlos
                                                          <div><a
                                                          moz-do-not-send="true"
href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div>
                                                          <div><a
                                                          moz-do-not-send="true"
href="http://ngvoice.com" target="_blank">http://ngvoice.com</a></div>
                                                          <div><a
                                                          moz-do-not-send="true"
href="tel:%2B52%2055%203048%203303" value="+525530483303"
                                                          target="_blank">+52
                                                          55 3048 3303</a></div>
                                                          </div>
                                                          </font></span></div>
                                                          <br>
_______________________________________________<br>
                                                          SIP Express
                                                          Router (SER)
                                                          and Kamailio
                                                          (OpenSER) -
                                                          sr-users
                                                          mailing list<br>
                                                          <a
                                                          moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                                          <a
                                                          moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                                          target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                                          <br>
                                                          </blockquote>
                                                          </div>
                                                          <br>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          <br>
_______________________________________________<br>
                                                          SIP Express
                                                          Router (SER)
                                                          and Kamailio
                                                          (OpenSER) -
                                                          sr-users
                                                          mailing list<br>
                                                          <a
                                                          moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                                          <a
                                                          moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                                          target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                                          <br>
                                                          </blockquote>
                                                          </div>
                                                          <br>
                                                          <br
                                                          clear="all">
                                                          <div><br>
                                                          </div>
                                                          -- <br>
                                                          <div dir="ltr">Carlos
                                                          <div><a
                                                          moz-do-not-send="true"
href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div>
                                                          <div><a
                                                          moz-do-not-send="true"
href="http://ngvoice.com" target="_blank">http://ngvoice.com</a></div>
                                                          <div><a
                                                          moz-do-not-send="true"
href="tel:%2B52%2055%203048%203303" value="+525530483303"
                                                          target="_blank">+52
                                                          55 3048 3303</a></div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </blockquote>
                                                          </div>
                                                          <br>
                                                          <br
                                                          clear="all">
                                                          <div><br>
                                                          </div>
                                                          -- <br>
                                                          <div dir="ltr">Carlos
                                                          <div><a
                                                          moz-do-not-send="true"
href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div>
                                                          <div><a
                                                          moz-do-not-send="true"
href="http://ngvoice.com" target="_blank">http://ngvoice.com</a></div>
                                                          <div><a
                                                          moz-do-not-send="true"
href="tel:%2B52%2055%203048%203303" value="+525530483303"
                                                          target="_blank">+52
                                                          55 3048 3303</a></div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          </div>
                                                          <br>
_______________________________________________<br>
                                                          SIP Express
                                                          Router (SER)
                                                          and Kamailio
                                                          (OpenSER) -
                                                          sr-users
                                                          mailing list<br>
                                                          <a
                                                          moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                                          <a
                                                          moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                                          target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                                          <br>
                                                        </blockquote>
                                                      </div>
                                                      <br>
                                                    </div>
                                                  </div>
                                                </div>
                                                <br>
_______________________________________________<br>
                                                SIP Express Router (SER)
                                                and Kamailio (OpenSER) -
                                                sr-users mailing list<br>
                                                <a
                                                  moz-do-not-send="true"
href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                                                <a
                                                  moz-do-not-send="true"
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                                  target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                                <br>
                                              </blockquote>
                                            </div>
                                          </div>
                                        </div>
                                        <div>
                                          <div><br>
                                            <br clear="all">
                                            <div><br>
                                            </div>
                                            -- <br>
                                            <div dir="ltr">Carlos
                                              <div><a
                                                  moz-do-not-send="true"
href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div>
                                              <div><a
                                                  moz-do-not-send="true"
href="http://ngvoice.com" target="_blank">http://ngvoice.com</a></div>
                                              <div><a
                                                  moz-do-not-send="true"
href="tel:%2B52%2055%203048%203303" value="+525530483303"
                                                  target="_blank">+52 55
                                                  3048 3303</a></div>
                                            </div>
                                          </div>
                                        </div>
                                      </div>
                                    </div>
                                    <br>
_______________________________________________<br>
                                    SIP Express Router (SER) and
                                    Kamailio (OpenSER) - sr-users
                                    mailing list<br>
                                    <a moz-do-not-send="true"
                                      href="mailto:sr-users@lists.sip-router.org"
                                      target="_blank">sr-users@lists.sip-router.org</a><br>
                                    <a moz-do-not-send="true"
                                      href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                                      target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                                    <br>
                                  </blockquote>
                                </div>
                                <br>
                              </div>
                            </div>
                          </div>
                          <br>
_______________________________________________<br>
                          SIP Express Router (SER) and Kamailio
                          (OpenSER) - sr-users mailing list<br>
                          <a moz-do-not-send="true"
                            href="mailto:sr-users@lists.sip-router.org"
                            target="_blank">sr-users@lists.sip-router.org</a><br>
                          <a moz-do-not-send="true"
                            href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                            target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                          <br>
                        </blockquote>
                      </div>
                      <br>
                      <br clear="all">
                      <div><br>
                      </div>
                      -- <br>
                      <div dir="ltr">Carlos
                        <div><a moz-do-not-send="true"
                            href="http://caruizdiaz.com" target="_blank">http://caruizdiaz.com</a></div>
                        <div><a moz-do-not-send="true"
                            href="http://ngvoice.com" target="_blank">http://ngvoice.com</a></div>
                        <div><a moz-do-not-send="true"
                            href="tel:%2B52%2055%203048%203303"
                            value="+525530483303" target="_blank">+52 55
                            3048 3303</a></div>
                      </div>
                    </div>
                    <br>
                    _______________________________________________<br>
                    SIP Express Router (SER) and Kamailio (OpenSER) -
                    sr-users mailing list<br>
                    <a moz-do-not-send="true"
                      href="mailto:sr-users@lists.sip-router.org"
                      target="_blank">sr-users@lists.sip-router.org</a><br>
                    <a moz-do-not-send="true"
                      href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                      target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                    <br>
                  </blockquote>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
            mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
              target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div dir="ltr">Carlos
          <div><a moz-do-not-send="true" href="http://caruizdiaz.com"
              target="_blank">http://caruizdiaz.com</a></div>
          <div><a moz-do-not-send="true" href="http://ngvoice.com"
              target="_blank">http://ngvoice.com</a></div>
          <div>+52 55 3048 3303</div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.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-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
  </body>
</html>