Commit e658638d authored by Alexandre Savard's avatar Alexandre Savard

#9898: Unregister account when leaving sflphone

parent c97a170d
......@@ -130,6 +130,8 @@ void ManagerImpl::terminate()
saveConfig();
unregisterAllAccounts();
SIPVoIPLink::destroy();
// Unload account map AFTER destroying
// the SIPVoIPLink, the link still needs the accounts for pjsip cleanup
......@@ -2598,6 +2600,11 @@ namespace {
}
}
void unregisterAccount(std::pair<const std::string, Account*> &item)
{
item.second->unregisterVoIPLink();
}
void unloadAccount(std::pair<const std::string, Account*> &item)
{
// avoid deleting IP2IP account twice
......@@ -2606,6 +2613,7 @@ namespace {
item.second = 0;
}
}
} // end anonymous namespace
void ManagerImpl::loadAccountMap(Conf::YamlParser &parser)
......@@ -2644,6 +2652,11 @@ void ManagerImpl::loadAccountMap(Conf::YamlParser &parser)
std::for_each(seq->begin(), seq->end(), bind(loadAccount, _1, ref(accountMap_)));
}
void ManagerImpl::unregisterAllAccounts()
{
std::for_each(accountMap_.begin(), accountMap_.end(), unregisterAccount);
}
void ManagerImpl::unloadAccountMap()
{
std::for_each(accountMap_.begin(), accountMap_.end(), unloadAccount);
......
......@@ -969,6 +969,11 @@ class ManagerImpl {
*Contains a list of account (sip, aix, etc) and their respective voiplink/calls */
AccountMap accountMap_;
/**
* Unregister all account in accountMap_
*/
void unregisterAllAccounts();
/**
* Load the account map from configuration
*/
......
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