Skip to content
Snippets Groups Projects
Commit e87729b7 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

jamiaccount: fix multi-devices calls with cached connections

onConnectedOutgoingCall must be called after that every subCall is added. If
it's not the case, the new subcalls will not be added and will be removed.
So, every call created after onConnectedOutgoingCall will be immediately
deleted.

Change-Id: I0e6b394e9882bff552d3d5a35ebc3cdc07c49857
Gitlab: #209
parent 9d9a6b3d
No related branches found
No related tags found
No related merge requests found
......@@ -392,9 +392,11 @@ Call::addSubCall(Call& subcall)
{
std::lock_guard<std::recursive_mutex> lk {callMutex_};
// XXX: following check seems wobbly - need comment
// Add subCall only if call is not connected or terminated
// Because we only want to addSubCall if the peer didn't answer
// So till it's <= RINGING
if (connectionState_ == ConnectionState::CONNECTED
|| callState_ == CallState::ACTIVE
|| connectionState_ == ConnectionState::DISCONNECTED
|| callState_ == CallState::OVER) {
subcall.removeCall();
return;
......
......@@ -489,11 +489,18 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
continue;
}
if (!transport) continue;
call->setTransport(transport);
auto remote_addr = it.channel->underlyingICE()->getRemoteAddress(ICE_COMP_SIP_TRANSPORT);
onConnectedOutgoingCall(*call, toUri, remote_addr);
auto& manager = Manager::instance();
auto dev_call = manager.callFactory.newCall<SIPCall, JamiAccount>(*this, manager.getNewCallID(),
Call::CallType::OUTGOING,
call->getDetails());
dev_call->setIPToIP(true);
dev_call->setSecure(isTlsEnabled());
dev_call->setTransport(transport);
call->addSubCall(*dev_call);
auto remoted_address = it.channel->underlyingICE()->getRemoteAddress(ICE_COMP_SIP_TRANSPORT);
onConnectedOutgoingCall(*dev_call, toUri, remoted_address);
devices.emplace(deviceConnIt->first);
}
......@@ -632,6 +639,7 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
}
}
});
}
void
......@@ -734,6 +742,10 @@ JamiAccount::SIPStartCall(SIPCall& call, IpAddr target)
pjsip_tpselector tp_sel;
tp_sel.type = PJSIP_TPSELECTOR_TRANSPORT;
if (!call.getTransport()) {
JAMI_ERR("Could not get transport for this call");
return false;
}
tp_sel.u.transport = call.getTransport()->get();
if (pjsip_dlg_set_transport(dialog, &tp_sel) != PJ_SUCCESS) {
JAMI_ERR("Unable to associate transport for invite session dialog");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment