Skip to content
Snippets Groups Projects
Commit 8b454e25 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

sipaccount: add getTransportType method

parent ef8a06fc
No related branches found
No related tags found
No related merge requests found
......@@ -88,8 +88,8 @@ SIPAccount::SIPAccount(const std::string& accountID, bool presenceEnabled)
, registrationExpire_(MIN_REGISTRATION_TIME)
, interface_("default")
, publishedSameasLocal_(true)
, publishedIpAddress_()
, publishedIp_()
, publishedIpAddress_()
, localPort_(DEFAULT_SIP_PORT)
, publishedPort_(DEFAULT_SIP_PORT)
, serviceRoute_()
......@@ -890,10 +890,13 @@ void SIPAccount::registerVoIPLink()
if (hostname_.length() >= PJ_MAX_HOSTNAME)
return;
DEBUG("SIPAccount::registerVoIPLink");
DEBUG("SIPAccount::registerVoIPLink %s ", hostname_.c_str());
#if HAVE_TLS
auto IPs = ip_utils::getAddrList(hostname_);
for (const auto& ip : IPs)
DEBUG("--- %s ", ip_utils::addrToStr(ip).c_str());
#if HAVE_TLS
// Init TLS settings if the user wants to use TLS
if (tlsEnable_) {
DEBUG("TLS is enabled for account %s", accountID_.c_str());
......@@ -905,11 +908,18 @@ void SIPAccount::registerVoIPLink()
// PJSIP does not currently support TLS over IPv6
transportType_ = PJSIP_TRANSPORT_TLS;
initTlsConfiguration();
} else {
transportType_ = PJSIP_TRANSPORT_UDP;
}
} else
#endif
{
bool IPv6 = false;
if (isIP2IP()) {
DEBUG("SIPAccount::registerVoIPLink isIP2IP.");
//IPv6 = SipTransport::getInterfaceAddr(interface_).addr.sa_family == pj_AF_INET6();
} else if (!IPs.empty())
IPv6 = IPs[0].addr.sa_family == pj_AF_INET6();
transportType_ = IPv6 ? PJSIP_TRANSPORT_UDP6 : PJSIP_TRANSPORT_UDP;
}
// Init STUN settings for this account if the user selected it
if (stunEnabled_) {
......
......@@ -398,7 +398,6 @@ class SIPAccount : public Account {
/**
* Get the contact header for
* @param prefer_ipv6 If we are dual-stack, use IPv6 contact header.
* @return pj_str_t The contact header based on account information
*/
pj_str_t getContactHeader();
......@@ -549,6 +548,10 @@ class SIPAccount : public Account {
*/
pjsip_transport* transport_;
pjsip_transport_type_e getTransportType() const {
return transportType_;
}
/* Returns true if the username and/or hostname match this account */
MatchRank matches(const std::string &username, const std::string &hostname, pjsip_endpoint *endpt, pj_pool_t *pool) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment