diff --git a/sflphone-common/src/audio/audiortp.cpp b/sflphone-common/src/audio/audiortp.cpp index 38345e86ddd8e3861c5f4c1930f6600ab57d1f92..80bca863bad8b2c84158a845332794ccf87ed89c 100644 --- a/sflphone-common/src/audio/audiortp.cpp +++ b/sflphone-common/src/audio/audiortp.cpp @@ -188,8 +188,9 @@ AudioRtpRTX::~AudioRtpRTX () throw; } - _debug("Unbind call id %s from all participants\n", _ca->getCallId().c_str()); + _debug("Remove audio stream for call id %s\n", _ca->getCallId().c_str()); _audiolayer->getMainBuffer()->unBindAll(_ca->getCallId()); + // Manager::instance().removeStream(_ca->getCallId()); _debug("DELETE print micData address %p\n", micData); delete [] micData; diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 1cf1e00dabaa8dbfc5cfdfc990a41bc28e6e2e78..2a312ea453169d3c43a95aca3c6cf63031ac4a26 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -389,9 +389,6 @@ ManagerImpl::hangupCall (const CallID& id) removeCallAccount (id); } - if(participToConference(id)) - removeParticipant(id); - _debug("ManagerImpl::hangupCall CURRENT CALL ID %s\n", getCurrentCallId().c_str()); switchCall (""); @@ -404,6 +401,11 @@ ManagerImpl::hangupCall (const CallID& id) if (pulselayer) pulselayer->restorePulseAppsVolume(); } + if(participToConference(id)) + { + removeParticipant(id); + } + return returnValue; } @@ -764,67 +766,69 @@ ManagerImpl::joinParticipant(const CallID& call_id1, const CallID& call_id2) if(iter == _conferencemap.end()) { - _debug("NO CONFERENCE YET, CREATE ONE\n"); - createConference(call_id1, call_id2); - - iter_details = call1_details.find("CALL_STATE"); - _debug(" call %s state: %s\n", call_id1.c_str(), iter_details->second.c_str()); - if (iter_details->second == "HOLD") - { - _debug(" OFFHOLD %s\n", call_id1.c_str()); - offHoldCall(call_id1); - } - else if(iter_details->second == "INCOMING") - { - _debug(" ANSWER %s\n", call_id1.c_str()); - answerCall(call_id1); - } - - iter_details = call2_details.find("CALL_STATE"); - _debug(" call %s state: %s\n", call_id2.c_str(), iter_details->second.c_str()); - if (iter_details->second == "HOLD") - { - _debug(" OFFHOLD %s\n", call_id2.c_str()); - offHoldCall (call_id2); - } - else if(iter_details->second == "INCOMING") - { - _debug(" ANSWER %s\n", call_id2.c_str()); - answerCall(call_id2); - } + _debug("NO CONFERENCE YET, CREATE ONE\n"); + createConference(call_id1, call_id2); + + iter_details = call1_details.find("CALL_STATE"); + _debug(" call %s state: %s\n", call_id1.c_str(), iter_details->second.c_str()); + if (iter_details->second == "HOLD") + { + _debug(" OFFHOLD %s\n", call_id1.c_str()); + offHoldCall(call_id1); + } + else if(iter_details->second == "INCOMING") + { + _debug(" ANSWER %s\n", call_id1.c_str()); + answerCall(call_id1); + } + + iter_details = call2_details.find("CALL_STATE"); + _debug(" call %s state: %s\n", call_id2.c_str(), iter_details->second.c_str()); + if (iter_details->second == "HOLD") + { + _debug(" OFFHOLD %s\n", call_id2.c_str()); + offHoldCall (call_id2); + } + else if(iter_details->second == "INCOMING") + { + _debug(" ANSWER %s\n", call_id2.c_str()); + answerCall(call_id2); + } } else { - _debug("ALREADY A CONFERENCE CREATED, ADD PARTICIPANT TO IT\n"); - Conference* conf = iter->second; - - iter_details = call1_details.find("CALL_STATE"); - if(iter_details->second == "HOLD") - { - - } - else if(iter_details->second == "INCOMING") - { - - } - - iter_details = call2_details.find("CALL_STATE"); - if(iter_details->second == "HOLD") - { - - } - else if(iter_details->second == "INCOMING") - { - - } - // conf->add(call_id); - // _conferencecall.insert(pair<CallID, Conference*>(call_id, conf)); - - // answerCall(call_id); - } + _debug("ALREADY A CONFERENCE CREATED, ADD PARTICIPANT TO IT\n"); + Conference* conf = iter->second; + conf->add(call_id1); + _conferencecall.insert(pair<CallID, Conference*>(call_id1, conf)); + + iter_details = call1_details.find("CALL_STATE"); + if(iter_details->second == "HOLD") + { + _debug(" Add INCOMING call to conference\n"); + offHoldCall (call_id1); + } + else if(iter_details->second == "INCOMING") + { + _debug(" Add INCOMING call to conference\n"); + answerCall(call_id1); + } + + /* + iter_details = call2_details.find("CALL_STATE"); + if(iter_details->second == "HOLD") + { + + } + else if(iter_details->second == "INCOMING") + { + + } + */ + } } @@ -845,7 +849,7 @@ ManagerImpl::detachParticipant(const CallID& call_id) else { _debug("ALREADY A CONFERENCE CREATED, ADD PARTICIPANT TO IT\n"); - Conference* conf = iter->second; + // Conference* conf = iter->second; // conf->remove(call_id); @@ -906,6 +910,20 @@ ManagerImpl::addStream(const CallID& call_id) } } +void +ManagerImpl::removeStream(const CallID& call_id) +{ + _debug("ManagerImpl::removeStream %s\n", call_id.c_str()); + + getAudioDriver()->getMainBuffer()->unBindAll(call_id); + + if(participToConference(call_id)) + { + removeParticipant(call_id); + } + +} + //THREAD=Main bool ManagerImpl::saveConfig (void) @@ -1213,9 +1231,6 @@ ManagerImpl::peerHungupCall (const CallID& id) AccountID accountid; bool returnValue; - if(participToConference(id)) - removeParticipant(id); - switchCall(id); /* Direct IP to IP call */ @@ -1254,6 +1269,11 @@ ManagerImpl::peerHungupCall (const CallID& id) if (pulselayer) pulselayer->restorePulseAppsVolume(); } + + if(participToConference(id)) + { + removeParticipant(id); + } } //THREAD=VoIP diff --git a/sflphone-common/src/managerimpl.h b/sflphone-common/src/managerimpl.h index ef0e27274882bda37bbd77047e167d72bcb8ccac..37e162f14c5129c5d63ec759973e1d1f0a111505 100644 --- a/sflphone-common/src/managerimpl.h +++ b/sflphone-common/src/managerimpl.h @@ -204,6 +204,8 @@ class ManagerImpl { void addStream(const CallID& call_id); + void removeStream(const CallID& call_id); + /** * Save config to file * @return true on success