<div dir="ltr">Also forgot to mention, this starts happening at around 1200cps. And using SIPp I accelerate from 500cps to 1200cps very quick. So it might be related to concurrency is what I'm assuming. Thanks.<div><br></div><div>- Jayesh</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 22, 2015 at 12:40 PM Jayesh Nambiar <<a href="mailto:jayesh1017@gmail.com">jayesh1017@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div>Took time to get back with the test results as I was trying to analyze too much myself before getting back on the list. Also I was stuck with weird error of module version mismatch, but I figured and solved that issue.</div><div>So I do see the logs "frame size mismatch" when I miss the events. Since the logs are too huge, I am sending it in pastebin. Here it is:</div><div><a href="http://pastebin.com/MzTpYsrk" target="_blank">http://pastebin.com/MzTpYsrk</a><br></div><div><br></div><div>In Kamailio Logs, I see:</div><div><span style="color:rgb(0,0,0);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace,serif;font-size:12px;line-height:21px">DEBUG: evapi [evapi_dispatch.c:361]: evapi_recv_client(): frame size mismatch the ending char (h):[{"event":"REGISTER","tindex":"12603","tlabel":"</span>626010915<span style="color:rgb(0,0,0);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace,serif;font-size:12px;line-height:21px">","PhoneNumber":"42000","D146:"event":"REGISTER","tindex":"3639","tlabel":"</span>1889788252<span style="color:rgb(0,0,0);font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace,serif;font-size:12px;line-height:21px">","P] (146)</span><br></div><div><br></div><div>Whereas the messages in ngrep looks good where the messages are split in two TCP packets. The first packet ends at D and the second packet is the proper continuation which send the rest. But it feels Kamailio skipped the beginning of the message and started parsing at colon again and it thinks the netstring started with D146 which is incorrect. Hence, it never emitted any event for the messages in the first chunk.</div><div><br></div><div>Hoping this to be helpful !! Thanks.</div></div><div dir="ltr"><div><br></div><div>- Jayesh</div></div><div dir="ltr"><div>







<p><br></p></div><div><div class="gmail_quote"><div dir="ltr">On Mon, Sep 21, 2015 at 4:37 PM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>> wrote:<br></div><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 pushed another commit to add more debug messages to see if the
    event route is supposed to be executed or not. Can you run the tests
    again and give again the log messages for missing event route
    executions?<br>
    <br>
    Cheers,<br>
    Daniel</div><div bgcolor="#FFFFFF" text="#000000"><br>
    <br>
    <div>On 21/09/15 09:04, Jayesh Nambiar
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Daniel,
        <div>I have captured debug messages after testing with your
          latest commit on master. Once again, here's what I'm doing
          exactly for my test:</div>
        <div>1) Use SIPp to send OPTIONS towards Kamailio.</div>
        <div>2) On getting options send event as follows:</div>
        <div>evapi_async_relay("{\"event\":\"REGISTER\",\"tindex\":\"$T(id_index)\",\"tlabel\":\"$T(id_label)\",\"PhoneNumber\":\"$avp(phone_number)\",\"DeviceId\":\"$avp(device_id)\",\"CallId\":\"$ci\"}");<br>
        </div>
        <div>3) There's a client connected which listens for messages on
          this socket, parses the netstring, and sends same data back as
          netstring to Kamailio.</div>
        <div>4) On the event_route[evapi:message-received, I do the
          following:</div>
        <div>
          <div>xlog("L_INFO", "GOT [$evapi(msg)] from
            $evapi(srcaddr):$evapi(srcport)\n");</div>
          <div>    if($evapi(msg)=~"REGISTER" &&
            $evapi(msg)=~"tindex") {</div>
          <div>      <span style="white-space:pre-wrap">       </span>jansson_get_field("$evapi(msg)",
            "tlabel", "$var(tlabel)");</div>
          <div>    <span style="white-space:pre-wrap">  </span>jansson_get_field("$evapi(msg)",
            "tindex", "$var(tindex)");</div>
          <div>      <span style="white-space:pre-wrap">      </span>$var(t_index)
            = $(var(tindex){<a href="http://s.int" target="_blank">s.int</a>});</div>
          <div>    <span style="white-space:pre-wrap">  </span>$var(t_label)
            = $(var(tlabel){<a href="http://s.int" target="_blank">s.int</a>});</div>
          <div>      <span style="white-space:pre-wrap">      </span>t_continue('$var(t_index)',
            '$var(t_label)', 'REGISTER_RESPONSE');</div>
          <div>    <span style="white-space:pre-wrap">  </span>exit;</div>
          <div>    }</div>
        </div>
        <div>5) On route[REGISTER_RESPONSE], I send 200 OK to SIPp</div>
        <div><br>
        </div>
        <div>Now here are detailed logs for which neither SIPp didnt get
          a response nor the GOT [$evapi(msg)] from
          $evapi(srcaddr):$evapi(srcport)\n"); got logged in the syslog:</div>
        <div><br>
        </div>
        <div>First Event:</div>
        <div>
          <div>DEBUG: evapi [evapi_dispatch.c:598]: evapi_relay():
            relaying event data
[{"event":"REGISTER","tindex":"26266","tlabel":"587925078","PhoneNumber":"21956","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:23021-12910@198.24.63.39" target="_blank"></a><a href="mailto:23021-12910@198.24.63.39" target="_blank">23021-12910@198.24.63.39</a>"}]
            (146)</div>
          <div>DEBUG: evapi [evapi_dispatch.c:623]: evapi_relay():
            sending [0x7f132588de68]
[146:{"event":"REGISTER","tindex":"26266","tlabel":"587925078","PhoneNumber":"21956","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:23021-12910@198.24.63.39" target="_blank"></a><a href="mailto:23021-12910@198.24.63.39" target="_blank">23021-12910@198.24.63.39</a>"},]
            (151)</div>
          <div><br>
          </div>
          <div>DEBUG: evapi [evapi_dispatch.c:488]: evapi_recv_notify():
            received [0x7f132588de68]
[146:{"event":"REGISTER","tindex":"26266","tlabel":"587925078","PhoneNumber":"21956","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:23021-12910@198.24.63.39" target="_blank"></a><a href="mailto:23021-12910@198.24.63.39" target="_blank">23021-12910@198.24.63.39</a>"},]
            (151)</div>
          <div>NOTICE: evapi [evapi_dispatch.c:290]:
            evapi_recv_client(): {0} [<a href="http://198.24.63.45:48881" target="_blank">198.24.63.45:48881</a>] -
            received
[146:{"event":"REGISTER","tindex":"26266","tlabel":"587925078","PhoneNumber":"21956","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:23021-12910@198.24.63.39" target="_blank"></a><a href="mailto:23021-12910@198.24.63.39" target="_blank">23021-12910@198.24.63.39</a>"},]
            (151) (18)</div>
        </div>
        <div><br>
        </div>
        <div>Second Event:</div>
        <div>
          <div>DEBUG: evapi [evapi_dispatch.c:598]: evapi_relay():
            relaying event data
[{"event":"REGISTER","tindex":"32244","tlabel":"1637923412","PhoneNumber":"25597","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:27182-12910@198.24.63.39" target="_blank"></a><a href="mailto:27182-12910@198.24.63.39" target="_blank">27182-12910@198.24.63.39</a>"}]
            (147)</div>
          <div>  DEBUG: evapi [evapi_dispatch.c:623]: evapi_relay():
            sending [0x7f1325884410]
[147:{"event":"REGISTER","tindex":"32244","tlabel":"1637923412","PhoneNumber":"25597","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:27182-12910@198.24.63.39" target="_blank"></a><a href="mailto:27182-12910@198.24.63.39" target="_blank">27182-12910@198.24.63.39</a>"},]
            (152)</div>
          <div><br>
          </div>
          <div>  DEBUG: evapi [evapi_dispatch.c:488]:
            evapi_recv_notify(): received [0x7f1325884410]
[147:{"event":"REGISTER","tindex":"32244","tlabel":"1637923412","PhoneNumber":"25597","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:27182-12910@198.24.63.39" target="_blank"></a><a href="mailto:27182-12910@198.24.63.39" target="_blank">27182-12910@198.24.63.39</a>"},]
            (152)</div>
          <div>  NOTICE: evapi [evapi_dispatch.c:290]:
            evapi_recv_client(): {0} [<a href="http://198.24.63.45:48881" target="_blank">198.24.63.45:48881</a>] -
            received
[147:{"event":"REGISTER","tindex":"32244","tlabel":"1637923412","PhoneNumber":"25597","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:27182-12910@198.24.63.39" target="_blank"></a><a href="mailto:27182-12910@198.24.63.39" target="_blank">27182-12910@198.24.63.39</a>"},]
            (152) (85)</div>
          <div><br>
          </div>
          <div>I had three such events which got missed out of some
            25000 odd messages sent from SIPp. Other major difference
            that I see in the debug logs for problematic events are that
            there is a positive number in the second parentheses
            of evapi_recv_client() function. For the events that were
            invoked successfully the value of second parentheses is 0
            for evapi_recv_client() function. Hope the debugging helps.</div>
          <div><br>
          </div>
          <div>Debug log for a successful event:</div>
          <div>
            <div>DEBUG: evapi [evapi_dispatch.c:598]: evapi_relay():
              relaying event data
[{"event":"REGISTER","tindex":"22127","tlabel":"1896682192","PhoneNumber":"73168","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:49957-13056@198.24.63.39" target="_blank"></a><a href="mailto:49957-13056@198.24.63.39" target="_blank">49957-13056@198.24.63.39</a>"}]
              (147)</div>
            <div>  DEBUG: evapi [evapi_dispatch.c:623]: evapi_relay():
              sending [0x7f132568e850]
[147:{"event":"REGISTER","tindex":"22127","tlabel":"1896682192","PhoneNumber":"73168","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:49957-13056@198.24.63.39" target="_blank"></a><a href="mailto:49957-13056@198.24.63.39" target="_blank">49957-13056@198.24.63.39</a>"},]
              (152)</div>
            <div><br>
            </div>
            <div>  DEBUG: evapi [evapi_dispatch.c:488]:
              evapi_recv_notify(): received [0x7f132568e850]
[147:{"event":"REGISTER","tindex":"22127","tlabel":"1896682192","PhoneNumber":"73168","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:49957-13056@198.24.63.39" target="_blank"></a><a href="mailto:49957-13056@198.24.63.39" target="_blank">49957-13056@198.24.63.39</a>"},]
              (152)</div>
            <div>  NOTICE: evapi [evapi_dispatch.c:290]:
              evapi_recv_client(): {0} [<a href="http://198.24.63.45:48881" target="_blank">198.24.63.45:48881</a>]
              - received
[147:{"event":"REGISTER","tindex":"22127","tlabel":"1896682192","PhoneNumber":"73168","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:49957-13056@198.24.63.39" target="_blank"></a><a href="mailto:49957-13056@198.24.63.39" target="_blank">49957-13056@198.24.63.39</a>"},]
              (152) (0)</div>
          </div>
          <div><br>
          </div>
          <div>Thanks,</div>
        </div>
        <div><br>
        </div>
        <div>- Jayesh<br>
          <div class="gmail_quote">
            <div dir="ltr">On Sat, Sep 19, 2015 at 3:55 AM
              Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>>
              wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> I pushed a commit
                to add more debug message while processing received
                data. You can use debugger module to set a higher debug
                level for evapi module in order to see what happens.<br>
                <br>
                I checked the netstring packet size and it is invalid
                (unless email stripped some white chars there) -- for
                example in:</div>
              <div bgcolor="#FFFFFF" text="#000000"><br>
                <br>
145:{"event":"REGISTER","tindex":"55567","tlabel":"627458699","PhoneNumber":"20711","DeviceId":"abcd1234abcd1234","CallId":<a href="mailto:21225-3848@5.6.7.8" target="_blank"></a><a href="mailto:21225-3848@5.6.7.8" target="_blank">"21225-3848@5.6.7.8"</a>},<br>
                <br>
              </div>
              <div bgcolor="#FFFFFF" text="#000000"> the size is 141,
                not 145 -- it looks like the size includes the size
                itself plus the delimiters ':,'. The size is only the
                effective data, see:<br>
                <br>
                <a href="https://en.wikipedia.org/wiki/Netstring" target="_blank">https://en.wikipedia.org/wiki/Netstring</a><br>
                <br>
                If evapi gets a packet with an invalid size, then it
                discards the buffer content.<br>
                <br>
                See if the app on the other side of evapi connection
                builds netstrings with wrong size.<br>
                <br>
                Cheers,<br>
                Daniel</div>
              <div bgcolor="#FFFFFF" text="#000000"><br>
                <br>
                <div>On 18/09/15 23:19, Jayesh Nambiar wrote:<br>
                </div>
                <blockquote type="cite">
                  <div dir="ltr">Here are the tests that I did:
                    <div><br>
                    </div>
                    <div>With the patch applied, I see that Kamailio is
                      invoking event individually for each netstring
                      even when they come in different chunks. But I did
                      see instances where when there were complete
                      netstrings in a single chunk; kamailio did not
                      raise an event for them. Here's the illustration:</div>
                    <div><br>
                    </div>
                    <div>
                      <div>T <a href="http://1.2.3.4:48873" target="_blank">1.2.3.4:48873</a>
                        -> <a href="http://5.6.7.8:3927" target="_blank">5.6.7.8:3927</a>
                        [AP]</div>
                      <div>146:{"event":"REGISTER","tindex":"16916","tlabel":"1753048277","PhoneNumber":"20708","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:21220-3848@5.6.7.8" target="_blank"></a><a href="mailto:21220-3848@5.6.7.8" target="_blank">21220-3848@5.6.7.8</a>"},144:{"event":"REGISTER","tindex":"7954","tlabel":"254315075","PhoneNumber":"20709","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:21223-3848@5.6.7.8" target="_blank"></a><a href="mailto:21223-3848@5.6.7.8" target="_blank">21223-3848@5.6.7.8</a>"},145:{"event":"REGISTER","tindex":"64529","tlabel":"599481568","PhoneNumber":"20709","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:21222-3848@5.6.7.8" target="_blank"></a><a href="mailto:21222-3848@5.6.7.8" target="_blank">21222-3848@5.6.7.8</a>"},145:{"event":"REGISTER","tindex":"46605","tlabel":"112015324","PhoneNumber":"20710","DeviceId"

                                                                       
                                                                       
                                                                       
                                                                       
                               </div>
                      <div><br>
                      </div>
                      <div>T <a href="http://1.2.3.4:48873" target="_blank">1.2.3.4:48873</a>
                        -> <a href="http://5.6.7.8:3927" target="_blank">5.6.7.8:3927</a>
                        [AP]</div>
                      <div>  :"abcd1234abcd1234","CallId":"<a href="mailto:21224-3848@5.6.7.8" target="_blank"></a><a href="mailto:21224-3848@5.6.7.8" target="_blank">21224-3848@5.6.7.8</a>"},</div>
                    </div>
                    <div><br>
                    </div>
                    <div><b>The above two chunks contain 4 proper
                        netstrings where the second chunk contains part
                        of the 4th netstring. In this case Evapi
                        properly raised 4 individual events.</b></div>
                    <div><br>
                    </div>
                    <div>
                      <div><a href="http://1.2.3.4:48873" target="_blank">1.2.3.4:48873</a>
                        -> <a href="http://5.6.7.8:3927" target="_blank">5.6.7.8:3927</a>
                        [AP]</div>
                      <div> 
145:{"event":"REGISTER","tindex":"55567","tlabel":"627458699","PhoneNumber":"20711","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:21225-3848@5.6.7.8" target="_blank"></a><a href="mailto:21225-3848@5.6.7.8" target="_blank">21225-3848@5.6.7.8</a>"},143:{"event":"REGISTER","tindex":"28682","tlabel":"9676691","PhoneNumber":"20712","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:21226-3848@5.6.7.8" target="_blank"></a><a href="mailto:21226-3848@5.6.7.8" target="_blank">21226-3848@5.6.7.8</a>"},</div>
                    </div>
                    <div><br>
                    </div>
                    <div><b>This above chunk contains two complete
                        netstrings but Kamailio never raised events for
                        these two netstrings.</b></div>
                    <div><b><br>
                      </b></div>
                    <div>For the events that were not raised I see
                      proper Kamailio Logs which is:</div>
                    <div>evapi_recv_client(): {0} [<a href="http://1.2.3.4:48873" target="_blank">1.2.3.4:48873</a>]
                      - received
[145:{"event":"REGISTER","tindex":"55567","tlabel":"627458699","PhoneNumber":"20711","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:21225-3848@5.6.7.8" target="_blank"></a><a href="mailto:21225-3848@5.6.7.8" target="_blank">21225-3848@5.6.7.8</a>"},143:{"event":"REGISTER","tindex":"28682","tlabel":"9676691","PhoneNumber":"20712","DeviceId":"abcd1234abcd1234","CallId":"<a href="mailto:21226-3848@5.6.7.8" target="_blank"></a><a href="mailto:21226-3848@5.6.7.8" target="_blank">21226-3848@5.6.7.8</a>"},]<br>
                    </div>
                    <div><b><br>
                      </b></div>
                    <div>But I don't see the logs that I've written in
                      the script after the event was raised, which means
                      Kamailio did not invoke events for these two
                      netstrings.</div>
                    <div><br>
                    </div>
                    <div>So in my tests, out of 27232 messages sent,
                      there were approximately 27 messages for which the
                      events were not raised by Evapi. The rate of
                      messages started at 500cps and I stopped after I
                      saw missed events at around 1200cps.</div>
                    <div><br>
                    </div>
                    <div>Thanks, and do let me know for any further
                      tests or information required about the same.</div>
                    <div><br>
                    </div>
                    <div>- Jayesh</div>
                    <div><b><br>
                      </b></div>
                    <div><br>
                    </div>
                  </div>
                  <div class="gmail_extra"><br>
                    <div class="gmail_quote">On Fri, Sep 18, 2015 at
                      2:55 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">Will have this tested by tomorrow
                          and will get back to you. Thanks.<span><font color="#888888">
                              <div><br>
                              </div>
                              <div>- Jayesh</div>
                            </font></span></div>
                        <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"></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>
                                    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><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"></a><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"></a><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" target="_blank"></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><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/#%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>
                                      </div>
                                    </div>
                                  </div>
                                </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>
              </div>
            </blockquote>
          </div>
        </div>
      </div>
    </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></blockquote></div></div></div></blockquote></div>