M module-apps/application-call/ApplicationCall.cpp => module-apps/application-call/ApplicationCall.cpp +6 -0
@@ 224,6 224,12 @@ namespace app
LOG_WARN("Cannot call in %s state", c_str(state));
return;
}
+
+ if (DBServiceAPI::IsContactInEmergency(this, utils::PhoneNumber(number).getView())) {
+ CellularServiceAPI::DialNumber(this, utils::PhoneNumber(number));
+ return;
+ }
+
CellularServiceAPI::DialEmergencyNumber(this, utils::PhoneNumber(number));
}
M module-services/service-db/DBServiceAPI.cpp => module-services/service-db/DBServiceAPI.cpp +13 -0
@@ 125,6 125,19 @@ auto DBServiceAPI::IsContactInFavourites(sys::Service *serv, const utils::PhoneN
return contactResponse->contact != nullptr && contactResponse->contact->isOnFavourites();
}
+auto DBServiceAPI::IsContactInEmergency(sys::Service *serv, const utils::PhoneNumber::View &numberView) -> bool
+{
+ auto msg = std::make_shared<DBContactNumberMessage>(numberView);
+
+ auto ret = serv->bus.sendUnicastSync(std::move(msg), service::name::db, DefaultTimeoutInMs);
+ auto contactResponse = dynamic_cast<DBContactNumberResponseMessage *>(ret.second.get());
+ if (contactResponse == nullptr || contactResponse->retCode != sys::ReturnCodes::Success) {
+ LOG_ERROR("DB response error, return code: %s", c_str(ret.first));
+ return false;
+ }
+ return contactResponse->contact != nullptr && contactResponse->contact->isOnIce();
+}
+
auto DBServiceAPI::verifyContact(sys::Service *serv, const ContactRecord &rec)
-> DBServiceAPI::ContactVerificationResult
{
M module-services/service-db/include/service-db/DBServiceAPI.hpp => module-services/service-db/include/service-db/DBServiceAPI.hpp +1 -0
@@ 114,6 114,7 @@ class DBServiceAPI
static auto DBBackup(sys::Service *serv, std::string backupPath) -> bool;
static auto IsContactInFavourites(sys::Service *serv, const utils::PhoneNumber::View &numberView) -> bool;
+ static auto IsContactInEmergency(sys::Service *serv, const utils::PhoneNumber::View &numberView) -> bool;
/**
* @brief Add sms via DBService interface
*