diff --git a/src/availableaccountmodel.cpp b/src/availableaccountmodel.cpp index e37a1fdb54b29afff45e5a9e545f6cec9fc27592..ce702a27fcbc6f32c66a466d04b8fa8a563c74e1 100644 --- a/src/availableaccountmodel.cpp +++ b/src/availableaccountmodel.cpp @@ -100,6 +100,26 @@ Account* AvailableAccountModel::currentDefaultAccount(ContactMethod* method) { Account* priorAccount = AvailableAccountModelPrivate::m_spPriorAccount; URI::SchemeType type = (!method) ? URI::SchemeType::NONE : method->uri().schemeType(); + + /* if the scheme type could not be strictly determinded, try using the + * protocol hint + */ + if (type == URI::SchemeType::NONE && method) { + switch (method->protocolHint()) { + case URI::ProtocolHint::SIP_OTHER: + case URI::ProtocolHint::SIP_HOST: + type = URI::SchemeType::SIP; + break; + case URI::ProtocolHint::IAX: + type = URI::SchemeType::IAX; + break; + case URI::ProtocolHint::IP: + break; + case URI::ProtocolHint::RING: + type = URI::SchemeType::RING; + break; + } + } if(priorAccount && priorAccount->registrationState() == Account::RegistrationState::READY && priorAccount->isEnabled() diff --git a/src/uri.h b/src/uri.h index 99c219e639f01c2086674ae9deba85aa84ac149e..b911ea3ed6a6aa9e78ecf825c9e69d744b5a8eda 100644 --- a/src/uri.h +++ b/src/uri.h @@ -120,7 +120,7 @@ public: enum class ProtocolHint { SIP_OTHER = 0, /*!< Anything non empty that doesn't fit in other categories */ IAX = 1, /*!< Start with "iax:" or "iax2:" */ - RING = 2, /*!< Start with "ring:" and has 45 ASCII characters */ + RING = 2, /*!< Start with "ring:" and 45 ASCII chars OR 40 ASCII chars */ IP = 3, /*!< Match an IPv4 address */ SIP_HOST = 4, /*!< Has an @ and no "ring:" prefix */ };