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

jamiaccount: do not stay on calling

If the request is sent by SIP, we should follow status of the call,
also when the SIP connection is closed, the callback for sending a
request will be called twice. Once for sending the request, the
second time to delete the dummy call.

Change-Id: I29e5f6d96b2b9fa240b7b120f88840c9256b6919
parent db43afc9
No related branches found
No related tags found
No related merge requests found
......@@ -548,6 +548,14 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
dev_call->setIPToIP(true);
dev_call->setSecure(isTlsEnabled());
dev_call->setState(Call::ConnectionState::TRYING);
call->addStateListener(
[w = weak(), deviceId](Call::CallState, Call::ConnectionState state, int) {
if (state != Call::ConnectionState::PROGRESSING
and state != Call::ConnectionState::TRYING) {
if (auto shared = w.lock())
shared->callConnectionClosed(deviceId, true);
}
});
call->addSubCall(*dev_call);
{
std::lock_guard<std::mutex> lk(pendingCallsMutex_);
......@@ -3519,8 +3527,14 @@ JamiAccount::callConnectionClosed(const DeviceId& deviceId, bool eraseDummy)
std::lock_guard<std::mutex> lk(onConnectionClosedMtx_);
auto it = onConnectionClosed_.find(deviceId);
if (it != onConnectionClosed_.end()) {
if (eraseDummy) {
cb = std::move(it->second);
onConnectionClosed_.erase(it);
} else {
// In this case a new subcall is created and the callback
// will be re-called once with eraseDummy = true
cb = it->second;
}
}
}
if (cb)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment