Commit 69d33a0c authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3170] Use Domain name in sip TO header if specified

parent a6e83f1e
......@@ -461,9 +461,14 @@ std::string SIPAccount::getFromUri (void)
username = getLoginName();
}
// Get machine hostname if not provided
if (_hostname.empty()) {
hostname = getMachineName();
if(!getDomainName().empty()) {
hostname = getDomainName();
}
else {
// Get machine hostname if not provided
if (_hostname.empty()) {
hostname = getMachineName();
}
}
int len = pj_ansi_snprintf (uri, PJSIP_MAX_URL_SIZE,
......@@ -483,7 +488,7 @@ std::string SIPAccount::getToUri (const std::string& username)
std::string scheme;
std::string transport;
std::string hostname = _hostname;
std::string hostname = "";
// UDP does not require the transport specification
......@@ -501,8 +506,12 @@ std::string SIPAccount::getToUri (const std::string& username)
}
// Check if hostname is already specified
if (username.find ("@") != std::string::npos) {
hostname = "";
if (username.find ("@") == std::string::npos) {
// hostname not specified
if(getDomainName().empty())
hostname = _hostname;
else
hostname = getDomainName();
}
int len = pj_ansi_snprintf (uri, PJSIP_MAX_URL_SIZE,
......
......@@ -559,28 +559,19 @@ int SIPVoIPLink::sendRegister (AccountID id)
}
// Creates URI
std::string fromUri;
std::string contactUri;
std::string srvUri;
std::string address;
fromUri = account->getFromUri();
srvUri = account->getServerUri();
std::string fromUri = account->getFromUri();
std::string srvUri = account->getServerUri();
address = findLocalAddressFromUri (srvUri, account->getAccountTransport ());
std::string address = findLocalAddressFromUri (srvUri, account->getAccountTransport ());
int port = findLocalPortFromUri (srvUri, account->getAccountTransport ());
std::stringstream ss;
std::string portStr;
ss << port;
ss >> portStr;
contactUri = account->getContactHeader (address, portStr);
std::string contactUri = account->getContactHeader (address, portStr);
_debug ("sendRegister: fromUri: %s serverUri: %s contactUri: %s",
fromUri.c_str(),
......
Supports Markdown
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