Commit 72ee06ef authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2

call: fix audio tones generation

Ringing and busy tones have disappeared for an obscure reason.
This patch reverts this situation by asking manager to play
them at the right call state event.

Change-Id: Ida6c3c946df553811b7b88b8a64e6a347fa3dfa4
Reviewed-by: Andreas Traczyk's avatarAndreas Traczyk <andreas.traczyk@savoirfairelinux.com>
parent 3ceb9d73
......@@ -46,7 +46,10 @@ Call::Call(Account& account, const std::string& id, Call::CallType type)
{
addStateListener([this](UNUSED Call::CallState call_state,
UNUSED Call::ConnectionState cnx_state,
UNUSED int code) { checkPendingIM(); });
UNUSED int code) {
checkPendingIM();
checkAudio();
});
time(&timestamp_start_);
account_.attachCall(id_);
......@@ -499,4 +502,20 @@ Call::checkPendingIM()
}
}
/**
* Handle tones for RINGING and BUSY calls
*/
void
Call::checkAudio()
{
using namespace DRing::Call;
auto state = getStateStr();
if (state == StateEvent::RINGING) {
Manager::instance().peerRingingCall(*this);
} else if (state == StateEvent::BUSY) {
Manager::instance().callBusy(*this);
}
}
} // namespace ring
......@@ -371,6 +371,8 @@ class Call : public Recordable, public std::enable_shared_from_this<Call> {
void checkPendingIM();
void checkAudio();
/** Protect every attribute that can be changed by two threads */
mutable std::recursive_mutex callMutex_ {};
......
......@@ -721,7 +721,6 @@ void
SIPCall::onPeerRinging()
{
setState(ConnectionState::RINGING);
Manager::instance().peerRingingCall(*this);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment