[pjsip] TCP/TLS reconnect

Benny Prijono bennylp at teluu.com
Tue Feb 9 09:40:53 CST 2010

On Thu, Jan 21, 2010 at 2:03 PM, Klaus Darilion
<klaus.mailinglists at pernau.at> wrote:
> Hi!
> When the server closes the TCP/TLS connection (e.g. server restarts), pjsip
> waits until it is time for re-registration to reestablish the TCP/TLS
> connection.
> Is there an option for pjsip to immediately (e.g. after 3 seconds) to
> reestablish the connection and reREGISTER?
> If no, please take this as a feature request :-)
> Is there maybe a callback which is called when the TCP connection is closed?
> Then I could handle this in application using pjsua_acc_set_registration().

I think we'll go with the callback approach, with adding transport
connection state callback in PJSUA-LIB. This incidently would also
work for the TLS certificate verification exception problem, so I
added this to ticket #1032: http://trac.pjsip.org/repos/ticket/1032

> Another note: When pjsip receives the [FIN] packet from server, it only
> sends [ACK], not [FIN,ACK]. Thus, on pjsip side the connection is still
> open. Then, when reregistration begins, pjsip opens a new TCP connection,
> performs rergeistration, and after that, pjsip sends [FIN,ACK] on the old
> TCP connection (which is ignored by the server anyway because of timeout).
> Wouldn't it be nicer to send FIN when the FIN is received from the server?

That's probably because we only close the socket after the reference
counter goes to zero, and the registration session keeps one reference
until it is destroyed, and this only happens in the reregistration

But once the app handles the disconnection state, this would happen
much quicker.


More information about the pjsip mailing list