<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hello,</p>
    <p>I just finished pushing on master branch a series of commits
      targeting to have evapi using an internal buffer for the data
      parameter instead of relying on pv-related buffers.</p>
    <p>Can people facing the reported issue try with latest master and
      report if all goes ok, even without setting pv buffer size to
      higher value?</p>
    <p>On the other hand, because the reports so far where related to
      the use of jsonrpc response, I am thinking of adding a dedicated
      function like: evapi_relay_jsonrpcs_response(), so it is no need
      to copy from the internal buffer of jsonrpcs module to the
      internal buffer of evapi.</p>
    <p>Thinking of a few other enhancements, therefore I am asking for
      feedback to see what and how to do:</p>
    <p>1) does cgrates require all the attributes from the active dialog
      rpc list command? I was considering for quite some time to add a
      new rpc command in dialog module to list active dialogs with fewer
      attributes (e.g., dialog hash id, label, call id, from tag, to
      tag, from address, to address and state). Maybe we can add one
      tailored for cgrates needs</p>
    <p>2) maybe worth considering to add a cgrates tailored module (or
      just a function in evapi module like evapi_relay_dialog_list()),
      so the list of active dialogs is retrieved directly from dialog
      module, avoiding to go through jsonrpcs module, like it seems to
      be the current mechanism. So a question here would be if cgrates
      interaction with kamailio requires more than just fetching active
      calls via evapi (e.g., trigger BYE for active calls in case of
      prepaid) -- is out there a complete config about using cgrates
      with all the features/commands interacting with kamailio?</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 30.10.19 15:56, Sergiu Pojoga wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJZsGCmF=EzqY-btE5o6_r_89LcH=u=O1YM9QU24bBTOQtgpqQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Michal,
        <div><br>
        </div>
        <div>I've already encountered this same problem and got an
          answer from Daniel. Check below link.</div>
        <div><br>
        </div>
        <div><a
href="https://lists.kamailio.org/pipermail/sr-users/2019-October/107092.html"
            moz-do-not-send="true">https://lists.kamailio.org/pipermail/sr-users/2019-October/107092.html</a> </div>
        <div><br>
        </div>
        <div>Cheers. <br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Wed, Oct 30, 2019 at 9:57
          AM Daniel-Constantin Mierla <<a
            href="mailto:miconda@gmail.com" moz-do-not-send="true">miconda@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div bgcolor="#FFFFFF">
            <p>Hello,</p>
            <p>how often are you requesting the list of all dialogs
              (what is the n in that every n seconds)? Is it done using
              a single evapi connection, or are there many of them?</p>
            <p>And to clarify, is the error ("cannot serialize event")
              happening when there is no call or when there are too
              many? Is not clear for me given that you follow with what
              you expect to be when nobody is calling ...</p>
            <p>Cheers,<br>
              Daniel<br>
            </p>
            <div>On 30.10.19 14:26, Michal Škuta wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Hello, Kamailio community,<br>
                we are implementing evapi communication to our Kamailio
                server. We have implemented and tested it on our testing
                server. Everything was working OK.<br>
                <br>
                Now we are testing it on our production servers with a
                lot more calls and we have some problems here. <br>
                Every n seconds we are requesting from Kamailio list of
                all dialogs. And this list of dialogs (from jsonrpc <b>dlg.list</b>)
                is sent to evapi connection.<br>
                <div>Here is a snippet of our <b>Kamailio code</b>:</div>
                <div><br>
                </div>
                <div><span style="font-family:monospace">route[CGR_DLG_LIST]<br>
                    {<br>
                            xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST]
                    Requested dialog list");<br>
                            # CGRateS connection is still alive, set
                    check to true<br>
                            $sht(cgrconn=>check) = 1;<br>
                            if $sht(cgrconn=>cgr) == $null {<br>
                                    sl_send_reply("503","Charging
                    controller unreachable");<br>
                                    exit;<br>
                            }<br>
                            jsonrpc_exec('{"jsonrpc":"2.0","id":1,
                    "method":"dlg.list","params":[]}');<br>
                            xlog("L_INFO", "XLOG: $ci [CGR_DLG_LIST]
                    Test1: $jsonrpl(body)");<br>
                    <br>
                           
                    evapi_relay("{\"event\":\"CGR_DLG_LIST_REPLY\",<br>
                                           
                    \"jsonrpl_body\":$jsonrpl(body)}");<br>
                    }</span><br>
                </div>
                <br>
                <div>During a higher number of calls Kamailio is
                  generating ERROR messages from evapi module. Here is
                  the syslog:</div>
                <div><br>
                </div>
                <span style="font-family:monospace">Oct 30 12:02:15
                  kam-prod /opt/ipgate/kamailio/sbin/kamailio[19512]:
                  INFO: <script>: XLOG: 123 [CGR_DLG_LIST]
                  Requested dialog list<br>
                  Oct 30 12:02:15 kam-prod
                  /opt/ipgate/kamailio/sbin/kamailio[19512]: INFO:
                  <script>: <br>
                  Oct 30 12:02:15 kam-prod
                  /opt/ipgate/kamailio/sbin/kamailio[19512]: DEBUG:
                  evapi [evapi_dispatch.c:740]: _evapi_relay(): relaying
                  event data [<br>
                  Oct 30 12:02:15 kam-prod
                  /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR:
                  evapi [evapi_dispatch.c:764]: _evapi_relay(): cannot
                  serialize event<br>
                  Oct 30 12:02:15 kam-prod
                  /opt/ipgate/kamailio/sbin/kamailio[19512]: ERROR:
                  evapi [evapi_mod.c:265]: w_evapi_relay(): failed to
                  relay event: <br>
                </span>
                <div><br>
                </div>
                <div><b>We are expecting something like this when nobody
                    is calling</b><br>
                </div>
                <div><span style="font-family:monospace">Oct 30 14:12:22
                    kam-test /opt/ipgate/kamailio/sbin/kamailio[32090]:
                    INFO: <script>: XLOG: 123 [CGR_DLG_LIST]
                    Requested dialog list<br>
                    Oct 30 14:12:22 kam-test
                    /opt/ipgate/kamailio/sbin/kamailio[32090]: INFO:
                    <script>: XLOG: 123 [CGR_DLG_LIST] Test1: {<br>
                    #011"jsonrpc":#011"2.0",<br>
                    #011"result":#011[],<br>
                    #011"id":#0111<br>
                    }<br>
                    Oct 30 14:12:22 kam-test
                    /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG:
                    evapi [evapi_dispatch.c:740]: _evapi_relay():
                    relaying event data [{"event":"CGR_DLG_LIST_REPLY",<br>
                    #011#011#011"jsonrpl_body":{<br>
                    #011"jsonrpc":#011"2.0",<br>
                    #011"result":#011[],<br>
                    #011"id":#0111<br>
                    }}] (96)<br>
                    Oct 30 14:12:22 kam-test
                    /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG:
                    evapi [evapi_dispatch.c:778]: _evapi_relay():
                    sending [0x169ff674]
                    [96:{"event":"CGR_DLG_LIST_REPLY",<br>
                    #011#011#011"jsonrpl_body":{<br>
                    #011"jsonrpc":#011"2.0",<br>
                    #011"result":#011[],<br>
                    #011"id":#0111<br>
                    }},] (100)<br>
                    Oct 30 14:12:22 kam-test
                    /opt/ipgate/kamailio/sbin/kamailio[32090]: DEBUG:
                    evapi [evapi_dispatch.c:789]: _evapi_relay():
                    dispatching [0x169ff674]
                    [96:{"event":"CGR_DLG_LIST_REPLY",<br>
                    #011#011#011"jsonrpl_body":{<br>
                    #011"jsonrpc":#011"2.0",<br>
                    #011"result":#011[],<br>
                    #011"id":#0111<br>
                    }},] (100)</span></div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div>We enabled debug messages for module evapi and are
                  trying to understand where is the problem. To make
                  this work to this state we needed to increase the <b>pv_buffer</b>
                  to really big size (2097152).</div>
                <div>It looks like $jsonrpl(body) is not ready and
                  everything concated with it is not working.</div>
                <div><br>
                </div>
                <div>
                  <pre><span style="font-family:arial,sans-serif"><code><code><span style="font-family:arial,sans-serif">Any help or suggestion is welcomed.</span>
</code></code></span></pre>
                  <pre><code><code><span style="font-family:arial,sans-serif">Sincerely Michal</span></code></code></pre>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank" moz-do-not-send="true">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
            </blockquote>
            <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank" moz-do-not-send="true">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank" moz-do-not-send="true">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank" moz-do-not-send="true">www.linkedin.com/in/miconda</a>
Kamailio World Conference - April 27-29, 2020, in Berlin -- <a href="http://www.kamailioworld.com" target="_blank" moz-do-not-send="true">www.kamailioworld.com</a></pre>
          </div>
          _______________________________________________<br>
          Kamailio (SER) - Users Mailing List<br>
          <a href="mailto:sr-users@lists.kamailio.org" target="_blank"
            moz-do-not-send="true">sr-users@lists.kamailio.org</a><br>
          <a
            href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
        </blockquote>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-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>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<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 World Conference - April 27-29, 2020, in Berlin -- <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>