Skip to content
Snippets Groups Projects
Commit 71e409ac authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #14529: sip: move getAccountIdFrom... to sipvoiplink

Manager never uses it and it should only be needed by SIP anyway.
parent b5ac6305
Branches
Tags
No related merge requests found
......@@ -2768,23 +2768,6 @@ ManagerImpl::getAllAccounts() const
return all;
}
std::string
ManagerImpl::getAccountIdFromNameAndServer(const std::string &userName,
const std::string &server) const
{
DEBUG("username = %s, server = %s", userName.c_str(), server.c_str());
// Try to find the account id from username and server name by full match
AccountMap allAccounts(getAllAccounts());
for (AccountMap::const_iterator iter = allAccounts.begin(); iter != allAccounts.end(); ++iter) {
SIPAccount *account = static_cast<SIPAccount *>(iter->second);
if (account and account->matches(userName, server))
return iter->first;
}
DEBUG("Username %s or server %s doesn't match any account, using IP2IP", userName.c_str(), server.c_str());
return SIPAccount::IP2IP_PROFILE;
}
std::map<std::string, int32_t> ManagerImpl::getAddressbookSettings() const
{
......
......@@ -1104,8 +1104,6 @@ class ManagerImpl {
*/
VoIPLink* getAccountLink(const std::string& accountID);
std::string getAccountIdFromNameAndServer(const std::string& userName, const std::string& server) const;
std::string getStunServer() const;
void setStunServer(const std::string &server);
......
......@@ -217,7 +217,7 @@ pj_bool_t transaction_request_cb(pjsip_rx_data *rdata)
}
std::string userName(sip_to_uri->user.ptr, sip_to_uri->user.slen);
std::string server(sip_from_uri->host.ptr, sip_from_uri->host.slen);
std::string account_id(Manager::instance().getAccountIdFromNameAndServer(userName, server));
std::string account_id(SIPVoIPLink::instance()->getAccountIdFromNameAndServer(userName, server));
std::string displayName(sip_utils::parseDisplayName(rdata->msg_info.msg_buf));
......@@ -540,6 +540,23 @@ void SIPVoIPLink::destroy()
instance_ = 0;
}
std::string
SIPVoIPLink::getAccountIdFromNameAndServer(const std::string &userName,
const std::string &server) const
{
DEBUG("username = %s, server = %s", userName.c_str(), server.c_str());
// Try to find the account id from username and server name by full match
for (AccountMap::const_iterator iter = sipAccountMap_.begin(); iter != sipAccountMap_.end(); ++iter) {
SIPAccount *account = static_cast<SIPAccount*>(iter->second);
if (account and account->matches(userName, server))
return iter->first;
}
DEBUG("Username %s or server %s doesn't match any account, using IP2IP", userName.c_str(), server.c_str());
return SIPAccount::IP2IP_PROFILE;
}
void SIPVoIPLink::setSipLogLevel()
{
char *envvar = getenv(SIPLOGLEVEL);
......
......@@ -69,6 +69,7 @@ typedef std::map<std::string, SIPCall*> SipCallMap;
*/
class SIPVoIPLink : public VoIPLink {
public:
/**
......@@ -97,7 +98,8 @@ class SIPVoIPLink : public VoIPLink {
/**
* Return the internal account map for this VOIP link
*/
AccountMap &getAccounts() { return sipAccountMap_; }
AccountMap &
getAccounts() { return sipAccountMap_; }
/**
* Build and send SIP registration request
......@@ -288,6 +290,11 @@ class SIPVoIPLink : public VoIPLink {
#ifdef SFL_VIDEO
static void enqueueKeyframeRequest(const std::string &callID);
#endif
std::string
getAccountIdFromNameAndServer(const std::string &userName,
const std::string &server) const;
private:
NON_COPYABLE(SIPVoIPLink);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment