Commit 32e737fc authored by Ronan Abhamon's avatar Ronan Abhamon

fix(src/components/call/CallModel): use auto-answer only if one call exists

parent a0e92aff
...@@ -51,7 +51,7 @@ CallModel::CallModel (shared_ptr<linphone::Call> call) { ...@@ -51,7 +51,7 @@ CallModel::CallModel (shared_ptr<linphone::Call> call) {
timer->setSingleShot(true); timer->setSingleShot(true);
timer->setObjectName(AUTO_ANSWER_OBJECT_NAME); timer->setObjectName(AUTO_ANSWER_OBJECT_NAME);
QObject::connect(timer, &QTimer::timeout, this, &CallModel::accept); QObject::connect(timer, &QTimer::timeout, this, &CallModel::acceptWithAutoAnswerDelay);
timer->start(); timer->start();
} }
} }
...@@ -298,6 +298,19 @@ CallModel::CallStatus CallModel::getStatus () const { ...@@ -298,6 +298,19 @@ CallModel::CallStatus CallModel::getStatus () const {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void CallModel::acceptWithAutoAnswerDelay () {
// Use auto-answer if activated and it's the only call.
CoreManager *coreManager = CoreManager::getInstance();
if (coreManager->getSettingsModel()->getAutoAnswerStatus() && coreManager->getCore()->getCallsNb() == 1)
accept();
}
// -----------------------------------------------------------------------------
QString CallModel::getCallError () const {
return mCallError;
}
void CallModel::setCallErrorFromReason (linphone::Reason reason) { void CallModel::setCallErrorFromReason (linphone::Reason reason) {
switch (reason) { switch (reason) {
case linphone::ReasonDeclined: case linphone::ReasonDeclined:
...@@ -322,10 +335,6 @@ void CallModel::setCallErrorFromReason (linphone::Reason reason) { ...@@ -322,10 +335,6 @@ void CallModel::setCallErrorFromReason (linphone::Reason reason) {
emit callErrorChanged(mCallError); emit callErrorChanged(mCallError);
} }
QString CallModel::getCallError () const {
return mCallError;
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int CallModel::getDuration () const { int CallModel::getDuration () const {
......
...@@ -110,8 +110,10 @@ private: ...@@ -110,8 +110,10 @@ private:
return mCall->getDir() == linphone::CallDirOutgoing; return mCall->getDir() == linphone::CallDirOutgoing;
} }
void setCallErrorFromReason (linphone::Reason reason); void acceptWithAutoAnswerDelay ();
QString getCallError () const; QString getCallError () const;
void setCallErrorFromReason (linphone::Reason reason);
int getDuration () const; int getDuration () const;
float getQuality () const; float getQuality () const;
......
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