Commit 7ec9fa91 authored by Julien Wadel's avatar Julien Wadel
Browse files

Fix : on incoming call, do not start the ring tone if the call's state has...

Fix : on incoming call, do not start the ring tone if the call's state has been modified by listeners.
Add onStartRingtone to decide when to start ring
parent 4ceaef65
......@@ -627,7 +627,6 @@ void Call::onIncomingCallSessionStarted (const shared_ptr<CallSession> &session)
if (linphone_core_get_calls_nb(getCore()->getCCore()) == 1 && !isInConference()) {
void Call::onIncomingCallSessionTimeoutCheck (const shared_ptr<CallSession> &session, int elapsed, bool oneSecondElapsed) {
......@@ -747,6 +746,10 @@ void Call::onSnapshotTaken(const shared_ptr<CallSession> &session, const char *f
linphone_call_notify_snapshot_taken(this->toC(), file_path);
void Call::onStartRingtone(const shared_ptr<CallSession> &session){
// =============================================================================
Call::Call (
......@@ -260,7 +260,7 @@ public:
void onRealTimeTextCharacterReceived (const std::shared_ptr<CallSession> &session, RealtimeTextReceivedCharacter *character) override;
void onTmmbrReceived(const std::shared_ptr<CallSession> &session, int streamIndex, int tmmbr) override;
void onSnapshotTaken(const std::shared_ptr<CallSession> &session, const char *file_path) override;
void onStartRingtone(const std::shared_ptr<CallSession> &session) override;
LinphoneConference *getConference () const;
void reenterLocalConference(const std::shared_ptr<CallSession> &session);
......@@ -56,6 +56,7 @@ public:
virtual void onLossOfMediaDetected (const std::shared_ptr<CallSession> &session) {}
virtual void onTmmbrReceived (const std::shared_ptr<CallSession> &session, int streamIndex, int tmmbr) {}
virtual void onSnapshotTaken(const std::shared_ptr<CallSession> &session, const char *file_path) {}
virtual void onStartRingtone(const std::shared_ptr<CallSession> &session){}
virtual void onEncryptionChanged (const std::shared_ptr<CallSession> &session, bool activated, const std::string &authToken) {}
......@@ -184,10 +184,13 @@ void CallSessionPrivate::setTransferState (CallSession::State newState) {
void CallSessionPrivate::startIncomingNotification () {
bool_t tryStartRingtone = TRUE;// Try to start a tone if this notification is not a PushIncomingReceived and have listener
if (listener && state != CallSession::State::PushIncomingReceived)
listener->onIncomingCallSessionStarted(q->getSharedFromThis());// Can set current call to this sessions
tryStartRingtone = FALSE;
setState(CallSession::State::IncomingReceived, "Incoming call received");
setState(CallSession::State::IncomingReceived, "Incoming call received"); // Change state and notify listeners
// From now on, the application is aware of the call and supposed to take background task or already submitted
// notification to the user. We can then drop our background task.
......@@ -195,6 +198,8 @@ void CallSessionPrivate::startIncomingNotification () {
if (state == CallSession::State::IncomingReceived) {
if(tryStartRingtone)// The state is still in IncomingReceived state. Start ringing if it was needed
......@@ -1271,8 +1276,10 @@ void CallSession::startBasicIncomingNotification (bool notifyRinging) {
void CallSession::startPushIncomingNotification () {
if (d->listener)
if (d->listener){
d->setState(CallSession::State::PushIncomingReceived, "Push notification received");
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