drachtio/drachtio-freeswitch-modules

Closing connection gracefully

Opened this issue · 0 comments

Hi Dave,

Seems like this part:

case AudioPipe::CONNECTION_CLOSED_GRACEFULLY:
                            tech_pvt->responseHandler(session, EVENT_WSS_CLOSED_GRACEFULLY, NULL);
                            tech_pvt->pAudioPipe = nullptr;
                            switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
                                              "connection closed gracefully\n");

is never reachable. If the connection is closed gracefully (by stopping the module on a selected channel), destroy_tech_pvt function is called before lws callback is called, causing the tech_pvt to become nullptr.

I'm not sure how to solve this problem other than calling responseHandler with EVENT_WSS_CLOSED_GRACEFULLY as soon as stop command is issued, even though it doesn't mean that connection is already closed (but should be).

Thanks in advance.