<div dir="ltr">Will have this tested by tomorrow and will get back to you. Thanks.<div><br></div><div>- Jayesh</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 18, 2015 at 1:41 PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@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 bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    I just pushed a patch to master branch that should cope with partial
    data received on tcp connection. No time to test at all, therefore
    any feedback will be appreciated.<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="h5"><br>
    <br>
    <div>On 15/09/15 14:52, Daniel-Constantin
      Mierla wrote:<br>
    </div>
    <blockquote type="cite">
      
      Hello,<br>
      <br>
      I will look if there are options in libev to buffer data or try to
      implement a buffering mechanism locally for such cases.<br>
      <br>
      Cheers,<br>
      Daniel<br>
      <br>
      <div>On 14/09/15 23:00, Jayesh Nambiar
        wrote:<br>
      </div>
      <blockquote type="cite">
        <div dir="ltr">Hello Daniel,
          <div>After further testing with evapi module, I figured that
            when Netstrings are used, an event route is invoked
            individually for each message even if if multiple netstring
            messages are received in a single TCP packet. But this
            doesn't work effectively when a single proper message is
            split-up in two packets. For Example, if a message arrives
            as:</div>
          <div>12:Hello World!, 12:Hello World!, 12:Hello World! in a
            single packet, kamailio properly invokes the event route
            "evapi:message-received" thrice for every individual proper
            netstring message. </div>
          <div>But if the first packet contains:</div>
          <div>12:Hello World!, 12:Hello</div>
          <div>And Second Packet contains:</div>
          <div> World!, 12:Hello World!</div>
          <div>the event route is invoked only once !!</div>
          <div><br>
          </div>
          <div>The above pattern is very much possible while sending and
            receiving packets over TCP Socket. Our tests for receiving
            an approximately 150 byte message over evapi socket at the
            rate of roughly 1000cps causes a lot of real events to be
            missed because of the above problem. You can never be sure
            when TCP will split messages in different chunks.</div>
          <div>This definitely looks like a bug which makes it not very
            reliable at large scale deployments. Would really appreciate
            your inputs on this. Thanks;</div>
          <div><br>
          </div>
          <div>- Jayesh</div>
          <div><br>
          </div>
          <div><br>
          </div>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Thu, Sep 10, 2015 at 4:01 PM,
            Jayesh Nambiar <span dir="ltr"><<a href="mailto:jayesh1017@gmail.com" target="_blank"></a><a href="mailto:jayesh1017@gmail.com" target="_blank">jayesh1017@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">Hi Daniel,
                <div>Thanks for the quick response. So if I do not use
                  Netstrings, does Kamailio allow me to create a custom
                  logic in the script. For eg. if I decide to use
                  newline as a delimiter, can I keep buffering the
                  message until I encounter the delimiter from the event
                  route and then execute whatever I have to within the
                  script??</div>
                <div><br>
                </div>
                <div>Thanks,</div>
                <div><br>
                </div>
                <div>- Jayesh</div>
              </div>
              <div>
                <div>
                  <div class="gmail_extra"><br>
                    <div class="gmail_quote">On Thu, Sep 10, 2015 at
                      1:29 PM, Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank"></a><a href="mailto:miconda@gmail.com" target="_blank">miconda@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 bgcolor="#FFFFFF" text="#000000"> Hello,<br>
                          <br>
                          tcb is stream protocol and several messages
                          can be queued on the pipe at the same time.
                          That is the reason for netstring format, to be
                          able to easily detect the boundaries of each
                          message. If netstring format is enabled and
                          kamailio receives several messages at once, it
                          splits them and for each is executing the
                          event route.<br>
                          <br>
                          If netstring format is not used, the kamailio
                          is executing the event route with the entire
                          content that was read at once from the tcp
                          connection.<br>
                          <br>
                          Cheers,<br>
                          Daniel
                          <div>
                            <div><br>
                              <br>
                              <div>On 09/09/15 22:01, Jayesh Nambiar
                                wrote:<br>
                              </div>
                            </div>
                          </div>
                          <blockquote type="cite">
                            <div>
                              <div>
                                <div dir="ltr">Hello,
                                  <div>I'm exploring the evapi module
                                    for my kamailio to interface with an
                                    external node.js app for third party
                                    stuff like AAA, billing engine
                                    tasks, notifications and so on. I
                                    followed and took some ideas from
                                    the rtjson and evapi tutorial found
                                    here(<a href="http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs" target="_blank">http://kb.asipto.com/kamailio:k43-async-sip-routing-nodejs</a>)
                                    to build the node.js app consuming
                                    events.</div>
                                  <div>When I stress tested the scenario
                                    using SIPp and tried sending a lot
                                    of events at 300-350cps from
                                    Kamailio, I noticed that at times
                                    the client is receiving 2-3 events
                                    in a single message together
                                    although I do event_sync_relay once
                                    per SIP message received and have
                                    netstrings enabled. I believe this
                                    is a typical behavior of TCP and
                                    needs to be handled by the client
                                    using some kind of Netstring
                                    handler. Please correct me if I'm
                                    wrong.</div>
                                  <div>And hence I'd like to know what
                                    particularly needs to be taken care
                                    of while writing a client that is
                                    listening for events on raw tcp
                                    socket and how does kamailio handle
                                    this situation while receiving
                                    messages over TCP socket?? Does
                                    kamailio recognize the end of
                                    netstring properly on
                                    evapi:message-received and give
                                    exactly one message to take care of
                                    on every "message-received" event or
                                    should that be handled in the script
                                    somewhere !!</div>
                                  <div>I also referred cgrates client
                                    over evapi example which is written
                                    in GO, but I couldnt find them
                                    handling TCP streams clearly either.</div>
                                  <div>I'd really appreciate some expert
                                    suggestion here to make an informed
                                    decision on using the evapi module
                                    for a large scale solution.</div>
                                  <div><br>
                                  </div>
                                  <div>Thanks,</div>
                                  <div><br>
                                  </div>
                                  <div>- Jayesh</div>
                                  <div><br>
                                  </div>
                                  <div><br>
                                  </div>
                                </div>
                                <br>
                                <fieldset></fieldset>
                                <br>
                              </div>
                            </div>
                            <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a 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><span><font color="#888888">
</font></span></pre>
                            <span><font color="#888888"> </font></span></blockquote>
                          <span><font color="#888888"> <br>
                              <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a></pre>
                            </font></span></div>
                        <br>
                        _______________________________________________<br>
                        SIP Express Router (SER) and Kamailio (OpenSER)
                        - sr-users mailing list<br>
                        <a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
                        <a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                        <br>
                      </blockquote>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </blockquote>
      <br>
      <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a></pre>
    </blockquote>
    <br>
    <pre cols="72">-- 
Daniel-Constantin Mierla
<a href="http://twitter.com/#!/miconda" target="_blank">http://twitter.com/#!/miconda</a> - <a href="http://www.linkedin.com/in/miconda" target="_blank">http://www.linkedin.com/in/miconda</a>
Book: SIP Routing With Kamailio - <a href="http://www.asipto.com" target="_blank">http://www.asipto.com</a>
Kamailio Advanced Training, Sep 28-30, 2015, in Berlin - <a href="http://asipto.com/u/kat" target="_blank">http://asipto.com/u/kat</a></pre>
  </div></div></div>

</blockquote></div><br></div>