diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index a5fc52eadf2894796ce21b3bec1fa60058d5d330..c0734777c469d9fd9cce496766d2d505befb949c 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -982,6 +982,7 @@ ManagerImpl::initConfigFile (void) fill_config_int(CONFIG_MAIL_NOTIFY , NO_STR); fill_config_int(CONFIG_VOLUME , YES_STR); fill_config_int(CONFIG_HISTORY , DFT_MAX_CALLS); + fill_config_int(REGISTRATION_EXPIRE , DFT_EXPIRE_VALUE); // Loads config from ~/.sflphone/sflphonedrc or so.. if (createSettingsPath() == 1) { @@ -1406,6 +1407,12 @@ ManagerImpl::getMailNotify( void ) return getConfigInt( PREFERENCES , CONFIG_MAIL_NOTIFY ); } +int +ManagerImpl::getRegistrationExpireValue( void) +{ + return getConfigInt( PREFERENCES , REGISTRATION_EXPIRE ); +} + void ManagerImpl::setMailNotify( void ) { diff --git a/src/managerimpl.h b/src/managerimpl.h index d6aa83be7703f96cadd40daea25e2d1473afb0c7..9b4c4dd54936ebc2aa879ea2bb1f0dbb06b1b455 100644 --- a/src/managerimpl.h +++ b/src/managerimpl.h @@ -551,6 +551,11 @@ class ManagerImpl { */ ::DBus::Int32 getMailNotify( void ); + /** + * Get the expire value for SIP registration, set in the user configuration file + */ + int getRegistrationExpireValue( void ); + /** * Retrieve the formatted list of codecs payload in the user config file and * load in the active list of codecs diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 8cfafdcaad06645d5335bc9c613a14a6afd2ae34..6ef973af35cf73834bc0bf5edbd6cc484b4b994b 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -39,7 +39,7 @@ #define EXOSIP_ERROR_BUILDING -2 // for registration -#define EXPIRES_VALUE 180 +//#define EXPIRES_VALUE 180 // 1XX responses #define DIALOG_ESTABLISHED 101 @@ -443,6 +443,8 @@ SIPVoIPLink::getEvent() bool SIPVoIPLink::sendRegister() { + int expire_value = Manager::instance().getRegistrationExpireValue(); + _debug("SIP Registration Expire Value = %i\n" , expire_value); if (_eXosipRegID != EXOSIP_ERROR_STD) { return false; @@ -466,11 +468,11 @@ SIPVoIPLink::sendRegister() if (!_proxy.empty()) { _debug("* SIP Info: Register from: %s to %s\n", from.data(), proxy.data()); _eXosipRegID = eXosip_register_build_initial_register(from.data(), - proxy.data(), NULL, EXPIRES_VALUE, ®); + proxy.data(), NULL, expire_value, ®); } else { _debug("* SIP Info: Register from: %s to %s\n", from.data(), hostname.data()); _eXosipRegID = eXosip_register_build_initial_register(from.data(), - hostname.data(), NULL, EXPIRES_VALUE, ®); + hostname.data(), NULL, expire_value, ®); } eXosip_unlock(); if (_eXosipRegID < EXOSIP_ERROR_NO ) { diff --git a/src/user_cfg.h b/src/user_cfg.h index e01e0615fc7f3baf6b352c4f5aa8b67896d3086e..c6b10556ade891ea35a8de6a0711fbc2fa0669ec 100644 --- a/src/user_cfg.h +++ b/src/user_cfg.h @@ -58,6 +58,7 @@ #define CONFIG_POPUP "Window.popup" /** SFLphone pops up on incoming calls or not */ #define CONFIG_VOLUME "Volume.display" /** Display the mic and speaker volume controls */ #define CONFIG_ZEROCONF "Zeroconf.enable" /** Zero configuration networking module */ +#define REGISTRATION_EXPIRE "Registration.expire" /** Registration expire value */ #define SIGNALISATION "VoIPLink" /** Section Signalisation */ #define PLAY_DTMF "DTMF.playDtmf" /** Whether or not should play dtmf */ @@ -82,6 +83,7 @@ #define DFT_SAMPLE_RATE "44100" /** Default sample rate in HZ */ #define DFT_NOTIF_LEVEL "2" /** Default desktop notification level : maximum */ #define DFT_MAX_CALLS "20" /** Default maximum calls in history */ +#define DFT_EXPIRE_VALUE "180" /** Default expire value for registration */ #ifdef USE_ZEROCONF #define CONFIG_ZEROCONF_DEFAULT_STR "1" /** Default Zero configuration networking module value */