Commit 347e4330 authored by alexandresavard's avatar alexandresavard
Browse files

Fix thread destructor

parent 98c95e44
......@@ -53,6 +53,7 @@ AudioRtp::~AudioRtp (void) {
int
AudioRtp::createNewSession (SIPCall *ca) {
ost::MutexLock m(_threadMutex);
// something should stop the thread before...
......@@ -87,6 +88,7 @@ AudioRtp::closeRtpSession () {
// This will make RTP threads finish.
// _debug("Stopping AudioRTP\n");
try {
delete _RTXThread; _RTXThread = 0;
} catch(...) {
_debugException("! ARTP Exception: when stopping audiortp\n");
......@@ -140,7 +142,7 @@ AudioRtpRTX::~AudioRtpRTX () {
_debugException("! ARTP: Thread destructor didn't terminate correctly");
throw;
}
//_debug("terminate audiortprtx ended...\n");
_debug("terminate audiortprtx ended...\n");
_ca = 0;
if (!_sym) {
delete _sessionRecv; _sessionRecv = NULL;
......@@ -148,7 +150,7 @@ AudioRtpRTX::~AudioRtpRTX () {
} else {
delete _session; _session = NULL;
}
delete [] micData; micData = NULL;
delete [] micDataConverted; micDataConverted = NULL;
delete [] micDataEncoded; micDataEncoded = NULL;
......@@ -159,6 +161,9 @@ AudioRtpRTX::~AudioRtpRTX () {
delete time; time = NULL;
delete converter; converter = NULL;
_debug("AudioRtpRTX::~AudioRtpRTX () : Deleting the call instance \n");
}
void
......
......@@ -210,6 +210,7 @@ SIPVoIPLink::terminate()
void
SIPVoIPLink::terminateSIPCall()
{
_debug("SIPVoIPLink::terminateSIPCall(): function called");
ost::MutexLock m(_callMapMutex);
CallMap::iterator iter = _callMap.begin();
SIPCall *call;
......@@ -477,7 +478,7 @@ SIPVoIPLink::hangup(const CallID& id)
return false;
call->getInvSession()->mod_data[getModId()] = NULL;
return true;
// Release RTP thread
if (Manager::instance().isCurrentCall(id)) {
......@@ -906,63 +907,63 @@ std::string SIPVoIPLink::getSipTo(const std::string& to_url, std::string hostnam
return true;
}
void
SIPVoIPLink::SIPCallServerFailure(SIPCall *call)
{
//if (!event->response) { return; }
//switch(event->response->status_code) {
//case SIP_SERVICE_UNAVAILABLE: // 500
//case SIP_BUSY_EVRYWHERE: // 600
//case SIP_DECLINE: // 603
//SIPCall* call = findSIPCallWithCid(event->cid);
if (call != 0) {
_debug("Server error!\n");
CallID id = call->getCallId();
Manager::instance().callFailure(id);
removeCall(id);
}
//break;
//}
}
void
SIPVoIPLink::SIPCallServerFailure(SIPCall *call)
{
//if (!event->response) { return; }
//switch(event->response->status_code) {
//case SIP_SERVICE_UNAVAILABLE: // 500
//case SIP_BUSY_EVRYWHERE: // 600
//case SIP_DECLINE: // 603
//SIPCall* call = findSIPCallWithCid(event->cid);
if (call != 0) {
_debug("Server error!\n");
CallID id = call->getCallId();
Manager::instance().callFailure(id);
removeCall(id);
}
//break;
//}
}
void
SIPVoIPLink::SIPCallClosed(SIPCall *call)
{
// it was without did before
//SIPCall* call = findSIPCallWithCid(event->cid);
if (!call) { return; }
void
SIPVoIPLink::SIPCallClosed(SIPCall *call)
{
// it was without did before
//SIPCall* call = findSIPCallWithCid(event->cid);
if (!call) { return; }
CallID id = call->getCallId();
//call->setDid(event->did);
if (Manager::instance().isCurrentCall(id)) {
call->setAudioStart(false);
_debug("* SIP Info: Stopping AudioRTP when closing\n");
_audiortp->closeRtpSession();
}
_debug("After close RTP\n");
Manager::instance().peerHungupCall(id);
removeCall(id);
_debug("After remove call ID\n");
}
CallID id = call->getCallId();
//call->setDid(event->did);
if (Manager::instance().isCurrentCall(id)) {
call->setAudioStart(false);
_debug("* SIP Info: Stopping AudioRTP when closing\n");
_audiortp->closeRtpSession();
}
_debug("After close RTP\n");
Manager::instance().peerHungupCall(id);
removeCall(id);
_debug("After remove call ID\n");
}
void
SIPVoIPLink::SIPCallReleased(SIPCall *call)
{
// do cleanup if exists
// only cid because did is always 0 in these case..
//SIPCall* call = findSIPCallWithCid(event->cid);
if (!call) { return; }
// if we are here.. something when wrong before...
_debug("SIP call release\n");
CallID id = call->getCallId();
Manager::instance().callFailure(id);
removeCall(id);
}
void
SIPVoIPLink::SIPCallReleased(SIPCall *call)
{
// do cleanup if exists
// only cid because did is always 0 in these case..
//SIPCall* call = findSIPCallWithCid(event->cid);
if (!call) { return; }
// if we are here.. something when wrong before...
_debug("SIP call release\n");
CallID id = call->getCallId();
Manager::instance().callFailure(id);
removeCall(id);
}
void
SIPVoIPLink::SIPCallAnswered(SIPCall *call, pjsip_rx_data *rdata)
{
void
SIPVoIPLink::SIPCallAnswered(SIPCall *call, pjsip_rx_data *rdata)
{
//SIPCall* call = dynamic_cast<SIPCall *>(theCall);//findSIPCallWithCid(event->cid);
if (!call) {
_debug("! SIP Failure: unknown call\n");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment