Skip to content
Snippets Groups Projects
Commit bc7b12cd authored by Sébastien Blin's avatar Sébastien Blin
Browse files

manager: fix double call at the same time

GitLab: #743
Change-Id: I5a0313f21aa2044bf9e20c96ed4f597cc9ca2859
parent 3bbec962
No related branches found
No related tags found
No related merge requests found
...@@ -2543,13 +2543,12 @@ Manager::ManagerPimpl::processIncomingCall(const std::string& accountId, Call& i ...@@ -2543,13 +2543,12 @@ Manager::ManagerPimpl::processIncomingCall(const std::string& accountId, Call& i
[this, incomCall = incomCall.shared_from_this()] { base_.answerCall(*incomCall); }); [this, incomCall = incomCall.shared_from_this()] { base_.answerCall(*incomCall); });
} else if (currentCall && currentCall->getCallId() != incomCallId) { } else if (currentCall && currentCall->getCallId() != incomCallId) {
// Test if already calling this person // Test if already calling this person
auto peerNumber = incomCall.getPeerNumber();
auto currentPeerNumber = currentCall->getPeerNumber();
string_replace(peerNumber, "@ring.dht", "");
string_replace(currentPeerNumber, "@ring.dht", "");
if (currentCall->getAccountId() == account->getAccountID() if (currentCall->getAccountId() == account->getAccountID()
&& currentCall->getPeerNumber() == incomCall.getPeerNumber()) { && currentPeerNumber == peerNumber) {
auto device_uid = account->getUsername();
if (device_uid.find("ring:") == 0) {
// NOTE: in case of a SIP call it's already ready to compare
device_uid = device_uid.substr(5); // after ring:
}
auto answerToCall = false; auto answerToCall = false;
auto downgradeToAudioOnly = currentCall->isAudioOnly() != incomCall.isAudioOnly(); auto downgradeToAudioOnly = currentCall->isAudioOnly() != incomCall.isAudioOnly();
if (downgradeToAudioOnly) if (downgradeToAudioOnly)
...@@ -2557,7 +2556,7 @@ Manager::ManagerPimpl::processIncomingCall(const std::string& accountId, Call& i ...@@ -2557,7 +2556,7 @@ Manager::ManagerPimpl::processIncomingCall(const std::string& accountId, Call& i
answerToCall = incomCall.isAudioOnly(); answerToCall = incomCall.isAudioOnly();
else else
// Accept the incoming call from the higher id number // Accept the incoming call from the higher id number
answerToCall = (device_uid.compare(incomCall.getPeerNumber()) < 0); answerToCall = (account->getUsername().compare(peerNumber) < 0);
if (answerToCall) { if (answerToCall) {
runOnMainThread([accountId = currentCall->getAccountId(), runOnMainThread([accountId = currentCall->getAccountId(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment