78
151
free (_tlsSetting);
154
void SIPAccount::serialize (Conf::YamlEmitter *emitter)
157
_debug ("SipAccount: serialize %s", _accountID.c_str());
160
Conf::MappingNode accountmap (NULL);
161
Conf::MappingNode credentialmap (NULL);
162
Conf::MappingNode srtpmap (NULL);
163
Conf::MappingNode zrtpmap (NULL);
164
Conf::MappingNode tlsmap (NULL);
166
Conf::ScalarNode id (Account::_accountID);
167
Conf::ScalarNode username (Account::_username);
168
Conf::ScalarNode password (Account::_password);
169
Conf::ScalarNode alias (Account::_alias);
170
Conf::ScalarNode hostname (Account::_hostname);
171
Conf::ScalarNode enable (_enabled ? "true" : "false");
172
Conf::ScalarNode type (Account::_type);
173
Conf::ScalarNode expire (_registrationExpire);
174
Conf::ScalarNode interface (_interface);
175
std::stringstream portstr;
176
portstr << _localPort;
177
Conf::ScalarNode port (portstr.str());
178
Conf::ScalarNode serviceRoute (_serviceRoute);
180
Conf::ScalarNode mailbox (_mailBox);
181
Conf::ScalarNode publishAddr (_publishedIpAddress);
182
std::stringstream publicportstr;
183
publicportstr << _publishedPort;
184
Conf::ScalarNode publishPort (publicportstr.str());
185
Conf::ScalarNode sameasLocal (_publishedSameasLocal ? "true" : "false");
186
Conf::ScalarNode resolveOnce (_resolveOnce ? "true" : "false");
187
Conf::ScalarNode codecs (_codecStr);
188
Conf::ScalarNode ringtonePath (_ringtonePath);
189
Conf::ScalarNode ringtoneEnabled (_ringtoneEnabled ? "true" : "false");
190
Conf::ScalarNode stunServer (_stunServer);
191
Conf::ScalarNode stunEnabled (_stunEnabled ? "true" : "false");
192
Conf::ScalarNode displayName (_displayName);
193
Conf::ScalarNode dtmfType (_dtmfType==OVERRTP ? "overrtp" : "sipinfo");
195
std::stringstream countstr;
197
Conf::ScalarNode count (countstr.str());
199
Conf::ScalarNode srtpenabled (_srtpEnabled ? "true" : "false");
200
Conf::ScalarNode keyExchange (_srtpKeyExchange);
201
Conf::ScalarNode rtpFallback (_srtpFallback ? "true" : "false");
203
Conf::ScalarNode displaySas (_zrtpDisplaySas ? "true" : "false");
204
Conf::ScalarNode displaySasOnce (_zrtpDisplaySasOnce ? "true" : "false");
205
Conf::ScalarNode helloHashEnabled (_zrtpHelloHash ? "true" : "false");
206
Conf::ScalarNode notSuppWarning (_zrtpNotSuppWarning ? "true" : "false");
208
Conf::ScalarNode tlsport (_tlsPortStr);
209
Conf::ScalarNode certificate (_tlsCertificateFile);
210
Conf::ScalarNode calist (_tlsCaListFile);
211
Conf::ScalarNode ciphers (_tlsCiphers);
212
Conf::ScalarNode tlsenabled (_tlsEnable);
213
Conf::ScalarNode tlsmethod (_tlsMethod);
214
Conf::ScalarNode timeout (_tlsNegotiationTimeoutSec);
215
Conf::ScalarNode tlspassword (_tlsPassword);
216
Conf::ScalarNode privatekey (_tlsPrivateKeyFile);
217
Conf::ScalarNode requirecertif (_tlsRequireClientCertificate ? "true" : "false");
218
Conf::ScalarNode server (_tlsServerName);
219
Conf::ScalarNode verifyclient (_tlsVerifyServer ? "true" : "false");
220
Conf::ScalarNode verifyserver (_tlsVerifyClient ? "true" : "false");
222
accountmap.setKeyValue (aliasKey, &alias);
223
accountmap.setKeyValue (typeKey, &type);
224
accountmap.setKeyValue (idKey, &id);
225
accountmap.setKeyValue (usernameKey, &username);
226
accountmap.setKeyValue (passwordKey, &password);
227
accountmap.setKeyValue (hostnameKey, &hostname);
228
accountmap.setKeyValue (accountEnableKey, &enable);
229
accountmap.setKeyValue (mailboxKey, &mailbox);
230
accountmap.setKeyValue (expireKey, &expire);
231
accountmap.setKeyValue (interfaceKey, &interface);
232
accountmap.setKeyValue (portKey, &port);
233
accountmap.setKeyValue (stunServerKey, &stunServer);
234
accountmap.setKeyValue (stunEnabledKey, &stunEnabled);
235
accountmap.setKeyValue (publishAddrKey, &publishAddr);
236
accountmap.setKeyValue (publishPortKey, &publishPort);
237
accountmap.setKeyValue (sameasLocalKey, &sameasLocal);
238
accountmap.setKeyValue (resolveOnceKey, &resolveOnce);
239
accountmap.setKeyValue (serviceRouteKey, &serviceRoute);
240
accountmap.setKeyValue (dtmfTypeKey, &dtmfType);
241
accountmap.setKeyValue (displayNameKey, &displayName);
242
accountmap.setKeyValue (codecsKey, &codecs);
243
accountmap.setKeyValue (ringtonePathKey, &ringtonePath);
244
accountmap.setKeyValue (ringtoneEnabledKey, &ringtoneEnabled);
246
accountmap.setKeyValue (srtpKey, &srtpmap);
247
srtpmap.setKeyValue (srtpEnableKey, &srtpenabled);
248
srtpmap.setKeyValue (keyExchangeKey, &keyExchange);
249
srtpmap.setKeyValue (rtpFallbackKey, &rtpFallback);
251
accountmap.setKeyValue (zrtpKey, &zrtpmap);
252
zrtpmap.setKeyValue (displaySasKey, &displaySas);
253
zrtpmap.setKeyValue (displaySasOnceKey, &displaySasOnce);
254
zrtpmap.setKeyValue (helloHashEnabledKey, &helloHashEnabled);
255
zrtpmap.setKeyValue (notSuppWarningKey, ¬SuppWarning);
257
accountmap.setKeyValue (credKey, &credentialmap);
258
credentialmap.setKeyValue (credentialCountKey, &count);
260
accountmap.setKeyValue (tlsKey, &tlsmap);
261
tlsmap.setKeyValue (tlsPortKey, &tlsport);
262
tlsmap.setKeyValue (certificateKey, &certificate);
263
tlsmap.setKeyValue (calistKey, &calist);
264
tlsmap.setKeyValue (ciphersKey, &ciphers);
265
tlsmap.setKeyValue (tlsEnableKey, &tlsenabled);
266
tlsmap.setKeyValue (methodKey, &tlsmethod);
267
tlsmap.setKeyValue (timeoutKey, &timeout);
268
tlsmap.setKeyValue (tlsPasswordKey, &tlspassword);
269
tlsmap.setKeyValue (privateKeyKey, &privatekey);
270
tlsmap.setKeyValue (requireCertifKey, &requirecertif);
271
tlsmap.setKeyValue (serverKey, &server);
272
tlsmap.setKeyValue (verifyClientKey, &verifyclient);
273
tlsmap.setKeyValue (verifyServerKey, &verifyserver);
276
emitter->serializeAccount (&accountmap);
277
} catch (Conf::YamlEmitterException &e) {
278
_error ("ConfigTree: %s", e.what());
283
void SIPAccount::unserialize (Conf::MappingNode *map)
285
Conf::ScalarNode *val;
286
Conf::MappingNode *srtpMap;
287
Conf::MappingNode *tlsMap;
288
Conf::MappingNode *zrtpMap;
289
Conf::MappingNode *credMap;
291
_debug ("SipAccount: Unserialize %s", _accountID.c_str());
293
val = (Conf::ScalarNode *) (map->getValue (aliasKey));
296
_alias = val->getValue();
300
val = (Conf::ScalarNode *) (map->getValue (typeKey));
303
_type = val->getValue();
307
val = (Conf::ScalarNode *) (map->getValue (idKey));
310
_accountID = val->getValue();
314
val = (Conf::ScalarNode *) (map->getValue (usernameKey));
317
_username = val->getValue();
321
val = (Conf::ScalarNode *) (map->getValue (passwordKey));
324
_password = val->getValue();
328
val = (Conf::ScalarNode *) (map->getValue (hostnameKey));
331
_hostname = val->getValue();
335
val = (Conf::ScalarNode *) (map->getValue (accountEnableKey));
338
_enabled = (val->getValue() == "false") ? false : true;
342
val = (Conf::ScalarNode *) (map->getValue (mailboxKey));
345
_mailBox = val->getValue();
349
val = (Conf::ScalarNode *) (map->getValue (codecsKey));
352
_codecStr = val->getValue();
356
val = (Conf::ScalarNode *) (map->getValue (ringtonePathKey));
359
_ringtonePath = val->getValue();
363
val = (Conf::ScalarNode *) (map->getValue (ringtoneEnabledKey));
366
_ringtoneEnabled = (val->getValue() == "true") ? true : false;
370
val = (Conf::ScalarNode *) (map->getValue (expireKey));
373
_registrationExpire = val->getValue();
377
val = (Conf::ScalarNode *) (map->getValue (interfaceKey));
380
_interface = val->getValue();
384
val = (Conf::ScalarNode *) (map->getValue (portKey));
387
_localPort = atoi (val->getValue().data());
391
val = (Conf::ScalarNode *) (map->getValue (publishAddrKey));
394
_publishedIpAddress = val->getValue();
398
val = (Conf::ScalarNode *) (map->getValue (publishPortKey));
401
_publishedPort = atoi (val->getValue().data());
405
val = (Conf::ScalarNode *) (map->getValue (sameasLocalKey));
408
_publishedSameasLocal = (val->getValue().compare ("true") == 0) ? true : false;
412
val = (Conf::ScalarNode *) (map->getValue (resolveOnceKey));
415
_resolveOnce = (val->getValue().compare ("true") == 0) ? true : false;
419
val = (Conf::ScalarNode *) (map->getValue (dtmfTypeKey));
422
_dtmfType = (val->getValue() == "overrtp") ? OVERRTP : SIPINFO;
426
// _dtmfType = atoi(val->getValue();
427
val = (Conf::ScalarNode *) (map->getValue (serviceRouteKey));
430
_serviceRoute = val->getValue();
435
val = (Conf::ScalarNode *) (map->getValue (stunEnabledKey));
438
_stunEnabled = (val->getValue().compare ("true") == 0) ? true : false;
442
val = (Conf::ScalarNode *) (map->getValue (stunServerKey));
445
_stunServer = val->getValue();
449
// Init stun server name with default server name
450
_stunServerName = pj_str ( (char*) _stunServer.data());
452
credMap = (Conf::MappingNode *) (map->getValue (credKey));
455
credentials.unserialize (credMap);
457
val = (Conf::ScalarNode *) (map->getValue (displayNameKey));
460
_displayName = val->getValue();
465
srtpMap = (Conf::MappingNode *) (map->getValue (srtpKey));
468
throw SipAccountException (" did not found srtp map");
470
val = (Conf::ScalarNode *) (srtpMap->getValue (srtpEnableKey));
473
_srtpEnabled = (val->getValue().compare ("true") == 0) ? true : false;
477
val = (Conf::ScalarNode *) (srtpMap->getValue (keyExchangeKey));
480
_srtpKeyExchange = val->getValue();
484
val = (Conf::ScalarNode *) (srtpMap->getValue (rtpFallbackKey));
487
_srtpFallback = (val->getValue().compare ("true") == 0) ? true : false;
492
zrtpMap = (Conf::MappingNode *) (map->getValue (zrtpKey));
495
throw SipAccountException (" did not found zrtp map");
497
val = (Conf::ScalarNode *) (zrtpMap->getValue (displaySasKey));
500
_zrtpDisplaySas = (val->getValue().compare ("true") == 0) ? true : false;
504
val = (Conf::ScalarNode *) (zrtpMap->getValue (displaySasOnceKey));
507
_zrtpDisplaySasOnce = (val->getValue().compare ("true") == 0) ? true : false;
511
val = (Conf::ScalarNode *) (zrtpMap->getValue (helloHashEnabledKey));
514
_zrtpHelloHash = (val->getValue().compare ("true") == 0) ? true : false;
518
val = (Conf::ScalarNode *) (zrtpMap->getValue (notSuppWarningKey));
521
_zrtpNotSuppWarning = (val->getValue().compare ("true") == 0) ? true : false;
526
tlsMap = (Conf::MappingNode *) (map->getValue (tlsKey));
529
throw SipAccountException (" did not found tls map");
531
val = (Conf::ScalarNode *) (tlsMap->getValue (tlsEnableKey));
534
_tlsEnable = val->getValue();
538
val = (Conf::ScalarNode *) (tlsMap->getValue (tlsPortKey));
541
_tlsPortStr = val->getValue();
545
val = (Conf::ScalarNode *) (tlsMap->getValue (certificateKey));
548
_tlsCertificateFile = val->getValue();
552
val = (Conf::ScalarNode *) (tlsMap->getValue (calistKey));
555
_tlsCaListFile = val->getValue();
559
val = (Conf::ScalarNode *) (tlsMap->getValue (ciphersKey));
562
_tlsCiphers = val->getValue();
566
val = (Conf::ScalarNode *) (tlsMap->getValue (methodKey));
569
_tlsMethod = val->getValue();
573
val = (Conf::ScalarNode *) (tlsMap->getValue (timeoutKey));
575
if (val) _tlsNegotiationTimeoutSec = val->getValue();
578
_tlsNegotiationTimeoutMsec = val->getValue();
582
val = (Conf::ScalarNode *) (tlsMap->getValue (tlsPasswordKey));
585
_tlsPassword = val->getValue();
589
val = (Conf::ScalarNode *) (tlsMap->getValue (privateKeyKey));
592
_tlsPrivateKeyFile = val->getValue();
596
val = (Conf::ScalarNode *) (tlsMap->getValue (requireCertifKey));
599
_tlsRequireClientCertificate = (val->getValue().compare ("true") == 0) ? true : false;
603
val = (Conf::ScalarNode *) (tlsMap->getValue (serverKey));
606
_tlsServerName = val->getValue();
610
val = (Conf::ScalarNode *) (tlsMap->getValue (verifyClientKey));
613
_tlsVerifyServer = (val->getValue().compare ("true") == 0) ? true : false;
617
val = (Conf::ScalarNode *) (tlsMap->getValue (verifyServerKey));
620
_tlsVerifyClient = (val->getValue().compare ("true") == 0) ? true : false;
624
Account::loadAudioCodecs();
629
void SIPAccount::setAccountDetails (const std::map<std::string, std::string>& details)
632
std::map<std::string, std::string> map_cpy;
633
std::map<std::string, std::string>::iterator iter;
635
_debug ("SipAccount: set account details %s", _accountID.c_str());
642
std::string hostname;
643
std::string username;
644
std::string password;
646
std::string accountEnable;
647
std::string ringtonePath;
648
std::string ringtoneEnabled;
650
// Account setting common to SIP and IAX
651
find_in_map (CONFIG_ACCOUNT_ALIAS, alias)
652
find_in_map (CONFIG_ACCOUNT_TYPE, type)
653
find_in_map (HOSTNAME, hostname)
654
find_in_map (USERNAME, username)
655
find_in_map (PASSWORD, password)
656
find_in_map (CONFIG_ACCOUNT_MAILBOX, mailbox);
657
find_in_map (CONFIG_ACCOUNT_ENABLE, accountEnable);
658
find_in_map (CONFIG_RINGTONE_PATH, ringtonePath);
659
find_in_map (CONFIG_RINGTONE_ENABLED, ringtoneEnabled);
663
setUsername (username);
664
setHostname (hostname);
665
setPassword (password);
666
setEnabled ( (accountEnable == "true"));
667
setRingtonePath (ringtonePath);
668
setRingtoneEnabled ( (ringtoneEnabled == "true"));
669
setMailBox (mailbox);
671
// SIP specific account settings
672
if (getType() == "SIP") {
676
std::string routeset;
677
std::string authenticationName;
679
std::string resolveOnce;
680
std::string registrationExpire;
682
std::string displayName;
683
std::string localInterface;
684
std::string publishedSameasLocal;
685
std::string localAddress;
686
std::string publishedAddress;
687
std::string localPort;
688
std::string publishedPort;
689
std::string stunEnable;
690
std::string stunServer;
691
std::string dtmfType;
692
std::string srtpEnable;
693
std::string srtpRtpFallback;
694
std::string zrtpDisplaySas;
695
std::string zrtpDisplaySasOnce;
696
std::string zrtpNotSuppWarning;
697
std::string zrtpHelloHash;
698
std::string srtpKeyExchange;
700
std::string tlsListenerPort;
701
std::string tlsEnable;
702
std::string tlsCaListFile;
703
std::string tlsCertificateFile;
704
std::string tlsPrivateKeyFile;
705
std::string tlsPassword;
706
std::string tlsMethod;
707
std::string tlsCiphers;
708
std::string tlsServerName;
709
std::string tlsVerifyServer;
710
std::string tlsVerifyClient;
711
std::string tlsRequireClientCertificate;
712
std::string tlsNegotiationTimeoutSec;
713
std::string tlsNegotiationTimeoutMsec;
715
// general sip settings
716
find_in_map (DISPLAY_NAME, displayName)
717
find_in_map (ROUTESET, routeset)
718
find_in_map (LOCAL_INTERFACE, localInterface)
719
find_in_map (PUBLISHED_SAMEAS_LOCAL, publishedSameasLocal)
720
find_in_map (PUBLISHED_ADDRESS, publishedAddress)
721
find_in_map (LOCAL_PORT, localPort)
722
find_in_map (PUBLISHED_PORT, publishedPort)
723
find_in_map (STUN_ENABLE, stunEnable)
724
find_in_map (STUN_SERVER, stunServer)
725
find_in_map (ACCOUNT_DTMF_TYPE, dtmfType)
726
find_in_map (CONFIG_ACCOUNT_RESOLVE_ONCE, resolveOnce)
727
find_in_map (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, registrationExpire)
729
setDisplayName (displayName);
730
setServiceRoute (routeset);
731
setLocalInterface (localInterface);
732
setPublishedSameasLocal ( (publishedSameasLocal.compare ("true") == 0) ? true : false);
733
setPublishedAddress (publishedAddress);
734
setLocalPort (atoi (localPort.data()));
735
setPublishedPort (atoi (publishedPort.data()));
736
setStunServer (stunServer);
737
setStunEnabled ( (stunEnable == "true"));
738
setDtmfType ( (dtmfType == "overrtp") ? OVERRTP : SIPINFO);
740
setResolveOnce ( (resolveOnce.compare ("true") ==0) ? true : false);
741
setRegistrationExpire (registrationExpire);
744
find_in_map (REALM, realm)
745
find_in_map (AUTHENTICATION_USERNAME, authenticationName)
746
find_in_map (USERAGENT, ua_name)
748
setUseragent (ua_name);
751
find_in_map (SRTP_ENABLE, srtpEnable)
752
find_in_map (SRTP_RTP_FALLBACK, srtpRtpFallback)
753
find_in_map (ZRTP_DISPLAY_SAS, zrtpDisplaySas)
754
find_in_map (ZRTP_DISPLAY_SAS_ONCE, zrtpDisplaySasOnce)
755
find_in_map (ZRTP_NOT_SUPP_WARNING, zrtpNotSuppWarning)
756
find_in_map (ZRTP_HELLO_HASH, zrtpHelloHash)
757
find_in_map (SRTP_KEY_EXCHANGE, srtpKeyExchange)
759
setSrtpEnable ( (srtpEnable.compare ("true") == 0) ? true : false);
760
setSrtpFallback ( (srtpRtpFallback.compare ("true") == 0) ? true : false);
761
setZrtpDisplaySas ( (zrtpDisplaySas.compare ("true") == 0) ? true : false);
762
setZrtpDiaplaySasOnce ( (zrtpDisplaySasOnce.compare ("true") == 0) ? true : false);
763
setZrtpNotSuppWarning ( (zrtpNotSuppWarning.compare ("true") == 0) ? true : false);
764
setZrtpHelloHash ( (zrtpHelloHash.compare ("true") == 0) ? true : false);
765
// sipaccount->setSrtpKeyExchange((srtpKeyExchange.compare("true") == 0) ? true : false);
766
setSrtpKeyExchange (srtpKeyExchange);
769
// The TLS listener is unique and globally defined through IP2IP_PROFILE
770
if (_accountID == IP2IP_PROFILE) {
771
find_in_map (TLS_LISTENER_PORT, tlsListenerPort)
774
find_in_map (TLS_ENABLE, tlsEnable)
775
find_in_map (TLS_CA_LIST_FILE, tlsCaListFile)
776
find_in_map (TLS_CERTIFICATE_FILE, tlsCertificateFile)
777
find_in_map (TLS_PRIVATE_KEY_FILE, tlsPrivateKeyFile)
778
find_in_map (TLS_PASSWORD, tlsPassword)
779
find_in_map (TLS_METHOD, tlsMethod)
780
find_in_map (TLS_CIPHERS, tlsCiphers)
781
find_in_map (TLS_SERVER_NAME, tlsServerName)
782
find_in_map (TLS_VERIFY_SERVER, tlsVerifyServer)
783
find_in_map (TLS_VERIFY_CLIENT, tlsVerifyClient)
784
find_in_map (TLS_REQUIRE_CLIENT_CERTIFICATE, tlsRequireClientCertificate)
785
find_in_map (TLS_NEGOTIATION_TIMEOUT_SEC, tlsNegotiationTimeoutSec)
786
find_in_map (TLS_NEGOTIATION_TIMEOUT_MSEC, tlsNegotiationTimeoutMsec)
788
if (_accountID == IP2IP_PROFILE) {
789
setTlsListenerPort (atoi (tlsListenerPort.data()));
792
setTlsEnable (tlsEnable);
793
setTlsCaListFile (tlsCaListFile);
794
setTlsCertificateFile (tlsCertificateFile);
795
setTlsPrivateKeyFile (tlsPrivateKeyFile);
796
setTlsPassword (tlsPassword);
797
setTlsMethod (tlsMethod);
798
setTlsCiphers (tlsCiphers);
799
setTlsServerName (tlsServerName);
800
setTlsVerifyServer (tlsVerifyServer.compare ("true") ? true : false);
801
setTlsVerifyClient (tlsVerifyServer.compare ("true") ? true : false);
802
setTlsRequireClientCertificate (tlsRequireClientCertificate.compare ("true") ? true : false);
803
setTlsNegotiationTimeoutSec (tlsNegotiationTimeoutSec);
804
setTlsNegotiationTimeoutMsec (tlsNegotiationTimeoutMsec);
806
if (!Manager::instance().preferences.getMd5Hash()) {
807
setPassword (password);
809
// Make sure not to re-hash the password field if
810
// it is already saved as a MD5 Hash.
811
// TODO: This test is weak. Fix this.
812
if ( (password.compare (getPassword()) != 0)) {
813
_debug ("SipAccount: Password sent and password from config are different. Re-hashing");
816
if (authenticationName.empty()) {
817
hash = Manager::instance().computeMd5HashFromCredential (username, password, realm);
819
hash = Manager::instance().computeMd5HashFromCredential (authenticationName, password, realm);
828
std::map<std::string, std::string> SIPAccount::getAccountDetails()
830
_debug ("SipAccount: get account details %s", _accountID.c_str());
832
std::map<std::string, std::string> a;
834
a.insert (std::pair<std::string, std::string> (ACCOUNT_ID, _accountID));
835
// The IP profile does not allow to set an alias
836
(_accountID == IP2IP_PROFILE) ?
837
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, IP2IP_PROFILE)) :
838
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ALIAS, getAlias()));
840
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_ENABLE, isEnabled() ? "true" : "false"));
841
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_TYPE, getType()));
842
a.insert (std::pair<std::string, std::string> (HOSTNAME, getHostname()));
843
a.insert (std::pair<std::string, std::string> (USERNAME, getUsername()));
844
a.insert (std::pair<std::string, std::string> (PASSWORD, getPassword()));
846
a.insert (std::pair<std::string, std::string> (CONFIG_RINGTONE_PATH, getRingtonePath()));
847
a.insert (std::pair<std::string, std::string> (CONFIG_RINGTONE_ENABLED, getRingtoneEnabled() ? "true" : "false"));
849
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_MAILBOX, getMailBox()));
852
RegistrationState state = Unregistered;
853
std::string registrationStateCode;
854
std::string registrationStateDescription;
857
if (_accountID == IP2IP_PROFILE) {
858
registrationStateCode = EMPTY_FIELD;
859
registrationStateDescription = "Direct IP call";
861
state = getRegistrationState();
862
int code = getRegistrationStateDetailed().first;
863
std::stringstream out;
865
registrationStateCode = out.str();
866
registrationStateDescription = getRegistrationStateDetailed().second;
870
(_accountID == IP2IP_PROFILE) ?
871
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, "READY")) :
872
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATUS, Manager::instance().mapStateNumberToString (state)));
874
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATE_CODE, registrationStateCode));
875
a.insert (std::pair<std::string, std::string> (REGISTRATION_STATE_DESCRIPTION, registrationStateDescription));
878
// Add sip specific details
879
if (getType() == "SIP") {
881
a.insert (std::pair<std::string, std::string> (ROUTESET, getServiceRoute()));
882
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_RESOLVE_ONCE, isResolveOnce() ? "true" : "false"));
883
a.insert (std::pair<std::string, std::string> (REALM, _realm));
884
a.insert (std::pair<std::string, std::string> (USERAGENT, getUseragent()));
886
a.insert (std::pair<std::string, std::string> (CONFIG_ACCOUNT_REGISTRATION_EXPIRE, getRegistrationExpire()));
887
a.insert (std::pair<std::string, std::string> (LOCAL_INTERFACE, getLocalInterface()));
888
a.insert (std::pair<std::string, std::string> (PUBLISHED_SAMEAS_LOCAL, getPublishedSameasLocal() ? "true" : "false"));
889
a.insert (std::pair<std::string, std::string> (PUBLISHED_ADDRESS, getPublishedAddress()));
891
std::stringstream localport;
892
localport << getLocalPort();
893
a.insert (std::pair<std::string, std::string> (LOCAL_PORT, localport.str()));
894
std::stringstream publishedport;
895
publishedport << getPublishedPort();
896
a.insert (std::pair<std::string, std::string> (PUBLISHED_PORT, publishedport.str()));
897
a.insert (std::pair<std::string, std::string> (STUN_ENABLE, isStunEnabled() ? "true" : "false"));
898
a.insert (std::pair<std::string, std::string> (STUN_SERVER, getStunServer()));
899
a.insert (std::pair<std::string, std::string> (ACCOUNT_DTMF_TYPE, (getDtmfType() == OVERRTP) ? "overrtp" : "sipinfo"));
901
a.insert (std::pair<std::string, std::string> (SRTP_KEY_EXCHANGE, getSrtpKeyExchange()));
902
a.insert (std::pair<std::string, std::string> (SRTP_ENABLE, getSrtpEnable() ? "true" : "false"));
903
a.insert (std::pair<std::string, std::string> (SRTP_RTP_FALLBACK, getSrtpFallback() ? "true" : "false"));
905
a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS, getZrtpDisplaySas() ? "true" : "false"));
906
a.insert (std::pair<std::string, std::string> (ZRTP_DISPLAY_SAS_ONCE, getZrtpDiaplaySasOnce() ? "true" : "false"));
907
a.insert (std::pair<std::string, std::string> (ZRTP_HELLO_HASH, getZrtpHelloHash() ? "true" : "false"));
908
a.insert (std::pair<std::string, std::string> (ZRTP_NOT_SUPP_WARNING, getZrtpNotSuppWarning() ? "true" : "false"));
910
// TLS listener is unique and parameters are modified through IP2IP_PROFILE
911
std::stringstream tlslistenerport;
912
tlslistenerport << getTlsListenerPort();
913
a.insert (std::pair<std::string, std::string> (TLS_LISTENER_PORT, tlslistenerport.str()));
914
a.insert (std::pair<std::string, std::string> (TLS_ENABLE, getTlsEnable()));
915
a.insert (std::pair<std::string, std::string> (TLS_CA_LIST_FILE, getTlsCaListFile()));
916
a.insert (std::pair<std::string, std::string> (TLS_CERTIFICATE_FILE, getTlsCertificateFile()));
917
a.insert (std::pair<std::string, std::string> (TLS_PRIVATE_KEY_FILE, getTlsPrivateKeyFile()));
918
a.insert (std::pair<std::string, std::string> (TLS_PASSWORD, getTlsPassword()));
919
a.insert (std::pair<std::string, std::string> (TLS_METHOD, getTlsMethod()));
920
a.insert (std::pair<std::string, std::string> (TLS_CIPHERS, getTlsCiphers()));
921
a.insert (std::pair<std::string, std::string> (TLS_SERVER_NAME, getTlsServerName()));
922
a.insert (std::pair<std::string, std::string> (TLS_VERIFY_SERVER, getTlsVerifyServer() ? "true" : "false"));
923
a.insert (std::pair<std::string, std::string> (TLS_VERIFY_CLIENT, getTlsVerifyClient() ? "true" : "false"));
924
a.insert (std::pair<std::string, std::string> (TLS_REQUIRE_CLIENT_CERTIFICATE, getTlsRequireClientCertificate() ? "true" : "false"));
925
a.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_SEC, getTlsNegotiationTimeoutSec()));
926
a.insert (std::pair<std::string, std::string> (TLS_NEGOTIATION_TIMEOUT_MSEC, getTlsNegotiationTimeoutMsec()));
82
935
// void SIPAccount::setVoIPLink(VoIPLink *link) {
83
void SIPAccount::setVoIPLink() {
936
void SIPAccount::setVoIPLink()
85
939
_link = SIPVoIPLink::instance ("");
86
940
dynamic_cast<SIPVoIPLink*> (_link)->incrementClients();