diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 355844ecde24bfba960a692c5fbf54952bb0c710..8eafb6212dd1ab18f201ab68e735d01e1ba1a3ea 100755 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -2051,206 +2051,21 @@ void ManagerImpl::initConfigFile (bool load_user_value, std::string alternate) { _debug ("Manager: Init config file"); - // Default values, that will be overwritten by the call to - // 'populateFromFile' below. - - // Peer to peer settings - /* - _config.addDefaultValue(std::pair<std::string, std::string>(SRTP_ENABLE, - FALSE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - SRTP_RTP_FALLBACK, FALSE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - SRTP_KEY_EXCHANGE, "1"), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - ZRTP_HELLO_HASH, TRUE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - ZRTP_DISPLAY_SAS, TRUE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - ZRTP_DISPLAY_SAS_ONCE, FALSE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - ZRTP_NOT_SUPP_WARNING, TRUE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_LISTENER_PORT, DEFAULT_SIP_TLS_PORT), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>(TLS_ENABLE, - FALSE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_CA_LIST_FILE, EMPTY_FIELD), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_CERTIFICATE_FILE, EMPTY_FIELD), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_PRIVATE_KEY_FILE, EMPTY_FIELD), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>(TLS_PASSWORD, - EMPTY_FIELD), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>(TLS_METHOD, - "TLSv1"), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>(TLS_CIPHERS, - EMPTY_FIELD), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_SERVER_NAME, EMPTY_FIELD), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_VERIFY_SERVER, TRUE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_VERIFY_CLIENT, TRUE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_REQUIRE_CLIENT_CERTIFICATE, TRUE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_NEGOTIATION_TIMEOUT_SEC, "2"), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - TLS_NEGOTIATION_TIMEOUT_MSEC, "0"), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - LOCAL_INTERFACE, "default"), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - PUBLISHED_SAMEAS_LOCAL, TRUE_STR), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>(LOCAL_PORT, - DEFAULT_SIP_PORT), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>(PUBLISHED_PORT, - DEFAULT_SIP_PORT), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - PUBLISHED_ADDRESS, DEFAULT_ADDRESS), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>(STUN_ENABLE, - DFT_STUN_ENABLE), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>(STUN_SERVER, - DFT_STUN_SERVER), IP2IP_PROFILE); - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_ACCOUNT_ALIAS, EMPTY_FIELD), IP2IP_PROFILE); - */ - // Init display name to the username under which // this sflphone instance is running. - std::string diplayName(""); uid_t uid = getuid(); struct passwd * user_info = NULL; user_info = getpwuid(uid); - if (user_info != NULL) { - diplayName = user_info->pw_name; - } - - /* - _config.addDefaultValue(std::pair<std::string, std::string>(DISPLAY_NAME, - diplayName), IP2IP_PROFILE); - - // Signalisation settings - _config.addDefaultValue(std::pair<std::string, std::string>(SYMMETRIC, - TRUE_STR), SIGNALISATION); - _config.addDefaultValue(std::pair<std::string, std::string>(PLAY_DTMF, - TRUE_STR), SIGNALISATION); - _config.addDefaultValue(std::pair<std::string, std::string>(PLAY_TONES, - TRUE_STR), SIGNALISATION); - _config.addDefaultValue(std::pair<std::string, std::string>(PULSE_LENGTH, - DFT_PULSE_LENGTH_STR), SIGNALISATION); - _config.addDefaultValue(std::pair<std::string, std::string>(SEND_DTMF_AS, - SIP_INFO_STR), SIGNALISATION); - _config.addDefaultValue(std::pair<std::string, std::string>(ZRTP_ZIDFILE, - ZRTP_ZID_FILENAME), SIGNALISATION); - - // Audio settings - _config.addDefaultValue(std::pair<std::string, std::string>( - ALSA_CARD_ID_IN, ALSA_DFT_CARD), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>( - ALSA_CARD_ID_OUT, ALSA_DFT_CARD), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>( - ALSA_CARD_ID_RING, ALSA_DFT_CARD), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>( - AUDIO_SAMPLE_RATE, DFT_SAMPLE_RATE), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>( - ALSA_FRAME_SIZE, DFT_FRAME_SIZE), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>(ALSA_PLUGIN, - PCM_DEFAULT), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>(RING_CHOICE, - DFT_RINGTONE), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>(VOLUME_SPKR, - DFT_VOL_SPKR_STR), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>(VOLUME_MICRO, - DFT_VOL_MICRO_STR), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>(RECORD_PATH, - DFT_RECORD_PATH), AUDIO); - - // Pulseaudio stream device - _config.addDefaultValue(std::pair<std::string, std::string>(PULSE_DEVICE_PLAYBACK, ""), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>(PULSE_DEVICE_RECORD, ""), AUDIO); - _config.addDefaultValue(std::pair<std::string, std::string>(PULSE_DEVICE_RINGTONE, ""), AUDIO); - - - // General settings - _config.addDefaultValue(std::pair<std::string, std::string>(ZONE_TONE, - DFT_ZONE), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_RINGTONE, TRUE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(CONFIG_DIALPAD, - TRUE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_SEARCHBAR, TRUE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(CONFIG_START, - FALSE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(CONFIG_POPUP, - TRUE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(CONFIG_NOTIFY, - TRUE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_MAIL_NOTIFY, FALSE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(CONFIG_VOLUME, - TRUE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_HISTORY_LIMIT, DFT_HISTORY_LIMIT), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_HISTORY_ENABLED, TRUE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(CONFIG_AUDIO, - DFT_AUDIO_MANAGER), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_SIP_PORT, DFT_SIP_PORT), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_ACCOUNTS_ORDER, EMPTY_FIELD), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(CONFIG_MD5HASH, - FALSE_STR), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(WINDOW_WIDTH, - DFT_WINDOW_WIDTH), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>(WINDOW_HEIGHT, - DFT_WINDOW_HEIGHT), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - WINDOW_POSITION_X, "0"), PREFERENCES); - _config.addDefaultValue(std::pair<std::string, std::string>( - WINDOW_POSITION_Y, "0"), PREFERENCES); - - // Addressbook settings - _config.addDefaultValue(std::pair<std::string, std::string>( - ADDRESSBOOK_ENABLE, TRUE_STR), ADDRESSBOOK); - _config.addDefaultValue(std::pair<std::string, std::string>( - ADDRESSBOOK_MAX_RESULTS, "25"), ADDRESSBOOK); - _config.addDefaultValue(std::pair<std::string, std::string>( - ADDRESSBOOK_DISPLAY_CONTACT_PHOTO, FALSE_STR), ADDRESSBOOK); - _config.addDefaultValue(std::pair<std::string, std::string>( - ADDRESSBOOK_DISPLAY_PHONE_BUSINESS, TRUE_STR), ADDRESSBOOK); - _config.addDefaultValue(std::pair<std::string, std::string>( - ADDRESSBOOK_DISPLAY_PHONE_HOME, FALSE_STR), ADDRESSBOOK); - _config.addDefaultValue(std::pair<std::string, std::string>( - ADDRESSBOOK_DISPLAY_PHONE_MOBILE, FALSE_STR), ADDRESSBOOK); - - // Hooks settings - _config.addDefaultValue(std::pair<std::string, std::string>( - URLHOOK_SIP_FIELD, HOOK_DEFAULT_SIP_FIELD), HOOKS); - _config.addDefaultValue(std::pair<std::string, std::string>( - URLHOOK_COMMAND, HOOK_DEFAULT_URL_COMMAND), HOOKS); - _config.addDefaultValue(std::pair<std::string, std::string>( - URLHOOK_SIP_ENABLED, FALSE_STR), HOOKS); - _config.addDefaultValue(std::pair<std::string, std::string>( - URLHOOK_IAX2_ENABLED, FALSE_STR), HOOKS); - _config.addDefaultValue(std::pair<std::string, std::string>( - PHONE_NUMBER_HOOK_ENABLED, FALSE_STR), HOOKS); - _config.addDefaultValue(std::pair<std::string, std::string>( - PHONE_NUMBER_HOOK_ADD_PREFIX, EMPTY_FIELD), HOOKS); - */ - - std::string path; // = "configurationexample.yml"; - // Loads config from ~/.sflphone/sflphonedrc or so.. + std::string path; + // Loads config from ~/.sflphone/sflphoned.yml or so.. if (createSettingsPath() == 1 && load_user_value) { - (alternate == "") ? path = _path : path = alternate; - std::cout << path << std::endl; - _exist = _config.populateFromFile(path); + (alternate == "") ? path = _path : path = alternate; + std::cout << path << std::endl; + _exist = _config.populateFromFile(path); } _debug("Manager: configuration file path: %s", path.c_str()); @@ -2315,52 +2130,6 @@ void ManagerImpl::initConfigFile (bool load_user_value, std::string alternate) { _error("Manager: %s", e.what()); } } - - /* - // Globally shared default values (not to be populated from file) - _config.addDefaultValue(std::pair<std::string, std::string>(HOSTNAME, - EMPTY_FIELD)); - - _config.addDefaultValue(std::pair<std::string, std::string>( - AUTHENTICATION_USERNAME, EMPTY_FIELD)); - - _config.addDefaultValue(std::pair<std::string, std::string>(USERNAME, - EMPTY_FIELD)); - - _config.addDefaultValue(std::pair<std::string, std::string>(PASSWORD, - EMPTY_FIELD)); - - _config.addDefaultValue(std::pair<std::string, std::string>(REALM, - DEFAULT_REALM)); - - _config.addDefaultValue(std::pair<std::string, std::string>(USERAGENT, - DFT_USERAGENT)); - - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_ACCOUNT_REGISTRATION_EXPIRE, DFT_EXPIRE_VALUE)); - - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_ACCOUNT_RESOLVE_ONCE, FALSE_STR)); - - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_ACCOUNT_ALIAS, EMPTY_FIELD)); - - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_ACCOUNT_MAILBOX, EMPTY_FIELD)); - - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_ACCOUNT_ENABLE, TRUE_STR)); - - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_CREDENTIAL_NUMBER, "0")); - - _config.addDefaultValue(std::pair<std::string, std::string>( - CONFIG_ACCOUNT_TYPE, DEFAULT_ACCOUNT_TYPE)); - */ - - // _setupLoaded = (fileExist != 1) ? false : true; - - // _setupLoaded = (_exist == 2) ? false : true; } /** @@ -3278,7 +3047,7 @@ bool ManagerImpl::setConfig (const std::string& section, } void ManagerImpl::setAccountsOrder (const std::string& order) { - _debug ("----------------------------------------- Manager: Set accounts order : %s", order.c_str()); + _debug ("Manager: Set accounts order : %s", order.c_str()); // Set the new config preferences.setAccountOrder(order); diff --git a/sflphone-common/src/preferences.cpp b/sflphone-common/src/preferences.cpp index 2f7573c287fa1869960e33431be216f3f2d3598f..2663346dedf1bc7c0d74f791014a94f6bfc3ebed 100644 --- a/sflphone-common/src/preferences.cpp +++ b/sflphone-common/src/preferences.cpp @@ -37,9 +37,9 @@ Preferences::Preferences() : _accountOrder("") , _historyLimit(30) , _historyMaxCalls(20) , _notifyMails(false) - , _zoneToneChoice("North America") + , _zoneToneChoice("North America") // DFT_ZONE , _registrationExpire(180) - , _ringtoneEnabled(true) + , _ringtoneEnabled(true) // CONFIG_RINGTONE , _portNum(5060) , _searchBarDisplay(true) , _zeroConfenable(false) @@ -131,10 +131,10 @@ void Preferences::unserialize(Conf::MappingNode *map) VoipPreference::VoipPreference() : _playDtmf(true) , _playTones(true) - , _pulseLength(250) + , _pulseLength(250)// DFT_PULSE_LENGTH_STR , _sendDtmfAs(0) , _symmetricRtp(true) - , _zidFile("zidFile") + , _zidFile("zidFile")// ZRTP_ZID_FILENAME { } @@ -191,7 +191,7 @@ void VoipPreference::unserialize(Conf::MappingNode *map) -AddressbookPreference::AddressbookPreference() : _photo(true) +AddressbookPreference::AddressbookPreference() : _photo(true) , _enabled(true) , _list("") , _maxResults(25) @@ -314,19 +314,19 @@ void HookPreference::unserialize(Conf::MappingNode *map) -AudioPreference::AudioPreference() : _cardin(0) - , _cardout(0) - , _cardring(0) - , _framesize(20) - , _plugin("default") - , _smplrate(44100) +AudioPreference::AudioPreference() : _cardin(0) // ALSA_DFT_CARD + , _cardout(0) // ALSA_DFT_CARD + , _cardring(0) // ALSA_DFT_CARD + , _framesize(20) // DFT_FRAME_SIZE + , _plugin("default") // PCM_DEFAULT + , _smplrate(44100) // DFT_SAMPLE_RATE , _devicePlayback("") , _deviceRecord("") , _deviceRingtone("") - , _recordpath("") - , _ringchoice("/usr/share/sflphone/ringtones/konga.ul") - , _volumemic(100) - , _volumespkr(100) + , _recordpath("") // DFT_RECORD_PATH + , _ringchoice("/usr/share/sflphone/ringtones/konga.ul") //DFT_RINGTONE + , _volumemic(100) // DFT_VOL_SPKR_STR + , _volumespkr(100) // DFT_VOL_MICRO_STR { } diff --git a/sflphone-common/src/sip/sipaccount.cpp b/sflphone-common/src/sip/sipaccount.cpp index 3ed3adbf5bf2d742700e2ceb0ec2bf3b271408f5..463f92caf76ed4bb46c24356d31897e5ecf94b09 100755 --- a/sflphone-common/src/sip/sipaccount.cpp +++ b/sflphone-common/src/sip/sipaccount.cpp @@ -99,31 +99,31 @@ SIPAccount::SIPAccount (const AccountID& accountID) , _tlsSetting (NULL) , _dtmfType(OVERRTP) , _tlsEnable("") - , _tlsPortStr("") + , _tlsPortStr(DEFAULT_SIP_TLS_PORT) , _tlsCaListFile("") , _tlsCertificateFile("") , _tlsPrivateKeyFile("") , _tlsPassword("") - , _tlsMethod("") + , _tlsMethod("TLSv1") , _tlsCiphers("") , _tlsServerName("") - , _tlsVerifyServer(false) - , _tlsVerifyClient(false) - , _tlsRequireClientCertificate(false) - , _tlsNegotiationTimeoutSec("") - , _tlsNegotiationTimeoutMsec("") - , _stunServer("stun.sflphone.org") + , _tlsVerifyServer(true) + , _tlsVerifyClient(true) + , _tlsRequireClientCertificate(true) + , _tlsNegotiationTimeoutSec("2") + , _tlsNegotiationTimeoutMsec("0") + , _stunServer(DFT_STUN_SERVER) , _tlsEnabled(false) , _stunEnabled(false) // , _routeSet("") // , _tlsListenerPort("5061") , _srtpEnabled(false) - , _srtpKeyExchange("") + , _srtpKeyExchange("sdes") , _srtpFallback(false) - , _zrtpDisplaySas(false) + , _zrtpDisplaySas(true) , _zrtpDisplaySasOnce(false) - , _zrtpHelloHash(false) - , _zrtpNotSuppWarning(false) + , _zrtpHelloHash(true) + , _zrtpNotSuppWarning(true) { _debug("Sip account constructor called");