<div dir="ltr">Dear all, Daniel<div><br></div><div>we have been testing this module with the following setup</div><div>kamailio 5.3.2<br></div><div>evapi params</div><div>modparam("evapi", "workers", 4)<br>modparam("evapi", "netstring_format", 0)<br>modparam("evapi", "bind_addr", "<a href="http://127.0.0.1:8448" target="_blank">127.0.0.1:8448</a>")<br>modparam("evapi", "max_clients", 32)<br></div><div><br></div><div>then in the configuration we do evapi_relay of avp including a json data (which can be quite long), like this</div><div>{"key" : "<a href="mailto:aarp2q0tcpqhs0cpucuhukjs2ah2j00q@10.18.5.64" target="_blank">aarp2q0tcpqhs0cpucuhukjs2ah2j00q@10.18.5.64</a>" , "msg" : {"rg_in":"701","ani_init":{"ani_source":"pai", ....... }}}<br></div><div><br></div><div>We have an application listening on the tcp socket and writing those messages to a kafka cluster, and this works ok, and in the previous manual tests we have done no issue was found.<br>But when making some load tests, and passing some live traffic we see some issues</div><div><br></div><div>seems like some times, when there are messages to be sent to the tcp socket at the same time, they are sent in the same message, when normally each data sent using evapi_relay is sent in 1 message</div><div>We do sometimes see something like this on the application consuming from the tcp socket</div><div>2020-11-25 15:20:01.744 UTC [error] <0.706.0>@evapi_kafka_listener:handle_info:167 body "{\"key\" : \"<a href="mailto:6142651aa63616c6c04a783cd@72.21.24.130">6142651aa63616c6c04a783cd@72.21.24.130</a>\" , \"msg\" : {\"rg_in\":\"677\",\"ani_init\":{\"ani_source\":\"fro\",.......}}}{\"key\" : \"<a href="mailto:isbc7caT4001915251VabcGhEfHdNiF0i@172.16.120.1">isbc7caT4001915251VabcGhEfHdNiF0i@172.16.120.1</a>\" , \"msg\" : {\"rg_in\":\"22\",\"ani_init\":{\"ani_source\":\"pai\", ....... ,\"translate" not valid json; error = {691,invalid_trailing_data}<br>2020-11-25 15:20:01.745 UTC [error] <0.706.0>@evapi_kafka_listener:handle_info:167 body "dPartition\":\"-1\",......}}}" not valid json; error = {1,invalid_json}<br></div><div><br></div><div>and we do see that the application cannot parse the json message fine, because we have like 2 json objects together ......{\"ani_source\":\"fro\",.......}}}{\"key\" : \"isbc7caT4001915251Vabc............</div><div>This happens with 2 different UDP receivers processing messages and calling evapi_relay at the same time. But i don't think this happens all the time. Seems like some issue when several processes try to use evapi workers at the same time.</div><div>We tried to increase evapi workers and it's the same</div><div><br></div><div>We also saw another issue I think. Seems when the avp sent to evapi socket is bigger than ~1680 char, the json is also truncated, and also happens when we use the socket in Lo interface which has an MTU of 65535.</div><div><br></div><div>Could you please take a look to see if there is any problem or limitation, or if we are using something wrong?</div><div><br></div><div>thanks and best regards </div><div>david</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mar, 29 sept 2020 a las 13:40, David Escartin (<<a href="mailto:descartin@sonoc.io" target="_blank">descartin@sonoc.io</a>>) escribió:<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 dir="ltr">hello Daniel<div><br></div><div>thanks, finally i could do that, i was struggling with this because in kamailio 5.4 there was not being created a socket on the bindaddr param when starting kamailio. (that's why i even tried to start to listen on a regular tcp socket to connect there an application)<br>But in 5.5 and 5.3 it does, so i could move forward and send the events to an external application</div><div><br></div><div>best regards<br>david</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El lun., 21 sept. 2020 a las 9:45, Daniel-Constantin Mierla (<<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>) escribió:<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>
    <p>Hello,</p>
    <p>you must have a different socket in modparam("evapi",
      "bind_addr", "...") than the core listen parameter for sip tcp
      traffic. The connect with your evapi app to the socket specified
      in modparam.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div>On 15.09.20 09:29, David Escartin
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">hello Daniel
        <div><br>
        </div>
        <div>i have tried the directive</div>
        <div>listen=<a href="http://127.0.0.1:8448" target="_blank">127.0.0.1:8448</a> and listen=tcp:<a href="http://127.0.0.1:8448" target="_blank">127.0.0.1:8448</a><br>
        </div>
        <div>and i tried now  for example to connect with a tcp client
          from port 48583 (randomly selected when i made the tcp connect
          i guess)</div>
        <div><br>
        </div>
        <div>tcp        0      0 <a href="http://127.0.0.1:8448" target="_blank">127.0.0.1:8448</a>          <a href="http://127.0.0.1:48583" target="_blank">127.0.0.1:48583</a>
                  ESTABLISHED 4508/kamailio        keepalive (2.24/0/0)<br>
        </div>
        <div><br>
        </div>
        <div>i configured the kernel to send keep alives 30secs after
          the tcp connection</div>
        <div><br>
        </div>
        <div>should this be ok?</div>
        <div><br>
        </div>
        <div>best regards</div>
        <div>david</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">El lun., 14 sept. 2020 a las
          18:50, Daniel-Constantin Mierla (<<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>)
          escribió:<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>
            <p>Hello,</p>
            <p>to what port do you connect for evapi?</p>
            <p>The logs indicate connection to sip tcp port.<br>
            </p>
            <p>Cheers,<br>
              Daniel<br>
            </p>
            <div>On 14.09.20 18:06, David Escartin wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>Dear all</div>
                <div><br>
                </div>
                <div>We are trying to use the evapi module to send some
                  data to an external application but I'm having
                  problems getting the clients connected.</div>
                <div><br>
                </div>
                <div>I have the kamailio (version 5.3) running with a 
                  tcp socket <a href="http://127.0.0.1:8228" target="_blank">127.0.0.1:8228</a>,
                  and the evapi params are just</div>
                <div>modparam("evapi", "workers", 4)<br>
                  modparam("evapi", "netstring_format", 0)<br>
                  modparam("evapi", "bind_addr", "<a href="http://127.0.0.1:8448" target="_blank">127.0.0.1:8448</a>")<br>
                  modparam("evapi", "max_clients", 32)</div>
                <div><br>
                </div>
                <div>I tried a different number of workers and
                  netstring_format 1 too.</div>
                <div>When I start the kamailio i added some debug to the
                  code, and seems when doing the mod init of the evapi
                  dispatcher</div>
                <div>38(4779) DEBUG: <core>
                  [core/sr_module.c:779]: init_mod_child(): idx 38 rank
                  -2: evapi [EvAPI Dispatcher]<br>
                </div>
                <div>it reaches to </div>
                <div>        while(1) {<br>
                                  ev_loop (loop, 0);<br>
                          }<br>
                </div>
                <div>at evapi_run_dispatcher function.</div>
                <div>I guess if I connected to the tcp socket and sent
                  some event, I would see the client accepted and the
                  event route evapi:connection-new would be triggered.
                  But i'm not able to do that.</div>
                <div>I tried to use the prime option, a tcp input client
                  connection from logstash, so i could relay the data to
                  the logstash using the evapi relay, but i only see the
                  tcp socket being created but no client accepted.</div>
                <div>I also tried to connect with an erlang gen_tcp
                  client, but it's the same<br clear="all">
                  <div>i only see</div>
                  <div><br>
                  </div>
                  <div>47(4798) DEBUG: <core>
                    [core/ip_addr.c:229]: print_ip(): tcpconn_new: new
                    tcp connection: 127.0.0.1<br>
                    47(4798) DEBUG: <core> [core/tcp_main.c:1174]:
                    tcpconn_new(): on port 54537, type 2, socket 105<br>
                    47(4798) DEBUG: <core> [core/tcp_main.c:1497]:
                    tcpconn_add(): hashes: 1117:1187:1505, 1<br>
                    47(4798) DEBUG: <core> [core/io_wait.h:375]:
                    io_watch_add(): DBG: io_watch_add(0xad0880, 105, 2,
                    0x7fc211712d58), fd_no=53<br>
                  </div>
                  <div>and if i try to send any data</div>
                  <div><br>
                  </div>
                  <div>47(4798) DEBUG: <core>
                    [core/io_wait.h:600]: io_watch_del(): DBG:
                    io_watch_del (0xad0880, 105, -1, 0x0) fd_no=54
                    called<br>
                    47(4798) DEBUG: <core> [core/tcp_main.c:4456]:
                    handle_tcpconn_ev(): sending to child, events 1<br>
                    47(4798) DEBUG: <core> [core/tcp_main.c:4129]:
                    send2child(): selected tcp worker idx:0 proc:43
                    pid:4791 for activity on [tcp:<a href="http://127.0.0.1:8448" target="_blank">127.0.0.1:8448</a>],
                    0x7fc211712d58<br>
                    43(4791) DEBUG: <core> [core/tcp_read.c:1749]:
                    handle_io(): received n=8 con=0x7fc211712d58, fd=39<br>
                    43(4791) DEBUG: <core> [core/io_wait.h:375]:
                    io_watch_add(): DBG: io_watch_add(0xb3c720, 39, 2,
                    0x7fc211712d58), fd_no=1<br>
                    43(4791) DEBUG: <core> [core/io_wait.h:600]:
                    io_watch_del(): DBG: io_watch_del (0xb3c720, 39, -1,
                    0x10) fd_no=2 called<br>
                    43(4791) DEBUG: <core> [core/tcp_read.c:1671]:
                    release_tcpconn(): releasing con 0x7fc211712d58,
                    state 1, fd=39, id=1 ([127.0.0.1]:54537 ->
                    [127.0.0.1]:8448)<br>
                    43(4791) DEBUG: <core> [core/tcp_read.c:1672]:
                    release_tcpconn(): extra_data (nil)<br>
                    47(4798) DEBUG: <core> [core/tcp_main.c:3559]:
                    handle_tcp_child(): reader response= 7fc211712d58, 1
                    from 0 <br>
                    47(4798) DEBUG: <core> [core/io_wait.h:375]:
                    io_watch_add(): DBG: io_watch_add(0xad0880, 105, 2,
                    0x7fc211712d58), fd_no=53<br>
                    47(4798) DEBUG: <core> [core/tcp_main.c:3686]:
                    handle_tcp_child(): CONN_RELEASE  0x7fc211712d58
                    refcnt= 1<br>
                  </div>
                  <div><br>
                  </div>
                  <div>and when i try to send any data</div>
                  <div>38(10867) DEBUG: evapi [evapi_dispatch.c:610]:
                    evapi_recv_notify(): received [0x7f17d23fc628]
                    [{"test" : "1.1.1.1", "uuid" : "<a href="mailto:1-31629@3.3.3.3" target="_blank">1-31629@3.3.3.3</a>" ,
                    "pdd" : "4"}] (75)<br>
                    38(10867) DEBUG: evapi [evapi_dispatch.c:316]:
                    evapi_dispatch_notify(): the message was sent to 0
                    clients<br>
                  </div>
                  <div><br>
                  </div>
                  <div>I don't know what i'm missing, or if i'm
                    understanding the use of the module correctly</div>
                  <div><br>
                  </div>
                  <div>could you please take a look?</div>
                  <div>thanks a lot</div>
                  <div>David</div>
                  <div><br>
                  </div>
                  <div><br>
                  </div>
                  -- <br>
                  <div dir="ltr">
                    <div dir="ltr">
                      <table width="100%" cellspacing="10" cellpadding="0" border="0">
                        <tbody>
                          <tr>
                            <td border="0" cellpadding="0" cellspacing="0" style="border-right:3px dotted rgb(0,155,223)" width="150" valign="center" align="center"><img alt="Logo" src="https://www.sonoc.io/wp-content/uploads/2020/07/Logo_SONOC_emails.png" hspace="5" height="100"></td>
                            <td style="padding:0px" valign="center" align="left">
                              <p><span style="color:rgb(16,47,74)"><font style="font-size:14px" face="Open
                                    Sans">David Escartín Almudévar</font></span><br>
                                <span style="color:rgb(16,47,74)"><font style="font-size:14px" face="Open
                                    Sans"><font style="font-size:12px" face="Open Sans">VoIP/Switch
                                      Engineer</font></font></span><br>
                                <font style="font-size:14px" face="Open
                                  Sans"><font style="font-size:12px" face="Open Sans"><a href="mailto:descartin@sonoc.io" style="color:rgb(0,153,204)" target="_blank"><span style="color:rgb(0,155,223)">descartin@sonoc.io</span></a><span style="color:rgb(0,155,223)"></span></font></font></p>
                              <p><span style="color:rgb(16,47,74)"><font style="font-size:14px" face="Open
                                    Sans"><strong><font face="Open Sans">SONOC</font></strong></font></span><br>
                                <span style="color:rgb(16,47,74)"><font style="font-size:14px" face="Open
                                    Sans"><font style="font-size:12px" face="Open Sans">C/ Josefa Amar y
                                      Borbón, 10, 4ª · 50001 Zaragoza,
                                      España</font><br>
                                    <font size="-1" face="Open Sans">Tlf:
                                      +34 917019888 ·</font></font></span><font style="font-size:14px" face="Open
                                  Sans" color="#102f4a"><font size="-1" face="Open Sans" color="#102f4a"> </font></font><font style="font-size:14px" face="Open
                                  Sans"><font size="-1" face="Open Sans"><font size="-1" face="Open Sans"><a href="http://www.sonoc.io" style="color:rgb(0,153,204)" target="_blank"><span style="color:rgb(0,155,223)">www.sonoc.io</span></a></font></font></font></p>
                            </td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </div>
                </div>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
Kamailio (SER) - Users Mailing List
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">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">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank">https://www.paypal.me/dcmierla</a></pre>
          </div>
        </blockquote>
      </div>
      <br clear="all">
      <div><br>
      </div>
      -- <br>
      <div dir="ltr">
        <div dir="ltr">
          <table style="font-family:"Times New Roman"" width="100%" cellspacing="10" cellpadding="0" border="0">
            <tbody>
              <tr>
                <td border="0" cellpadding="0" cellspacing="0" style="border-right:3px dotted rgb(0,155,223)" width="150" valign="center" align="center"><img alt="Logo" src="https://www.sonoc.io/wp-content/uploads/2020/07/Logo_SONOC_emails.png" hspace="5" height="100"></td>
                <td style="padding:0px" valign="center" align="left">
                  <p><span style="color:rgb(16,47,74)"><font style="font-size:14px" face="Open Sans">David
                        Escartín Almudévar</font></span><br>
                    <span style="color:rgb(16,47,74)"><font style="font-size:14px" face="Open Sans"><font style="font-size:12px" face="Open Sans">VoIP/Switch
                          Engineer</font></font></span><br>
                    <font style="font-size:14px" face="Open Sans"><font style="font-size:12px" face="Open Sans"><a href="mailto:descartin@sonoc.io" style="color:rgb(0,153,204)" target="_blank"><span style="color:rgb(0,155,223)">descartin@sonoc.io</span></a><span style="color:rgb(0,155,223)"></span></font></font></p>
                  <p><span style="color:rgb(16,47,74)"><font style="font-size:14px" face="Open Sans"><strong><font face="Open Sans">SONOC</font></strong></font></span><br>
                    <span style="color:rgb(16,47,74)"><font style="font-size:14px" face="Open Sans"><font style="font-size:12px" face="Open Sans">C/
                          Josefa Amar y Borbón, 10, 4ª · 50001 Zaragoza,
                          España</font><br>
                        <font size="-1" face="Open Sans">Tlf: +34
                          917019888 ·</font></font></span><font style="font-size:14px" face="Open Sans" color="#102f4a"><font size="-1" face="Open Sans" color="#102f4a"> </font></font><font style="font-size:14px" face="Open Sans"><font size="-1" face="Open Sans"><font size="-1" face="Open Sans"><a href="http://www.sonoc.io" style="color:rgb(0,153,204)" target="_blank"><span style="color:rgb(0,155,223)">www.sonoc.io</span></a></font></font></font></p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </blockquote>
    <pre cols="72">-- 
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Funding: <a href="https://www.paypal.me/dcmierla" target="_blank">https://www.paypal.me/dcmierla</a></pre>
  </div>

</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><table border="0" cellpadding="0" cellspacing="10" width="100%" style="font-family:"Times New Roman""><tbody><tr><td align="center" border="0" cellpadding="0" cellspacing="0" valign="center" width="150" style="border-right:3px dotted rgb(0,155,223)"><img alt="Logo" height="100" hspace="5" src="https://www.sonoc.io/wp-content/uploads/2020/07/Logo_SONOC_emails.png"></td><td align="left" valign="center" style="padding:0px"><p><span style="color:rgb(16,47,74)"><font face="Open Sans" style="font-size:14px">David Escartín Almudévar</font></span><br><span style="color:rgb(16,47,74)"><font face="Open Sans" style="font-size:14px"><font face="Open Sans" style="font-size:12px">VoIP/Switch Engineer</font></font></span><font face="Open Sans" style="font-size:14px"><font face="Open Sans" style="font-size:12px"></font></font><br><font face="Open Sans" style="font-size:14px"><font face="Open Sans" style="font-size:12px"><a href="mailto:descartin@sonoc.io" style="color:rgb(0,153,204)" target="_blank"><span style="color:rgb(0,155,223)">descartin@sonoc.io</span></a><span style="color:rgb(0,155,223)"></span></font></font></p><p><span style="color:rgb(16,47,74)"><font face="Open Sans" style="font-size:14px"><strong><font face="Open Sans">SONOC</font></strong></font></span><br><span style="color:rgb(16,47,74)"><font face="Open Sans" style="font-size:14px"><font face="Open Sans" style="font-size:12px">C/ Josefa Amar y Borbón, 10, 4ª · 50001 Zaragoza, España</font><br><font face="Open Sans" size="-1">Tlf: +34 917019888 ·</font></font></span><font color="#102f4a" face="Open Sans" style="font-size:14px"><font color="#102f4a" face="Open Sans" size="-1"> </font></font><font face="Open Sans" style="font-size:14px"><font face="Open Sans" size="-1"><font face="Open Sans" size="-1"><a href="http://www.sonoc.io" style="color:rgb(0,153,204)" target="_blank"><span style="color:rgb(0,155,223)">www.sonoc.io</span></a></font></font></font></p></td></tr></tbody></table></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><table border="0" cellpadding="0" cellspacing="10" width="100%" style="font-family:"Times New Roman""><tbody><tr><td align="center" border="0" cellpadding="0" cellspacing="0" valign="center" width="150" style="border-right:3px dotted rgb(0,155,223)"><img alt="Logo" height="100" hspace="5" src="https://www.sonoc.io/wp-content/uploads/2020/07/Logo_SONOC_emails.png"></td><td align="left" valign="center" style="padding:0px"><p><span style="color:rgb(16,47,74)"><font face="Open Sans" style="font-size:14px">David Escartín Almudévar</font></span><br><span style="color:rgb(16,47,74)"><font face="Open Sans" style="font-size:14px"><font face="Open Sans" style="font-size:12px">VoIP/Switch Engineer</font></font></span><font face="Open Sans" style="font-size:14px"><font face="Open Sans" style="font-size:12px"></font></font><br><font face="Open Sans" style="font-size:14px"><font face="Open Sans" style="font-size:12px"><a href="mailto:descartin@sonoc.io" style="color:rgb(0,153,204)" target="_blank"><span style="color:rgb(0,155,223)">descartin@sonoc.io</span></a><span style="color:rgb(0,155,223)"></span></font></font></p><p><span style="color:rgb(16,47,74)"><font face="Open Sans" style="font-size:14px"><strong><font face="Open Sans">SONOC</font></strong></font></span><br><span style="color:rgb(16,47,74)"><font face="Open Sans" style="font-size:14px"><font face="Open Sans" style="font-size:12px">C/ Josefa Amar y Borbón, 10, 4ª · 50001 Zaragoza, España</font><br><font face="Open Sans" size="-1">Tlf: +34 917019888 ·</font></font></span><font color="#102f4a" face="Open Sans" style="font-size:14px"><font color="#102f4a" face="Open Sans" size="-1"> </font></font><font face="Open Sans" style="font-size:14px"><font face="Open Sans" size="-1"><font face="Open Sans" size="-1"><a href="http://www.sonoc.io" style="color:rgb(0,153,204)" target="_blank"><span style="color:rgb(0,155,223)">www.sonoc.io</span></a></font></font></font></p></td></tr></tbody></table></div></div>