2
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
2
* Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
4
4
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
5
5
* Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
17
17
* You should have received a copy of the GNU General Public License
18
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
21
* Additional permission under GNU GPL version 3 section 7:
54
54
const char * const SIPAccount::IP2IP_PROFILE = "IP2IP";
55
55
const char * const SIPAccount::OVERRTP_STR = "overrtp";
56
56
const char * const SIPAccount::SIPINFO_STR = "sipinfo";
57
const char * const SIPAccount::ACCOUNT_TYPE = "SIP";
59
60
const int MIN_REGISTRATION_TIME = 60;
60
61
const int DEFAULT_REGISTRATION_TIME = 3600;
62
const char *const TRUE_STR = "true";
63
const char *const FALSE_STR = "false";
63
66
SIPAccount::SIPAccount(const std::string& accountID)
64
: Account(accountID, "SIP")
133
139
ScalarNode alias(Account::alias_);
134
140
ScalarNode hostname(Account::hostname_);
135
141
ScalarNode enable(enabled_);
136
ScalarNode type(Account::type_);
142
ScalarNode autoAnswer(autoAnswerEnabled_);
143
ScalarNode type(ACCOUNT_TYPE);
137
144
std::stringstream registrationExpireStr;
138
145
registrationExpireStr << registrationExpire_;
139
146
ScalarNode expire(registrationExpireStr.str());
142
149
portstr << localPort_;
143
150
ScalarNode port(portstr.str());
144
151
ScalarNode serviceRoute(serviceRoute_);
145
ScalarNode contactUpdateEnabled(contactUpdateEnabled_);
146
152
ScalarNode keepAliveEnabled(keepAliveEnabled_);
148
154
ScalarNode mailbox(mailBox_);
210
216
accountmap.setKeyValue(USERNAME_KEY, &username);
211
217
accountmap.setKeyValue(HOSTNAME_KEY, &hostname);
212
218
accountmap.setKeyValue(ACCOUNT_ENABLE_KEY, &enable);
219
accountmap.setKeyValue(ACCOUNT_AUTOANSWER_KEY, &autoAnswer);
213
220
accountmap.setKeyValue(MAILBOX_KEY, &mailbox);
214
221
accountmap.setKeyValue(Preferences::REGISTRATION_EXPIRE_KEY, &expire);
215
222
accountmap.setKeyValue(INTERFACE_KEY, &interface);
220
227
accountmap.setKeyValue(PUBLISH_PORT_KEY, &publishPort);
221
228
accountmap.setKeyValue(SAME_AS_LOCAL_KEY, &sameasLocal);
222
229
accountmap.setKeyValue(SERVICE_ROUTE_KEY, &serviceRoute);
223
accountmap.setKeyValue(UPDATE_CONTACT_HEADER_KEY, &contactUpdateEnabled);
224
230
accountmap.setKeyValue(DTMF_TYPE_KEY, &dtmfType);
225
231
accountmap.setKeyValue(DISPLAY_NAME_KEY, &displayName);
226
232
accountmap.setKeyValue(AUDIO_CODECS_KEY, &audioCodecs);
305
311
using std::string;
307
313
mapNode.getValue(ALIAS_KEY, &alias_);
308
mapNode.getValue(TYPE_KEY, &type_);
309
314
mapNode.getValue(USERNAME_KEY, &username_);
310
315
if (not isIP2IP()) mapNode.getValue(HOSTNAME_KEY, &hostname_);
311
316
mapNode.getValue(ACCOUNT_ENABLE_KEY, &enabled_);
317
mapNode.getValue(ACCOUNT_AUTOANSWER_KEY, &autoAnswerEnabled_);
312
318
if (not isIP2IP()) mapNode.getValue(MAILBOX_KEY, &mailBox_);
313
319
mapNode.getValue(AUDIO_CODECS_KEY, &audioCodecStr_);
314
320
// Update codec list which one is used for SDP offer
315
setActiveAudioCodecs(ManagerImpl::split_string(audioCodecStr_));
321
setActiveAudioCodecs(split_string(audioCodecStr_));
317
323
YamlNode *videoCodecsNode(mapNode.getValue(VIDEO_CODECS_KEY));
363
369
dtmfType_ = dtmfType;
365
371
if (not isIP2IP()) mapNode.getValue(SERVICE_ROUTE_KEY, &serviceRoute_);
366
mapNode.getValue(UPDATE_CONTACT_HEADER_KEY, &contactUpdateEnabled_);
369
374
if (not isIP2IP()) mapNode.getValue(STUN_ENABLED_KEY, &stunEnabled_);
464
468
void SIPAccount::setAccountDetails(std::map<std::string, std::string> details)
466
470
// Account setting common to SIP and IAX
467
471
alias_ = details[CONFIG_ACCOUNT_ALIAS];
468
type_ = details[CONFIG_ACCOUNT_TYPE];
469
472
username_ = details[CONFIG_ACCOUNT_USERNAME];
470
473
hostname_ = details[CONFIG_ACCOUNT_HOSTNAME];
471
enabled_ = details[CONFIG_ACCOUNT_ENABLE] == "true";
474
enabled_ = details[CONFIG_ACCOUNT_ENABLE] == TRUE_STR;
475
autoAnswerEnabled_ = details[CONFIG_ACCOUNT_AUTOANSWER] == TRUE_STR;
472
476
ringtonePath_ = details[CONFIG_RINGTONE_PATH];
473
ringtoneEnabled_ = details[CONFIG_RINGTONE_ENABLED] == "true";
477
ringtoneEnabled_ = details[CONFIG_RINGTONE_ENABLED] == TRUE_STR;
474
478
mailBox_ = details[CONFIG_ACCOUNT_MAILBOX];
476
480
// SIP specific account settings
479
483
displayName_ = details[CONFIG_DISPLAY_NAME];
480
484
serviceRoute_ = details[CONFIG_ACCOUNT_ROUTESET];
481
485
interface_ = details[CONFIG_LOCAL_INTERFACE];
482
publishedSameasLocal_ = details[CONFIG_PUBLISHED_SAMEAS_LOCAL] == "true";
486
publishedSameasLocal_ = details[CONFIG_PUBLISHED_SAMEAS_LOCAL] == TRUE_STR;
483
487
publishedIpAddress_ = details[CONFIG_PUBLISHED_ADDRESS];
484
488
localPort_ = atoi(details[CONFIG_LOCAL_PORT].c_str());
485
489
publishedPort_ = atoi(details[CONFIG_PUBLISHED_PORT].c_str());
488
492
// pj_stun_sock_destroy(pj_stun_sock *stun_sock);
490
494
stunServer_ = details[CONFIG_STUN_SERVER];
491
stunEnabled_ = details[CONFIG_STUN_ENABLE] == "true";
495
stunEnabled_ = details[CONFIG_STUN_ENABLE] == TRUE_STR;
492
496
dtmfType_ = details[CONFIG_ACCOUNT_DTMF_TYPE];
493
497
registrationExpire_ = atoi(details[CONFIG_ACCOUNT_REGISTRATION_EXPIRE].c_str());
494
498
if(registrationExpire_ < MIN_REGISTRATION_TIME)
495
499
registrationExpire_ = MIN_REGISTRATION_TIME;
497
501
userAgent_ = details[CONFIG_ACCOUNT_USERAGENT];
498
keepAliveEnabled_ = details[CONFIG_KEEP_ALIVE_ENABLED] == "true";
502
keepAliveEnabled_ = details[CONFIG_KEEP_ALIVE_ENABLED] == TRUE_STR;
501
srtpEnabled_ = details[CONFIG_SRTP_ENABLE] == "true";
502
srtpFallback_ = details[CONFIG_SRTP_RTP_FALLBACK] == "true";
503
zrtpDisplaySas_ = details[CONFIG_ZRTP_DISPLAY_SAS] == "true";
504
zrtpDisplaySasOnce_ = details[CONFIG_ZRTP_DISPLAY_SAS_ONCE] == "true";
505
zrtpNotSuppWarning_ = details[CONFIG_ZRTP_NOT_SUPP_WARNING] == "true";
506
zrtpHelloHash_ = details[CONFIG_ZRTP_HELLO_HASH] == "true";
505
srtpEnabled_ = details[CONFIG_SRTP_ENABLE] == TRUE_STR;
506
srtpFallback_ = details[CONFIG_SRTP_RTP_FALLBACK] == TRUE_STR;
507
zrtpDisplaySas_ = details[CONFIG_ZRTP_DISPLAY_SAS] == TRUE_STR;
508
zrtpDisplaySasOnce_ = details[CONFIG_ZRTP_DISPLAY_SAS_ONCE] == TRUE_STR;
509
zrtpNotSuppWarning_ = details[CONFIG_ZRTP_NOT_SUPP_WARNING] == TRUE_STR;
510
zrtpHelloHash_ = details[CONFIG_ZRTP_HELLO_HASH] == TRUE_STR;
507
511
srtpKeyExchange_ = details[CONFIG_SRTP_KEY_EXCHANGE];
516
520
tlsMethod_ = details[CONFIG_TLS_METHOD];
517
521
tlsCiphers_ = details[CONFIG_TLS_CIPHERS];
518
522
tlsServerName_ = details[CONFIG_TLS_SERVER_NAME];
519
tlsVerifyServer_ = details[CONFIG_TLS_VERIFY_SERVER] == "true";
520
tlsVerifyClient_ = details[CONFIG_TLS_VERIFY_CLIENT] == "true";
521
tlsRequireClientCertificate_ = details[CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE] == "true";
523
tlsVerifyServer_ = details[CONFIG_TLS_VERIFY_SERVER] == TRUE_STR;
524
tlsVerifyClient_ = details[CONFIG_TLS_VERIFY_CLIENT] == TRUE_STR;
525
tlsRequireClientCertificate_ = details[CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE] == TRUE_STR;
522
526
tlsNegotiationTimeoutSec_ = details[CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC];
523
527
tlsNegotiationTimeoutMsec_ = details[CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC];
541
545
// note: The IP2IP profile will always have IP2IP as an alias
542
546
a[CONFIG_ACCOUNT_ALIAS] = alias_;
544
a[CONFIG_ACCOUNT_ENABLE] = enabled_ ? "true" : "false";
545
a[CONFIG_ACCOUNT_TYPE] = type_;
548
a[CONFIG_ACCOUNT_ENABLE] = enabled_ ? TRUE_STR : FALSE_STR;
549
a[CONFIG_ACCOUNT_AUTOANSWER]= autoAnswerEnabled_ ? TRUE_STR : FALSE_STR;
550
a[CONFIG_ACCOUNT_TYPE] = ACCOUNT_TYPE;
546
551
a[CONFIG_ACCOUNT_HOSTNAME] = hostname_;
547
552
a[CONFIG_ACCOUNT_USERNAME] = username_;
549
554
a[CONFIG_RINGTONE_PATH] = ringtonePath_;
550
a[CONFIG_RINGTONE_ENABLED] = ringtoneEnabled_ ? "true" : "false";
555
a[CONFIG_RINGTONE_ENABLED] = ringtoneEnabled_ ? TRUE_STR : FALSE_STR;
551
556
a[CONFIG_ACCOUNT_MAILBOX] = mailBox_;
553
558
RegistrationState state = UNREGISTERED;
577
582
registrationExpireStr << registrationExpire_;
578
583
a[CONFIG_ACCOUNT_REGISTRATION_EXPIRE] = registrationExpireStr.str();
579
584
a[CONFIG_LOCAL_INTERFACE] = interface_;
580
a[CONFIG_PUBLISHED_SAMEAS_LOCAL] = publishedSameasLocal_ ? "true" : "false";
585
a[CONFIG_PUBLISHED_SAMEAS_LOCAL] = publishedSameasLocal_ ? TRUE_STR : FALSE_STR;
581
586
a[CONFIG_PUBLISHED_ADDRESS] = publishedIpAddress_;
583
588
std::stringstream localport;
586
591
std::stringstream publishedport;
587
592
publishedport << publishedPort_;
588
593
a[CONFIG_PUBLISHED_PORT] = publishedport.str();
589
a[CONFIG_STUN_ENABLE] = stunEnabled_ ? "true" : "false";
594
a[CONFIG_STUN_ENABLE] = stunEnabled_ ? TRUE_STR : FALSE_STR;
590
595
a[CONFIG_STUN_SERVER] = stunServer_;
591
596
a[CONFIG_ACCOUNT_DTMF_TYPE] = dtmfType_;
592
a[CONFIG_KEEP_ALIVE_ENABLED] = keepAliveEnabled_ ? "true" : "false";
597
a[CONFIG_KEEP_ALIVE_ENABLED] = keepAliveEnabled_ ? TRUE_STR : FALSE_STR;
594
599
a[CONFIG_SRTP_KEY_EXCHANGE] = srtpKeyExchange_;
595
a[CONFIG_SRTP_ENABLE] = srtpEnabled_ ? "true" : "false";
596
a[CONFIG_SRTP_RTP_FALLBACK] = srtpFallback_ ? "true" : "false";
600
a[CONFIG_SRTP_ENABLE] = srtpEnabled_ ? TRUE_STR : FALSE_STR;
601
a[CONFIG_SRTP_RTP_FALLBACK] = srtpFallback_ ? TRUE_STR : FALSE_STR;
598
a[CONFIG_ZRTP_DISPLAY_SAS] = zrtpDisplaySas_ ? "true" : "false";
599
a[CONFIG_ZRTP_DISPLAY_SAS_ONCE] = zrtpDisplaySasOnce_ ? "true" : "false";
600
a[CONFIG_ZRTP_HELLO_HASH] = zrtpHelloHash_ ? "true" : "false";
601
a[CONFIG_ZRTP_NOT_SUPP_WARNING] = zrtpNotSuppWarning_ ? "true" : "false";
603
a[CONFIG_ZRTP_DISPLAY_SAS] = zrtpDisplaySas_ ? TRUE_STR : FALSE_STR;
604
a[CONFIG_ZRTP_DISPLAY_SAS_ONCE] = zrtpDisplaySasOnce_ ? TRUE_STR : FALSE_STR;
605
a[CONFIG_ZRTP_HELLO_HASH] = zrtpHelloHash_ ? TRUE_STR : FALSE_STR;
606
a[CONFIG_ZRTP_NOT_SUPP_WARNING] = zrtpNotSuppWarning_ ? TRUE_STR : FALSE_STR;
603
608
// TLS listener is unique and parameters are modified through IP2IP_PROFILE
604
609
std::stringstream tlslistenerport;
612
617
a[CONFIG_TLS_METHOD] = tlsMethod_;
613
618
a[CONFIG_TLS_CIPHERS] = tlsCiphers_;
614
619
a[CONFIG_TLS_SERVER_NAME] = tlsServerName_;
615
a[CONFIG_TLS_VERIFY_SERVER] = tlsVerifyServer_ ? "true" : "false";
616
a[CONFIG_TLS_VERIFY_CLIENT] = tlsVerifyClient_ ? "true" : "false";
617
a[CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE] = tlsRequireClientCertificate_ ? "true" : "false";
620
a[CONFIG_TLS_VERIFY_SERVER] = tlsVerifyServer_ ? TRUE_STR : FALSE_STR;
621
a[CONFIG_TLS_VERIFY_CLIENT] = tlsVerifyClient_ ? TRUE_STR : FALSE_STR;
622
a[CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE] = tlsRequireClientCertificate_ ? TRUE_STR : FALSE_STR;
618
623
a[CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC] = tlsNegotiationTimeoutSec_;
619
624
a[CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC] = tlsNegotiationTimeoutMsec_;
629
634
// Init TLS settings if the user wants to use TLS
630
if (tlsEnable_ == "true") {
635
if (tlsEnable_ == TRUE_STR) {
631
636
DEBUG("TLS is enabled for account %s", accountID_.c_str());
632
637
transportType_ = PJSIP_TRANSPORT_TLS;
633
638
initTlsConfiguration();
728
733
return PJSIP_SSL_UNSPECIFIED_METHOD;
736
void SIPAccount::displayCipherSuite()
738
CipherArray::const_iterator iter;
739
for (iter = ciphers.begin(); iter != ciphers.end(); ++iter)
740
DEBUG("Cipher: %s", pj_ssl_cipher_name(*iter));
731
743
void SIPAccount::initTlsConfiguration()
733
745
pj_status_t status;
734
746
unsigned cipherNum;
736
748
// Determine the cipher list supported on this machine
737
cipherNum = PJ_ARRAY_SIZE(ciphers);
749
cipherNum = ciphers.size();
738
750
status = pj_ssl_cipher_get_availables(&ciphers.front(), &cipherNum);
739
751
if (status != PJ_SUCCESS) {
740
752
ERROR("Could not determine cipher list on this system");
791
803
if (registrationExpire_ == 0)
792
804
registrationExpire_ = DEFAULT_REGISTRATION_TIME; /** Default expire value for registration */
794
if (tlsEnable_ == "true") {
806
if (tlsEnable_ == TRUE_STR) {
795
807
initTlsConfiguration();
796
808
transportType_ = PJSIP_TRANSPORT_TLS;
798
810
transportType_ = PJSIP_TRANSPORT_UDP;
801
bool SIPAccount::fullMatch(const std::string& username, const std::string& hostname) const
813
bool SIPAccount::fullMatch(const std::string& username, const std::string& hostname, pjsip_endpoint *endpt, pj_pool_t *pool) const
803
return userMatch(username) and hostnameMatch(hostname);
815
return userMatch(username) and hostnameMatch(hostname, endpt, pool);
806
818
bool SIPAccount::userMatch(const std::string& username) const
808
820
return !username.empty() and username == username_;
811
bool SIPAccount::hostnameMatch(const std::string& hostname) const
824
bool haveValueInCommon(const std::vector<std::string> &a, const std::vector<std::string> &b)
826
for (std::vector<std::string>::const_iterator i = a.begin(); i != a.end(); ++i)
827
if (std::find(b.begin(), b.end(), *i) != b.end())
833
bool SIPAccount::hostnameMatch(const std::string& hostname, pjsip_endpoint * /*endpt*/, pj_pool_t * /*pool*/) const
813
return hostname == hostname_;
835
if (hostname == hostname_)
837
const std::vector<std::string> a(sip_utils::getIPList(hostname));
838
const std::vector<std::string> b(sip_utils::getIPList(hostname_));
839
return haveValueInCommon(a, b);
816
bool SIPAccount::proxyMatch(const std::string& hostname) const
842
bool SIPAccount::proxyMatch(const std::string& hostname, pjsip_endpoint * /*endpt*/, pj_pool_t * /*pool*/) const
818
844
if (hostname == serviceRoute_)
820
const std::list<std::string> ipList(sip_utils::resolveServerDns(serviceRoute_));
821
return std::find(ipList.begin(), ipList.end(), hostname) != ipList.end();
846
const std::vector<std::string> a(sip_utils::getIPList(hostname));
847
const std::vector<std::string> b(sip_utils::getIPList(serviceRoute_));
848
return haveValueInCommon(a, b);
824
851
std::string SIPAccount::getLoginName()
893
920
return "<" + scheme + hostname_ + transport + ">";
896
void SIPAccount::setContactHeader(std::string address, std::string port)
899
std::string transport;
901
// UDP does not require the transport specification
902
if (transportType_ == PJSIP_TRANSPORT_TLS) {
904
transport = ";transport=" + std::string(pjsip_transport_get_type_name(transportType_));
908
contactHeader_ = displayName_ + (displayName_.empty() ? "" : " ") + "<" +
909
scheme + username_ + (username_.empty() ? "":"@") +
910
address + ":" + port + transport + ">";
914
924
std::string SIPAccount::getContactHeader() const
921
931
if (transportType == PJSIP_TRANSPORT_START_OTHER)
922
932
transportType = PJSIP_TRANSPORT_UDP;
924
// Use the CONTACT header provided by the registrar if any
925
if (!contactHeader_.empty())
926
return contactHeader_;
928
934
// Else we determine this infor based on transport information
929
935
std::string address, port;
930
936
std::ostringstream portstr;
953
959
address + ":" + port + transport + ">";
956
963
void SIPAccount::keepAliveRegistrationCb(UNUSED pj_timer_heap_t *th, pj_timer_entry *te)
958
965
SIPAccount *sipAccount = static_cast<SIPAccount *>(te->user_data);
960
ERROR("Keep alive registration callback for account %s", sipAccount->getAccountID().c_str());
962
967
if (sipAccount == NULL) {
963
968
ERROR("SIP account is NULL while registering a new keep alive timer");
972
ERROR("Keep alive registration callback for account %s", sipAccount->getAccountID().c_str());
967
974
// IP2IP default does not require keep-alive
968
975
if (sipAccount->isIP2IP())
1100
1107
std::map<std::string, std::string> ip2ipAccountDetails;
1101
1108
ip2ipAccountDetails[CONFIG_ACCOUNT_ID] = IP2IP_PROFILE;
1102
1109
ip2ipAccountDetails[CONFIG_SRTP_KEY_EXCHANGE] = srtpKeyExchange_;
1103
ip2ipAccountDetails[CONFIG_SRTP_ENABLE] = srtpEnabled_ ? "true" : "false";
1104
ip2ipAccountDetails[CONFIG_SRTP_RTP_FALLBACK] = srtpFallback_ ? "true" : "false";
1105
ip2ipAccountDetails[CONFIG_ZRTP_DISPLAY_SAS] = zrtpDisplaySas_ ? "true" : "false";
1106
ip2ipAccountDetails[CONFIG_ZRTP_HELLO_HASH] = zrtpHelloHash_ ? "true" : "false";
1107
ip2ipAccountDetails[CONFIG_ZRTP_NOT_SUPP_WARNING] = zrtpNotSuppWarning_ ? "true" : "false";
1108
ip2ipAccountDetails[CONFIG_ZRTP_DISPLAY_SAS_ONCE] = zrtpDisplaySasOnce_ ? "true" : "false";
1110
ip2ipAccountDetails[CONFIG_SRTP_ENABLE] = srtpEnabled_ ? TRUE_STR : FALSE_STR;
1111
ip2ipAccountDetails[CONFIG_SRTP_RTP_FALLBACK] = srtpFallback_ ? TRUE_STR : FALSE_STR;
1112
ip2ipAccountDetails[CONFIG_ZRTP_DISPLAY_SAS] = zrtpDisplaySas_ ? TRUE_STR : FALSE_STR;
1113
ip2ipAccountDetails[CONFIG_ZRTP_HELLO_HASH] = zrtpHelloHash_ ? TRUE_STR : FALSE_STR;
1114
ip2ipAccountDetails[CONFIG_ZRTP_NOT_SUPP_WARNING] = zrtpNotSuppWarning_ ? TRUE_STR : FALSE_STR;
1115
ip2ipAccountDetails[CONFIG_ZRTP_DISPLAY_SAS_ONCE] = zrtpDisplaySasOnce_ ? TRUE_STR : FALSE_STR;
1109
1116
ip2ipAccountDetails[CONFIG_LOCAL_INTERFACE] = interface_;
1110
1117
std::stringstream portstr;
1111
1118
portstr << localPort_;
1134
1141
tlsSettings[CONFIG_TLS_METHOD] = tlsMethod_;
1135
1142
tlsSettings[CONFIG_TLS_CIPHERS] = tlsCiphers_;
1136
1143
tlsSettings[CONFIG_TLS_SERVER_NAME] = tlsServerName_;
1137
tlsSettings[CONFIG_TLS_VERIFY_SERVER] = tlsVerifyServer_ ? "true" : "false";
1138
tlsSettings[CONFIG_TLS_VERIFY_CLIENT] = tlsVerifyClient_ ? "true" : "false";
1139
tlsSettings[CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE] = tlsRequireClientCertificate_ ? "true" : "false";
1144
tlsSettings[CONFIG_TLS_VERIFY_SERVER] = tlsVerifyServer_ ? TRUE_STR : FALSE_STR;
1145
tlsSettings[CONFIG_TLS_VERIFY_CLIENT] = tlsVerifyClient_ ? TRUE_STR : FALSE_STR;
1146
tlsSettings[CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE] = tlsRequireClientCertificate_ ? TRUE_STR : FALSE_STR;
1140
1147
tlsSettings[CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC] = tlsNegotiationTimeoutSec_;
1141
1148
tlsSettings[CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC] = tlsNegotiationTimeoutMsec_;
1157
1164
std::map<std::string, std::string>::const_iterator it = details.find(key);
1159
1166
if (it != details.end())
1160
val = it->second == "true";
1167
val = it->second == TRUE_STR;
1163
1170
void set_opt(const std::map<std::string, std::string> &details, const char *key, pj_uint16_t &val)
1197
1204
return accountID_ == IP2IP_PROFILE;
1207
bool SIPAccount::matches(const std::string &userName, const std::string &server,
1208
pjsip_endpoint *endpt, pj_pool_t *pool) const
1210
if (fullMatch(userName, server, endpt, pool)) {
1211
DEBUG("Matching account id in request is a fullmatch %s@%s", userName.c_str(), server.c_str());
1213
} else if (hostnameMatch(server, endpt, pool)) {
1214
DEBUG("Matching account id in request with hostname %s", server.c_str());
1216
} else if (userMatch(userName)) {
1217
DEBUG("Matching account id in request with username %s", userName.c_str());
1219
} else if (proxyMatch(server, endpt, pool)) {
1220
DEBUG("Matching account id in request with proxy %s", server.c_str());