- clang format + naming improved
This commit is contained in:
@@ -15,49 +15,46 @@
|
||||
#define CONFIG(X) mConfig->at(X)
|
||||
#define CONFIG_EXISTS(X) mConfig->exists(X)
|
||||
|
||||
//#define MODIFY_VIA_BEHIND_NAT
|
||||
// #define MODIFY_VIA_BEHIND_NAT
|
||||
|
||||
// NAT decorator
|
||||
class NATDecorator: public resip::MessageDecorator
|
||||
class NATDecorator : public resip::MessageDecorator
|
||||
{
|
||||
protected:
|
||||
UserAgent& mUserAgent;
|
||||
UserAgent& mUserAgent;
|
||||
resip::SipMessage mMessage;
|
||||
|
||||
resip::Data mViaHost;
|
||||
unsigned short mViaPort;
|
||||
resip::Data mViaHost;
|
||||
unsigned short mViaPort;
|
||||
|
||||
resip::Data mContactsHost;
|
||||
resip::Data mContactsScheme;
|
||||
unsigned short mContactsPort;
|
||||
resip::Data mContactsHost;
|
||||
resip::Data mContactsScheme;
|
||||
unsigned short mContactsPort;
|
||||
|
||||
public:
|
||||
NATDecorator(UserAgent& endpoint);
|
||||
virtual ~NATDecorator();
|
||||
|
||||
virtual void decorateMessage(resip::SipMessage &msg, const resip::Tuple &source, const resip::Tuple &destination, const resip::Data& sigcompId);
|
||||
virtual void rollbackMessage(resip::SipMessage& msg);
|
||||
virtual void decorateMessage(resip::SipMessage& msg, const resip::Tuple& source, const resip::Tuple& destination,
|
||||
const resip::Data& sigcompId);
|
||||
virtual void rollbackMessage(resip::SipMessage& msg);
|
||||
virtual MessageDecorator* clone() const;
|
||||
};
|
||||
|
||||
|
||||
NATDecorator::NATDecorator(UserAgent& ua)
|
||||
:mUserAgent(ua), mViaPort(0), mContactsPort(0)
|
||||
{
|
||||
}
|
||||
NATDecorator::NATDecorator(UserAgent& ua) : mUserAgent(ua), mViaPort(0), mContactsPort(0) {}
|
||||
|
||||
NATDecorator::~NATDecorator()
|
||||
{
|
||||
}
|
||||
NATDecorator::~NATDecorator() {}
|
||||
|
||||
void NATDecorator::decorateMessage(resip::SipMessage &msg, const resip::Tuple &source, const resip::Tuple &destination, const resip::Data& sigcompId)
|
||||
void NATDecorator::decorateMessage(resip::SipMessage& msg, const resip::Tuple& source, const resip::Tuple& destination,
|
||||
const resip::Data& sigcompId)
|
||||
{
|
||||
// Make a copy to allow rollback
|
||||
mMessage = msg;
|
||||
|
||||
std::stringstream dump;
|
||||
mMessage.encode(dump);
|
||||
//ICELogDebug(<< "Decorating message: \n" << dump.str());
|
||||
// ICELogDebug(<< "Decorating message: \n" << dump.str());
|
||||
|
||||
// Check From: header and find the account
|
||||
resip::NameAddr from;
|
||||
@@ -101,11 +98,11 @@ void NATDecorator::decorateMessage(resip::SipMessage &msg, const resip::Tuple &s
|
||||
uri.port() = account->mExternalAddress.port();
|
||||
if (account->mConfig->at(CONFIG_SIPS).asBool())
|
||||
{
|
||||
//uri.scheme() = "sips";
|
||||
//uri.param(resip::p_transport) = "tls";
|
||||
// uri.scheme() = "sips";
|
||||
// uri.param(resip::p_transport) = "tls";
|
||||
}
|
||||
|
||||
//uri.scheme() = account->mConfig->at(CONFIG_SIPS).asBool() ? "sips" : "sip";
|
||||
// uri.scheme() = account->mConfig->at(CONFIG_SIPS).asBool() ? "sips" : "sip";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,7 +111,7 @@ void NATDecorator::rollbackMessage(resip::SipMessage& msg)
|
||||
{
|
||||
// Check From: header and find the account
|
||||
resip::NameAddr from = msg.header(resip::h_From);
|
||||
PAccount account = mUserAgent.getAccount(from);
|
||||
PAccount account = mUserAgent.getAccount(from);
|
||||
if (!account)
|
||||
return;
|
||||
|
||||
@@ -141,7 +138,7 @@ void NATDecorator::rollbackMessage(resip::SipMessage& msg)
|
||||
{
|
||||
uri.host() = mContactsHost;
|
||||
uri.port() = mContactsPort;
|
||||
//uri.scheme() = mContactsScheme;
|
||||
// uri.scheme() = mContactsScheme;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,19 +150,16 @@ resip::MessageDecorator* NATDecorator::clone() const
|
||||
}
|
||||
|
||||
Account::Account(PVariantMap config, UserAgent& agent)
|
||||
:mAgent(agent), mId(0), mConfig(config), mRegistrationState(RegistrationState::None),
|
||||
mRegistration(NULL)
|
||||
: mAgent(agent), mId(0), mConfig(config), mRegistrationState(RegistrationState::None), mRegistration(NULL)
|
||||
{
|
||||
mProfile = std::make_shared<resip::UserProfile>(agent.mProfile);
|
||||
mId = Account::generateId();
|
||||
setup(*config);
|
||||
}
|
||||
|
||||
Account::~Account()
|
||||
{
|
||||
}
|
||||
Account::~Account() {}
|
||||
|
||||
void Account::setup(VariantMap &config)
|
||||
void Account::setup(VariantMap& config)
|
||||
{
|
||||
// Credentials
|
||||
|
||||
@@ -176,8 +170,8 @@ void Account::setup(VariantMap &config)
|
||||
mProfile->setDigestCredential(resip::Data(config[CONFIG_DOMAIN].asStdString()),
|
||||
resip::Data(config[CONFIG_USERNAME].asStdString()),
|
||||
resip::Data(config[CONFIG_PASSWORD].asStdString()));
|
||||
ICELogInfo( << "Credentials are set to domain " << config[CONFIG_DOMAIN].asStdString() <<
|
||||
", username to " << config[CONFIG_USERNAME].asStdString());
|
||||
ICELogInfo(<< "Credentials are set to domain " << config[CONFIG_DOMAIN].asStdString() << ", username to "
|
||||
<< config[CONFIG_USERNAME].asStdString());
|
||||
|
||||
// Proxy
|
||||
mProfile->unsetOutboundProxy();
|
||||
@@ -234,7 +228,7 @@ void Account::setup(VariantMap &config)
|
||||
if (config[CONFIG_DOMAINPORT].asInt() != 0)
|
||||
from.uri().port() = config[CONFIG_DOMAINPORT].asInt();
|
||||
else
|
||||
from.uri().port();// = 5060;
|
||||
from.uri().port(); // = 5060;
|
||||
|
||||
from.uri().user() = resip::Data(config[CONFIG_USERNAME].asStdString());
|
||||
from.uri().host() = resip::Data(config[CONFIG_DOMAIN].asStdString());
|
||||
@@ -266,10 +260,12 @@ void Account::start()
|
||||
|
||||
// Create registration
|
||||
mRegistration = new ResipSession(*mAgent.mDum);
|
||||
auto regmessage = mAgent.mDum->makeRegistration(mProfile->getDefaultFrom(), mProfile, mConfig->at(CONFIG_REGISTERDURATION).asInt(), mRegistration);
|
||||
auto regmessage = mAgent.mDum->makeRegistration(mProfile->getDefaultFrom(), mProfile,
|
||||
mConfig->at(CONFIG_REGISTERDURATION).asInt(), mRegistration);
|
||||
|
||||
for (UserInfo::const_iterator iter = mUserInfo.begin(); iter != mUserInfo.end(); iter++)
|
||||
regmessage->header(resip::ExtensionHeader(iter->first.c_str())).push_back(resip::StringCategory(iter->second.c_str()));
|
||||
regmessage->header(resip::ExtensionHeader(iter->first.c_str()))
|
||||
.push_back(resip::StringCategory(iter->second.c_str()));
|
||||
|
||||
mRegistrationState = RegistrationState::Registering;
|
||||
|
||||
@@ -278,10 +274,10 @@ void Account::start()
|
||||
|
||||
// Check if STUN IP is required
|
||||
bool noStunServerIp = !CONFIG_EXISTS(CONFIG_STUNSERVER_IP);
|
||||
//bool hasStunServerName = !CONFIG(CONFIG_STUNSERVER_NAME).asStdString().empty();
|
||||
// bool hasStunServerName = !CONFIG(CONFIG_STUNSERVER_NAME).asStdString().empty();
|
||||
if (noStunServerIp)
|
||||
{
|
||||
ICELogInfo(<<"No STUN server name or IP is not specified. Has to resolve/discover STUN server IP.");
|
||||
ICELogInfo(<< "No STUN server name or IP is not specified. Has to resolve/discover STUN server IP.");
|
||||
mRefreshStunServerIpTimer.start(CONFIG(CONFIG_DNS_CACHE_TIME).asInt() * 1000);
|
||||
mRefreshStunServerIpTimer.isTimeToSend();
|
||||
queryStunServerIp();
|
||||
@@ -305,11 +301,10 @@ void Account::stop()
|
||||
mRegistrationHandle->removeAll();
|
||||
mRegistrationHandle = resip::ClientRegistrationHandle();
|
||||
}
|
||||
else
|
||||
if (mRegistration)
|
||||
{
|
||||
mRegistration->end();
|
||||
}
|
||||
else if (mRegistration)
|
||||
{
|
||||
mRegistration->end();
|
||||
}
|
||||
mRegistration = NULL;
|
||||
mRegistrationState = RegistrationState::None;
|
||||
}
|
||||
@@ -361,7 +356,8 @@ void Account::publishPresence(bool online, const std::string& content, int secon
|
||||
if (mPublication.isValid())
|
||||
mPublication->update(&p);
|
||||
else
|
||||
mAgent.mDum->send(mAgent.mDum->makePublication(contact(SecureScheme::TlsOnly), mProfile, p, resip::Symbols::Presence, seconds));
|
||||
mAgent.mDum->send(mAgent.mDum->makePublication(contact(SecureScheme::TlsOnly), mProfile, p,
|
||||
resip::Symbols::Presence, seconds));
|
||||
}
|
||||
|
||||
void Account::stopPublish()
|
||||
@@ -381,14 +377,14 @@ PClientObserver Account::observe(const std::string& target, const std::string& p
|
||||
observer->mPeer = target;
|
||||
|
||||
std::shared_ptr<resip::SipMessage> msg;
|
||||
int expires = DEFAULT_SUBSCRIPTION_TIME, refresh = DEFAULT_SUBSCRIPTION_REFRESHTIME;
|
||||
int expires = DEFAULT_SUBSCRIPTION_TIME, refresh = DEFAULT_SUBSCRIPTION_REFRESHTIME;
|
||||
if (mConfig->exists(CONFIG_SUBSCRIPTION_TIME))
|
||||
expires = CONFIG(CONFIG_SUBSCRIPTION_TIME).asInt();
|
||||
if (mConfig->exists(CONFIG_SUBSCRIPTION_REFRESHTIME))
|
||||
refresh = CONFIG(CONFIG_SUBSCRIPTION_REFRESHTIME).asInt();
|
||||
|
||||
msg = mAgent.mDum->makeSubscription(resip::NameAddr(resip::Data(target)), mProfile,
|
||||
resip::Data(package), expires, refresh, observer->mSession);
|
||||
msg = mAgent.mDum->makeSubscription(resip::NameAddr(resip::Data(target)), mProfile, resip::Data(package), expires,
|
||||
refresh, observer->mSession);
|
||||
msg->header(resip::h_Accepts) = mAgent.mDum->getMasterProfile()->getSupportedMimeTypes(resip::NOTIFY);
|
||||
|
||||
mAgent.mClientObserverMap[observer->mSessionId] = observer;
|
||||
@@ -406,15 +402,17 @@ int Account::sendMsg(const std::string& peer, const void* ptr, unsigned length,
|
||||
s->setRemoteAddress(peer);
|
||||
|
||||
// Find MIME type
|
||||
resip::Mime type;
|
||||
resip::Mime type;
|
||||
std::string::size_type p = mime.find('/');
|
||||
if (p != std::string::npos)
|
||||
type = resip::Mime(resip::Data(mime.substr(0, p)), resip::Data(mime.substr(p+1)));
|
||||
type = resip::Mime(resip::Data(mime.substr(0, p)), resip::Data(mime.substr(p + 1)));
|
||||
else
|
||||
type = resip::Mime(resip::Data(mime), resip::Data());
|
||||
|
||||
resip::ClientPagerMessageHandle msgHandle = mAgent.mDum->makePagerMessage(resip::NameAddr(resip::Data(peer)), mProfile, s);
|
||||
unique_ptr<resip::Contents> contentPtr(new resip::PlainContents(resip::Data(std::string((const char*)ptr, length)),type));
|
||||
resip::ClientPagerMessageHandle msgHandle =
|
||||
mAgent.mDum->makePagerMessage(resip::NameAddr(resip::Data(peer)), mProfile, s);
|
||||
unique_ptr<resip::Contents> contentPtr(
|
||||
new resip::PlainContents(resip::Data(std::string((const char*)ptr, length)), type));
|
||||
int result = s->sessionId();
|
||||
msgHandle->page(std::move(contentPtr));
|
||||
|
||||
@@ -451,12 +449,13 @@ resip::NameAddr Account::contact(SecureScheme ss)
|
||||
|
||||
void Account::queryStunServerIp()
|
||||
{
|
||||
ICELogInfo(<<"Looking for STUN/TURN server IP");
|
||||
ICELogInfo(<< "Looking for STUN/TURN server IP");
|
||||
|
||||
if (!mConfig->exists(CONFIG_STUNSERVER_NAME))
|
||||
{
|
||||
// Send request to find STUN or TURN service
|
||||
std::string target = std::string(mConfig->at(CONFIG_RELAY).asBool() ? "_turn" : "_stun") + "._udp." + mConfig->at(CONFIG_DOMAIN).asStdString();
|
||||
std::string target = std::string(mConfig->at(CONFIG_RELAY).asBool() ? "_turn" : "_stun") + "._udp." +
|
||||
mConfig->at(CONFIG_DOMAIN).asStdString();
|
||||
|
||||
// Start lookup
|
||||
mAgent.mStack->getDnsStub().lookup<resip::RR_SRV>(resip::Data(target), this);
|
||||
@@ -475,9 +474,9 @@ void Account::queryStunServerIp()
|
||||
}
|
||||
}
|
||||
|
||||
void Account::prepareIceStack(Session *session, ice::AgentRole icerole)
|
||||
void Account::prepareIceStack(Session* session, ice::AgentRole icerole)
|
||||
{
|
||||
ice::ServerConfig config;
|
||||
ice::ServerConfig config;
|
||||
ice::NetworkAddress addr;
|
||||
addr.setIp(mConfig->at(CONFIG_STUNSERVER_IP).asStdString());
|
||||
if (mConfig->at(CONFIG_STUNSERVER_PORT).asInt())
|
||||
@@ -495,8 +494,8 @@ void Account::prepareIceStack(Session *session, ice::AgentRole icerole)
|
||||
|
||||
config.mUseIPv4 = mAgent.config()[CONFIG_IPV4].asBool();
|
||||
config.mUseIPv6 = mAgent.config()[CONFIG_IPV6].asBool();
|
||||
//config.mDetectNetworkChange = true;
|
||||
//config.mNetworkCheckInterval = 5000;
|
||||
// config.mDetectNetworkChange = true;
|
||||
// config.mNetworkCheckInterval = 5000;
|
||||
|
||||
session->mIceStack = std::shared_ptr<ice::Stack>(ice::Stack::makeICEBox(config));
|
||||
session->mIceStack->setEventHandler(session, this);
|
||||
@@ -509,7 +508,7 @@ void Account::process()
|
||||
queryStunServerIp();
|
||||
}
|
||||
|
||||
void Account::onSuccess(resip::ClientRegistrationHandle h, const resip::SipMessage &response)
|
||||
void Account::onSuccess(resip::ClientRegistrationHandle h, const resip::SipMessage& response)
|
||||
{
|
||||
// Save registration handle
|
||||
mRegistrationHandle = h;
|
||||
@@ -519,16 +518,16 @@ void Account::onSuccess(resip::ClientRegistrationHandle h, const resip::SipMessa
|
||||
mRegistrationHandle->setCustomHeader(resip::Data(iter->first.c_str()), resip::Data(iter->second.c_str()));
|
||||
|
||||
// Get the Via
|
||||
const resip::Via& via = response.header(resip::h_Vias).front();
|
||||
const resip::Via& via = response.header(resip::h_Vias).front();
|
||||
|
||||
// Get the sent host
|
||||
const resip::Data& sentHost = via.sentHost();//response.header(h_Contacts).front().uri().host();
|
||||
const resip::Data& sentHost = via.sentHost(); // response.header(h_Contacts).front().uri().host();
|
||||
|
||||
// Get the sentPort
|
||||
int sentPort = via.sentPort();
|
||||
int sentPort = via.sentPort();
|
||||
|
||||
const resip::Data& sourceHost = response.getSource().toData(resip::UDP);
|
||||
int rport = 0;
|
||||
int rport = 0;
|
||||
if (via.exists(resip::p_rport))
|
||||
rport = via.param(resip::p_rport).port();
|
||||
|
||||
@@ -553,13 +552,14 @@ void Account::onSuccess(resip::ClientRegistrationHandle h, const resip::SipMessa
|
||||
}
|
||||
|
||||
mUsedTransport = response.getReceivedTransportTuple().getType();
|
||||
//bool streamTransport = mUsedTransport == resip::TCP || mUsedTransport == resip::TLS;
|
||||
// bool streamTransport = mUsedTransport == resip::TCP || mUsedTransport == resip::TLS;
|
||||
|
||||
// Retry registration for stream based transport too
|
||||
if ( (hostChanged || portChanged) && mRegistrationState == RegistrationState::Registering /*&& !streamTransport*/ && mConfig->at(CONFIG_EXTERNALIP).asBool())
|
||||
if ((hostChanged || portChanged) && mRegistrationState == RegistrationState::Registering /*&& !streamTransport*/ &&
|
||||
mConfig->at(CONFIG_EXTERNALIP).asBool())
|
||||
{
|
||||
//mRegistrationHandle->requestRefresh();
|
||||
// Unregister at first
|
||||
// mRegistrationHandle->requestRefresh();
|
||||
// Unregister at first
|
||||
mRegistrationHandle->removeAll();
|
||||
mRegistrationState = RegistrationState::Reregistering;
|
||||
return;
|
||||
@@ -570,12 +570,12 @@ void Account::onSuccess(resip::ClientRegistrationHandle h, const resip::SipMessa
|
||||
mAgent.onAccountStart(mAgent.getAccount(this));
|
||||
}
|
||||
|
||||
void Account::onRemoved(resip::ClientRegistrationHandle h, const resip::SipMessage &response)
|
||||
void Account::onRemoved(resip::ClientRegistrationHandle h, const resip::SipMessage& response)
|
||||
{
|
||||
// Check if this unregistering is a part of rport pr
|
||||
if (mRegistrationState == RegistrationState::Reregistering)
|
||||
{
|
||||
//if (/*this->mUseExternalIP && */response.getSource().getType() == resip::UDP)
|
||||
// if (/*this->mUseExternalIP && */response.getSource().getType() == resip::UDP)
|
||||
{
|
||||
resip::Uri hostport(contact(SecureScheme::TlsOnly).uri());
|
||||
hostport.host() = resip::Data(mExternalAddress.ip());
|
||||
@@ -585,19 +585,24 @@ void Account::onRemoved(resip::ClientRegistrationHandle h, const resip::SipMessa
|
||||
const char* transportName = nullptr;
|
||||
switch (mUsedTransport)
|
||||
{
|
||||
case resip::TCP: transportName = "tcp"; break;
|
||||
case resip::TLS: transportName = "tls"; break;
|
||||
case resip::TCP:
|
||||
transportName = "tcp";
|
||||
break;
|
||||
case resip::TLS:
|
||||
transportName = "tls";
|
||||
break;
|
||||
}
|
||||
|
||||
hostport.param(resip::p_transport) = resip::Data(transportName);
|
||||
}
|
||||
mProfile->setOverrideHostAndPort(hostport);
|
||||
//mProfile->setDefaultFrom(from);
|
||||
// mProfile->setDefaultFrom(from);
|
||||
}
|
||||
mProfile->setRegId(mConfig->at(CONFIG_REGID).asInt());
|
||||
auto regmessage = mAgent.mDum->makeRegistration(mProfile->getDefaultFrom(), mProfile, UA_REGISTRATION_TIME);
|
||||
for (UserInfo::const_iterator iter = mUserInfo.begin(); iter != mUserInfo.end(); iter++)
|
||||
regmessage->header(resip::ExtensionHeader(iter->first.c_str())).push_back(resip::StringCategory(iter->second.c_str()));
|
||||
regmessage->header(resip::ExtensionHeader(iter->first.c_str()))
|
||||
.push_back(resip::StringCategory(iter->second.c_str()));
|
||||
|
||||
mAgent.mDum->send(regmessage);
|
||||
return;
|
||||
@@ -625,16 +630,17 @@ void Account::onDnsResult(const resip::DNSResult<resip::DnsHostRecord>& result)
|
||||
if (result.status == 0)
|
||||
{
|
||||
resip::Data foundAddress = result.records.front().host();
|
||||
ICELogInfo( << "Success to resolve STUN/TURN address to " << foundAddress.c_str());
|
||||
ICELogInfo(<< "Success to resolve STUN/TURN address to " << foundAddress.c_str());
|
||||
mConfig->at(CONFIG_STUNSERVER_IP) = std::string(foundAddress.c_str());
|
||||
|
||||
// Here the IP address of STUN/TURN server is found. If account is registered already - it means account is ready.
|
||||
// Here the IP address of STUN/TURN server is found. If account is registered already - it means account is
|
||||
// ready.
|
||||
if (mRegistrationState == RegistrationState::Registered)
|
||||
mAgent.onAccountStart(mAgent.getAccount(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
ICELogError( << "Failed to resolve STUN or TURN server IP address.");
|
||||
ICELogError(<< "Failed to resolve STUN or TURN server IP address.");
|
||||
if (mRegistrationState == RegistrationState::Registered)
|
||||
{
|
||||
int startCode = mConfig->at(CONFIG_STUNSERVER_NAME).asStdString().empty() ? 0 : 503;
|
||||
@@ -643,10 +649,7 @@ void Account::onDnsResult(const resip::DNSResult<resip::DnsHostRecord>& result)
|
||||
}
|
||||
}
|
||||
|
||||
void Account::onDnsResult(const resip::DNSResult<resip::DnsAAAARecord>&)
|
||||
{
|
||||
|
||||
}
|
||||
void Account::onDnsResult(const resip::DNSResult<resip::DnsAAAARecord>&) {}
|
||||
|
||||
void Account::onDnsResult(const resip::DNSResult<resip::DnsSrvRecord>& result)
|
||||
{
|
||||
@@ -654,14 +657,14 @@ void Account::onDnsResult(const resip::DNSResult<resip::DnsSrvRecord>& result)
|
||||
{
|
||||
// Find lowest priority
|
||||
int priority = 0x7FFFFFFF;
|
||||
for (size_t i=0; i<result.records.size(); i++)
|
||||
for (size_t i = 0; i < result.records.size(); i++)
|
||||
if (result.records[i].priority() < priority)
|
||||
priority = result.records[i].priority();
|
||||
|
||||
size_t index = 0;
|
||||
int weight = 0;
|
||||
int weight = 0;
|
||||
|
||||
for (size_t i=0; i<result.records.size(); i++)
|
||||
for (size_t i = 0; i < result.records.size(); i++)
|
||||
{
|
||||
if (result.records[i].priority() == priority && result.records[i].weight() >= weight)
|
||||
{
|
||||
@@ -674,15 +677,15 @@ void Account::onDnsResult(const resip::DNSResult<resip::DnsSrvRecord>& result)
|
||||
|
||||
const char* host = result.records[index].target().c_str();
|
||||
|
||||
ICELogInfo( << "Success to find STUN/TURN server on " << result.records[index].target().c_str() <<
|
||||
":" << (int)result.records[index].port());
|
||||
ICELogInfo(<< "Success to find STUN/TURN server on " << result.records[index].target().c_str() << ":"
|
||||
<< (int)result.records[index].port());
|
||||
|
||||
|
||||
if (inet_addr(host) == INADDR_NONE)
|
||||
{
|
||||
// Try to resolve domain name now
|
||||
mAgent.mStack->getDnsStub().lookup<resip::RR_A>(result.records[index].target(), this);
|
||||
//mStack->getDnsStub().lookup<resip::RR_AAAA>(result.records[index].target(), this);
|
||||
// mStack->getDnsStub().lookup<resip::RR_AAAA>(result.records[index].target(), this);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -691,27 +694,20 @@ void Account::onDnsResult(const resip::DNSResult<resip::DnsSrvRecord>& result)
|
||||
}
|
||||
else
|
||||
{
|
||||
ICELogError( << "Failed to find STUN or TURN service for specified domain.");
|
||||
//mAgent::shutdown();
|
||||
ICELogError(<< "Failed to find STUN or TURN service for specified domain.");
|
||||
// mAgent::shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Account::onDnsResult(const resip::DNSResult<resip::DnsNaptrRecord>&)
|
||||
{
|
||||
void Account::onDnsResult(const resip::DNSResult<resip::DnsNaptrRecord>&) {}
|
||||
|
||||
}
|
||||
void Account::onDnsResult(const resip::DNSResult<resip::DnsCnameRecord>&) {}
|
||||
|
||||
void Account::onDnsResult(const resip::DNSResult<resip::DnsCnameRecord>&)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Account::isResponsibleFor(const resip::NameAddr &addr)
|
||||
bool Account::isResponsibleFor(const resip::NameAddr& addr)
|
||||
{
|
||||
std::string user = addr.uri().user().c_str();
|
||||
std::string domain = addr.uri().host().c_str();
|
||||
int p = addr.uri().port();
|
||||
int p = addr.uri().port();
|
||||
if (mConfig->at(CONFIG_USERNAME).asStdString() == user && mConfig->at(CONFIG_DOMAIN).asStdString() == domain)
|
||||
{
|
||||
// Check if ports are the same or port is not specified at all
|
||||
@@ -724,7 +720,7 @@ bool Account::isResponsibleFor(const resip::NameAddr &addr)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Account::setUserInfo(const UserInfo &info)
|
||||
void Account::setUserInfo(const UserInfo& info)
|
||||
{
|
||||
mUserInfo = info;
|
||||
if (mRegistrationHandle.isValid())
|
||||
@@ -740,7 +736,7 @@ Account::UserInfo Account::getUserInfo() const
|
||||
}
|
||||
|
||||
std::atomic_int Account::IdGenerator;
|
||||
int Account::generateId()
|
||||
int Account::generateId()
|
||||
{
|
||||
return ++IdGenerator;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user