Commit 3ab37d7a authored by Guillaume Roguez's avatar Guillaume Roguez

sip: add display name to contact header

This information can be displayed by peer.

Refs #74689

Change-Id: Ib4f4a2732cab8b78346a46acf5b520c9365ba188
parent 1853fb82
......@@ -254,6 +254,7 @@ Account::setAccountDetails(const std::map<std::string, std::string> &details)
{
// Account setting common to SIP and IAX
parseString(details, Conf::CONFIG_ACCOUNT_ALIAS, alias_);
parseString(details, Conf::CONFIG_ACCOUNT_DISPLAYNAME, displayName_);
parseBool(details, Conf::CONFIG_ACCOUNT_ENABLE, enabled_);
parseString(details, Conf::CONFIG_ACCOUNT_USERNAME, username_);
parseString(details, Conf::CONFIG_ACCOUNT_HOSTNAME, hostname_);
......@@ -277,6 +278,7 @@ Account::getAccountDetails() const
{
return {
{Conf::CONFIG_ACCOUNT_ALIAS, alias_},
{Conf::CONFIG_ACCOUNT_DISPLAYNAME, displayName_},
{Conf::CONFIG_ACCOUNT_ENABLE, enabled_ ? TRUE_STR : FALSE_STR},
{Conf::CONFIG_ACCOUNT_TYPE, getAccountType()},
{Conf::CONFIG_ACCOUNT_HOSTNAME, hostname_},
......
......@@ -42,6 +42,7 @@ namespace ring { namespace Conf {
// Common account parameters
static const char *const CONFIG_ACCOUNT_TYPE = "Account.type";
static const char *const CONFIG_ACCOUNT_ALIAS = "Account.alias";
static const char *const CONFIG_ACCOUNT_DISPLAYNAME = "Account.displayName";
static const char *const CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
static const char *const CONFIG_ACCOUNT_ENABLE = "Account.enable";
static const char *const CONFIG_ACCOUNT_AUTOANSWER = "Account.autoAnswer";
......
......@@ -93,6 +93,7 @@ namespace ConfProperties {
constexpr static const char ID [] = "Account.id";
constexpr static const char TYPE [] = "Account.type";
constexpr static const char ALIAS [] = "Account.alias";
constexpr static const char DISPLAYNAME [] = "Account.DisplayName";
constexpr static const char ENABLED [] = "Account.enable";
constexpr static const char MAILBOX [] = "Account.mailbox";
constexpr static const char DTMF_TYPE [] = "Account.dtmfType";
......
......@@ -1134,8 +1134,10 @@ RingAccount::getContactHeader(pjsip_transport* t)
if (!t) {
RING_ERR("getContactHeader: no SIP transport provided");
contact_.slen = pj_ansi_snprintf(contact_.ptr, PJSIP_MAX_URL_SIZE,
"<sips:%s@ring.dht>",
username_.c_str());
"%s%s<sips:%s@ring.dht>",
displayName_.c_str(),
(displayName_.empty() ? "" : " "),
username_.c_str());
return contact_;
}
......@@ -1143,7 +1145,9 @@ RingAccount::getContactHeader(pjsip_transport* t)
auto tlsTr = reinterpret_cast<tls::SipsIceTransport::TransportData*>(t)->self;
auto address = tlsTr->getLocalAddress();
contact_.slen = pj_ansi_snprintf(contact_.ptr, PJSIP_MAX_URL_SIZE,
"<sips:%s%s%s;transport=tls>",
"%s%s<sips:%s%s%s;transport=tls>",
displayName_.c_str(),
(displayName_.empty() ? "" : " "),
username_.c_str(),
(username_.empty() ? "" : "@"),
address.toString(true).c_str());
......
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