Hi Maksim Pjsip will filter our crlf from incoming sip packets by default. What does your server send as ka data? When sending from the client side the standard approach is that the client sends a "\r\n\r\n? and the server responds with a "\r\n?. If you send this kind of keep alive from the server, pjsip should filter it out without problems. You can not count on the PJSIP_TCP_KEEP_ALIVE_INTERVAL on iPhone. In background mode you will most likely find yourself restricted to the min wakeup cycle of 600 sec as you say. If the nat hole is closing before this time, you will have a connectivity problem for incoming packets during part of these 600 seconds. This could potentially be improved by your server side keep alive. As always, battery consumption etc is the tradeoff here, thats why Apple does not allow us to do everything we would like sometimes. /Johan > >Message: 4 >Date: Mon, 12 May 2014 16:11:03 +0300 >From: Maksim Solovjov <maxim.solovjov@xxxxxxxxx> >To: pjsip list <pjsip at lists.pjsip.org> >Subject: PJSIP - tcp connection and keep-alives from server >Message-ID: > <CAO11aqhR898iprUN9Ms++bMjb3fFpV4KhAycA5q_LEPXL3B5Kg at mail.gmail.com> >Content-Type: text/plain; charset=UTF-8 > >Hello, >I am using PJSIP and have configured tcp connection to use with the >server. >I've also configured the server to send keep-alive notification to the >client every 90 seconds. > >Unfortunately, it seems that the tcp buffer on pjsip doesn't discard >keep-alives packets, so when the real message comes, for example, SIP >message I am getting an error: > >sip_transport. !Error processing 879 bytes packet from TCP >xx.xx.xx.xx:5060 : PJSIP syntax error exception when parsing '' header >on line 1 col 1: > > >-- end of packet. > >After that everything works fine for 90 seconds, then server sends >another keep-alive packet and the error is repeated, then fine for 90 >seconds, then one error and so on.... > >How can I fix that? > >Any help would be highly appreciated! > >I've read that sip_config.h contains some values related to >keep-alives. and the default values are 90 seconds for TCP ( >PJSIP_TCP_KEEP_ALIVE_INTERVAL ). But how does it work on iPhone, if >application is freezed while it is in background, and Apple allows to >wake it up only once in 10 minutes??? > >Thank you in advance. > ________________________________ Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra pol?tica de env?o y recepci?n de correo electr?nico en el enlace situado m?s abajo. This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at: http://www.tid.es/ES/PAGINAS/disclaimer.aspx