I have problem to clean close an outbound session.

I'm using the "esl_oop.h/esl_oop.cpp" files and my application is developed in c++ and at startup I do a "linger" command.

My event consuming loop is:

while (run)
{
    ESLevent * event = connection.recvEventTimed(sleeptime);


   ... event processing ...
}

This application handle an inbound call (legA), originate an outbound call (legB) and bridge the two calls.

The problem is present when the legA hangup the call: sometimes is received the content-type="text/disconnect-notice" (without receiving "CHANNEL_HANGUP") and the "recvEventTimed" exits with event=NULL.

In this case it's not possible to receive any event or send any other message to Freeswitch because the "connection.execute" fails.

In this situation, if I have originated (with '& park') an outbound call, this call remain in parked state and the application cannot hangup it.

What I'm doing wrong?