diff --git a/sflphone-common/src/account.cpp b/sflphone-common/src/account.cpp index df26904f5b079d19fd6e95b59af9bea66883e9e2..66f78f4786547b35207a70e04b7861a4e61c8835 100644 --- a/sflphone-common/src/account.cpp +++ b/sflphone-common/src/account.cpp @@ -40,6 +40,8 @@ Account::Account (const AccountID& accountID, std::string type) : , _type (type) , _codecOrder () , _codecStr("") + , _ringtonePath("/usr/share/sflphone/ringtones/konga.ul") + , _ringtoneEnabled(true) , _displayName("") , _useragent("SFLphone") { diff --git a/sflphone-common/src/account.h b/sflphone-common/src/account.h index 183b6789b1214b7d9c81ae31271361d55fa7a91d..2e5bb2c849aa9c81d0a2329a7d82e5f3af1cc574 100644 --- a/sflphone-common/src/account.h +++ b/sflphone-common/src/account.h @@ -259,9 +259,15 @@ class Account : public Serializable{ * Accessor to data structures * @return CodecOrder& The list that reflects the user's choice */ - inline CodecOrder& getActiveCodecs() { return _codecOrder; } + inline CodecOrder& getActiveCodecs(void) { return _codecOrder; } void setActiveCodecs (const std::vector <std::string>& list); + inline std::string getRingtonePath(void) { return _ringtonePath; } + inline void setRingtonePath(std::string path) { _ringtonePath = path; } + + inline bool getRingtoneEnabled(void) { return _ringtoneEnabled; } + inline void setRingtoneEnabled(bool enabl) { _ringtoneEnabled = enabl; } + inline std::string getDisplayName(void) { return _displayName; } inline void setDisplayName(std::string name) { _displayName = name; } @@ -344,9 +350,24 @@ class Account : public Serializable{ */ std::string _codecStr; - // Display Name that can be used in SIP URI. + /** + * Ringtone .au file used for this account + */ + std::string _ringtonePath; + + /** + * Play ringtone when receiving a call + */ + bool _ringtoneEnabled; + + /** + * Display name when calling + */ std::string _displayName; + /** + * Useragent used for registration + */ std::string _useragent; }; diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index 662c7f16462e24229e526a1f4a9bec41ac2d5280..3784b3db8a4a553406ec82e14910fc00673656a2 100755 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -2361,8 +2361,17 @@ void ManagerImpl::ringtoneEnabled (void) { } std::string ManagerImpl::getRingtoneChoice (void) { - // we need the absolute path - std::string tone_name = audioPreference.getRingchoice(); + + // retreive specified account id + Account *account = getAccount(IP2IP_PROFILE); + + if(!account) { + _warn("Manager: Warning: Not a valid account ID for ringone choice"); + return std::string(""); + } + + // we need the absolute path + std::string tone_name = account->getRingtonePath(); std::string tone_path; if (tone_name.find(DIR_SEPARATOR_CH) == std::string::npos) { @@ -2374,14 +2383,23 @@ std::string ManagerImpl::getRingtoneChoice (void) { tone_path = tone_name; } - _debug ("%s", tone_path.c_str()); + _debug ("Manager: get ringtone path %s", tone_path.c_str()); return tone_path; } void ManagerImpl::setRingtoneChoice (const std::string& tone) { + + // retreive specified account id + Account *account = getAccount(IP2IP_PROFILE); + + if(!account) { + _warn("Manager: Warning: Not a valid account ID for ringtone choice"); + return; + } + // we save the absolute path - audioPreference.setRingchoice(tone); + account->setRingtonePath(tone); } std::string ManagerImpl::getRecordPath (void) { @@ -2389,7 +2407,7 @@ std::string ManagerImpl::getRecordPath (void) { } void ManagerImpl::setRecordPath (const std::string& recPath) { - _debug ("ManagerImpl::setRecordPath(%s)! ", recPath.c_str()); + _debug ("Manager: Set record path %s", recPath.c_str()); audioPreference.setRecordpath(recPath); } @@ -3952,3 +3970,4 @@ std::vector<std::string> ManagerImpl::getParticipantList ( return v; } + diff --git a/sflphone-common/src/preferences.cpp b/sflphone-common/src/preferences.cpp index 2663346dedf1bc7c0d74f791014a94f6bfc3ebed..cf961ba324559c11da245e46756dfb0cb7174ff9 100644 --- a/sflphone-common/src/preferences.cpp +++ b/sflphone-common/src/preferences.cpp @@ -31,13 +31,14 @@ #include "preferences.h" #include <sstream> #include "global.h" +#include "user_cfg.h" Preferences::Preferences() : _accountOrder("") , _audioApi(0) , _historyLimit(30) , _historyMaxCalls(20) , _notifyMails(false) - , _zoneToneChoice("North America") // DFT_ZONE + , _zoneToneChoice(DFT_ZONE) // DFT_ZONE , _registrationExpire(180) , _ringtoneEnabled(true) // CONFIG_RINGTONE , _portNum(5060) @@ -131,10 +132,10 @@ void Preferences::unserialize(Conf::MappingNode *map) VoipPreference::VoipPreference() : _playDtmf(true) , _playTones(true) - , _pulseLength(250)// DFT_PULSE_LENGTH_STR + , _pulseLength(atoi(DFT_PULSE_LENGTH_STR))// DFT_PULSE_LENGTH_STR , _sendDtmfAs(0) , _symmetricRtp(true) - , _zidFile("zidFile")// ZRTP_ZID_FILENAME + , _zidFile(ZRTP_ZIDFILE)// ZRTP_ZID_FILENAME { } @@ -314,10 +315,10 @@ void HookPreference::unserialize(Conf::MappingNode *map) -AudioPreference::AudioPreference() : _cardin(0) // ALSA_DFT_CARD - , _cardout(0) // ALSA_DFT_CARD - , _cardring(0) // ALSA_DFT_CARD - , _framesize(20) // DFT_FRAME_SIZE +AudioPreference::AudioPreference() : _cardin(atoi(ALSA_DFT_CARD)) // ALSA_DFT_CARD + , _cardout(atoi(ALSA_DFT_CARD)) // ALSA_DFT_CARD + , _cardring(atoi(ALSA_DFT_CARD)) // ALSA_DFT_CARD + , _framesize(atoi(DFT_FRAME_SIZE)) // DFT_FRAME_SIZE , _plugin("default") // PCM_DEFAULT , _smplrate(44100) // DFT_SAMPLE_RATE , _devicePlayback("") @@ -325,8 +326,8 @@ AudioPreference::AudioPreference() : _cardin(0) // ALSA_DFT_CARD , _deviceRingtone("") , _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 + , _volumemic(atoi(DFT_VOL_SPKR_STR)) // DFT_VOL_SPKR_STR + , _volumespkr(atoi(DFT_VOL_MICRO_STR)) // DFT_VOL_MICRO_STR { } diff --git a/sflphone-common/src/preferences.h b/sflphone-common/src/preferences.h index 9ef4de1edf5d58adb06a618d92461029edcc9bd8..69ee938b2c185f146194c87004a9ac3456882072 100755 --- a/sflphone-common/src/preferences.h +++ b/sflphone-common/src/preferences.h @@ -72,7 +72,7 @@ const Conf::Key sipEnabledKey("sipEnabled"); //: false const Conf::Key urlCommandKey("urlCommand"); //: x-www-browser const Conf::Key urlSipFieldKey("urlSipField"); //: X-sflphone-url - +// audio preferences const Conf::Key alsamapKey("alsa"); const Conf::Key pulsemapKey("pulse"); const Conf::Key cardinKey("cardin");// : 0 diff --git a/sflphone-common/src/user_cfg.h b/sflphone-common/src/user_cfg.h index 910e3f9e15691e625918a4eab7920034ca078ca7..1440f6c54d47566050b5ff30cf0f48be71fc92ea 100644 --- a/sflphone-common/src/user_cfg.h +++ b/sflphone-common/src/user_cfg.h @@ -84,7 +84,7 @@ #define IP2IP_PROFILE "IP2IP" #define SIGNALISATION "VoIPLink" /** Section Signalisation */ -#define ZRTP_ZIDFILE "ZRTP.zidFile" /** The filename used for storing ZIDs */ +#define ZRTP_ZIDFILE "zidFile" /** The filename used for storing ZIDs */ #define PLAY_DTMF "DTMF.playDtmf" /** Whether or not should play dtmf */ #define PLAY_TONES "DTMF.playTones" /** Whether or not should play tones */ #define PULSE_LENGTH "DTMF.pulseLength" /** Length of the DTMF in millisecond */