Commit c2186cfc authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3304] Fix placeCallFirstAccount when no account order set

parent 4ffb9589
......@@ -52,15 +52,22 @@ CallManager::placeCallFirstAccount (const std::string& callID,
{
if (to == "") {
_warn("No number entered - Call stopped");
_warn("CallManager: Warning: No number entered, call stopped");
return;
}
std::vector< std::string > accountOrder = Manager::instance().loadAccountOrder();
std::vector< std::string >::iterator iter = accountOrder.begin();
std::vector< std::string >::iterator iter;
Account *account;
while(iter != accountOrder.end()) {
_debug("AccountOrder size: %d", accountOrder.size());
if(accountOrder.size() > 0) {
iter = accountOrder.begin();
while(iter != accountOrder.end()) {
account = Manager::instance().getAccount(*iter);
if((*iter != IP2IP_PROFILE) && account->isEnabled()) {
Manager::instance().outgoingCall (*iter, callID, to);
......@@ -68,9 +75,32 @@ CallManager::placeCallFirstAccount (const std::string& callID,
}
iter++;
}
}
_warn("No enabled account found - Call stopped\n");
else {
_error("AccountOrder is empty");
// If accountOrder is empty fallback on accountList (which has no preference order)
std::vector< std::string > accountList = Manager::instance().getAccountList();
iter = accountList.begin();
_error("AccountList size: %d", accountList.size());
if(accountList.size() > 0) {
while(iter != accountList.end()) {
_error("iter");
account = Manager::instance().getAccount(*iter);
if((*iter != IP2IP_PROFILE) && account->isEnabled()) {
_error("makecall");
Manager::instance().outgoingCall(*iter, callID, to);
return;
}
iter++;
}
}
}
_warn("CallManager: Warning: No enabled account found, call stopped");
}
......
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