[pjsip] PJSIP - tcp connection and keep-alives from server (Maksim Solovjov)

JOHAN LANTZ johan at tid.es
Mon May 12 16:26:25 EDT 2014

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.


>Message: 4
>Date: Mon, 12 May 2014 16:11:03 +0300
>From: Maksim Solovjov <maxim.solovjov at gmail.com>
>To: pjsip list <pjsip at lists.pjsip.org>
>Subject: [pjsip] PJSIP - tcp connection and keep-alives from server
>       <CAO11aqhR898iprUN9Ms++bMjb3fFpV4KhAycA5q_LEPXL3B5Kg at mail.gmail.com>
>Content-Type: text/plain; charset=UTF-8
>I am using PJSIP and have configured tcp connection to use with the
>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:

More information about the pjsip mailing list