From 047544d0ced98c400c7f0bbe70361e7de62880c3 Mon Sep 17 00:00:00 2001
From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
Date: Mon, 20 Apr 2015 11:50:36 -0400
Subject: [PATCH] lrc: fix how the default account is chosen

Also, do not allow RING accounts to make calls with
unidentified URI types (so that SIP or IP2IP is
always the fallback).

Refs #71348
---
 src/account.cpp   |  2 ++
 src/call.cpp      |  2 +-
 src/callmodel.cpp | 10 +---------
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/account.cpp b/src/account.cpp
index da2f5d27..3da484c7 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -938,6 +938,8 @@ bool Account::supportScheme( URI::SchemeType type )
 {
    switch(type) {
       case URI::SchemeType::NONE :
+         if (protocol() == Account::Protocol::RING)
+            return false;
          return true;
          break;
       case URI::SchemeType::SIP  :
diff --git a/src/call.cpp b/src/call.cpp
index b8a7cff1..4af8a02f 100644
--- a/src/call.cpp
+++ b/src/call.cpp
@@ -1334,7 +1334,7 @@ void CallPrivate::call()
    Q_ASSERT_IS_IN_PROGRESS
 
    CallManagerInterface& callManager = DBus::CallManager::instance();
-   qDebug() << "account = " << m_Account;
+   qDebug() << "account = " << m_Account << (m_Account? m_Account->alias() : "(no account)");
    if(!m_Account) {
       qDebug() << "Account is not set, taking the first registered.";
       m_Account = AvailableAccountModel::currentDefaultAccount(m_pDialNumber);
diff --git a/src/callmodel.cpp b/src/callmodel.cpp
index 1117d9e9..402c5e42 100644
--- a/src/callmodel.cpp
+++ b/src/callmodel.cpp
@@ -428,15 +428,7 @@ Call* CallModel::dialingCall(const QString& peerName, Account* account)
          return call;
    }
 
-   //No dialing call found, creating one
-   Account* acc = (account)?account:AvailableAccountModel::currentDefaultAccount();
-
-   if (!acc) {
-      qWarning() << "No account is available, cannot call" << QStringList(DBus::ConfigurationManager::instance().getAccountList());
-      return nullptr;
-   }
-
-   return d_ptr->addCall2(CallPrivate::buildDialingCall(peerName, acc));
+   return d_ptr->addCall2(CallPrivate::buildDialingCall(peerName, account));
 }  //dialingCall
 
 ///Create a new incoming call when the daemon is being called
-- 
GitLab