diff --git a/daemon/src/sip/sipvoiplink.cpp b/daemon/src/sip/sipvoiplink.cpp index cfe76ff816b8e458107e1dd981685a0bce023f65..34b3521090bc4af985a7b87a9e9a872730370fa7 100644 --- a/daemon/src/sip/sipvoiplink.cpp +++ b/daemon/src/sip/sipvoiplink.cpp @@ -732,17 +732,6 @@ bool SIPVoIPLink::getEvent() return handlingEvents_; } -std::vector<Call*> -SIPVoIPLink::getCalls(const std::string &account_id) const -{ - std::vector<Call*> calls; - for (const auto & item : sipCallMap_) { - if (item.second->getAccountId() == account_id) - calls.push_back(item.second); - } - return calls; -} - void SIPVoIPLink::sendRegister(Account& a) { @@ -1327,6 +1316,19 @@ SIPVoIPLink::getCallIDs() return v; } +std::vector<Call*> +SIPVoIPLink::getCalls(const std::string &account_id) const +{ + std::lock_guard<std::mutex> lock(sipCallMapMutex_); + + std::vector<Call*> calls; + for (const auto & item : sipCallMap_) { + if (item.second->getAccountId() == account_id) + calls.push_back(item.second); + } + return calls; +} + void SIPVoIPLink::addSipCall(SIPCall* call) { if (!call) diff --git a/daemon/src/sip/sipvoiplink.h b/daemon/src/sip/sipvoiplink.h index 895df50473d6b6aa80d459ad688a4b0dcb52d16a..fc0858f5999fca9d84296783610669d54c512779 100644 --- a/daemon/src/sip/sipvoiplink.h +++ b/daemon/src/sip/sipvoiplink.h @@ -313,7 +313,7 @@ class SIPVoIPLink : public VoIPLink { */ AccountMap sipAccountMap_; - std::mutex sipCallMapMutex_; + mutable std::mutex sipCallMapMutex_; SipCallMap sipCallMap_; /**