diff --git a/sflphone-gtk/src/accountlist.c b/sflphone-gtk/src/accountlist.c index d695c09d072341317d84035b627e35659660d62b..be319e06e77de5b3c03aad40e02552eb1e593eda 100644 --- a/sflphone-gtk/src/accountlist.c +++ b/sflphone-gtk/src/accountlist.c @@ -167,6 +167,9 @@ const gchar * account_state_name(account_state_t s) case ACCOUNT_STATE_ERROR_AUTH: state = _("Bad authentification"); break; + case ACCOUNT_STATE_ERROR_NETWORK: + state = _("Network unreachable"); + break; default: state = _("Invalid"); break; diff --git a/sflphone-gtk/src/accountlist.h b/sflphone-gtk/src/accountlist.h index 1bc24fcb41bda2afbc1d049c274672e7552b6473..5bbdbadf7adb3e55c96f95eaa15127c1ad3738f6 100644 --- a/sflphone-gtk/src/accountlist.h +++ b/sflphone-gtk/src/accountlist.h @@ -36,7 +36,8 @@ typedef enum ACCOUNT_STATE_UNREGISTERED, ACCOUNT_STATE_TRYING, ACCOUNT_STATE_ERROR, - ACCOUNT_STATE_ERROR_AUTH + ACCOUNT_STATE_ERROR_AUTH, + ACCOUNT_STATE_ERROR_NETWORK } account_state_t; /** @struct account_t diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 17fe14861de29f0d2f0c5ccbcd37757ce6a9135f..543d092f1366e86098aa0938f5eabf40a1742a92 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -167,6 +167,10 @@ sflphone_fill_account_list() { a->state = ACCOUNT_STATE_ERROR_AUTH; } + else if(strcmp( status , "ERROR_NETWORK") == 0 ) + { + a->state = ACCOUNT_STATE_ERROR_NETWORK; + } else { a->state = ACCOUNT_STATE_INVALID; diff --git a/sflphone-gtk/src/errors.c b/sflphone-gtk/src/errors.c index d9e5b1437dac382692f90bee85bf5a559c9d54dc..00db523d7842547f407df60ea04bba191bf3d96f 100644 --- a/sflphone-gtk/src/errors.c +++ b/sflphone-gtk/src/errors.c @@ -30,12 +30,6 @@ sflphone_throw_exception( int err ) case ALSA_CAPTURE_DEVICE: markup = g_markup_printf_escaped(_("<b>ALSA notification</b>\n\nError while opening capture device")); break; - case REGISTRATION_FORBIDDEN: - markup = g_markup_printf_escaped(_("<b>Account Registration</b>\n\nBad authentification")); - break; - case REGISTRATION_UNAUTHORIZED: - markup = g_markup_printf_escaped(_("<b>Account Registration</b>\n\nBad authentification")); - break; } main_window_error_message( markup ); free( markup ); diff --git a/sflphone-gtk/src/sflphone_const.h b/sflphone-gtk/src/sflphone_const.h index 76520ca15ac1e6f38169b1496772a19fd0557d25..7587d5af0f57ce8e12e0a19c241877538a749c95 100644 --- a/sflphone-gtk/src/sflphone_const.h +++ b/sflphone-gtk/src/sflphone_const.h @@ -48,10 +48,7 @@ // Error codes for error handling #define ALSA_CAPTURE_DEVICE 0x0001 #define ALSA_PLAYBACK_DEVICE 0x0010 -#define REGISTRATION_FORBIDDEN 0x0011 -#define REGISTRATION_UNAUTHORIZED 0x0100 -#define REGISTRATION_UNREACHABLE 0x0101 -#define NETWORK_UNREACHABLE 0x0110 +#define NETWORK_UNREACHABLE 0x0011 // Customizing-related parameters #define TONE_WITHOUT_MESSAGE 0 diff --git a/src/global.h b/src/global.h index 748d9d4ed11d53611396538e0c2f9a920131db8e..0252b420c0de019ed38b8834a3d2aa86c49f31a0 100644 --- a/src/global.h +++ b/src/global.h @@ -117,9 +117,6 @@ typedef short int16; #define NO_ERROR 0x0000 #define ALSA_CAPTURE_DEVICE 0x0001 #define ALSA_PLAYBACK_DEVICE 0x0010 -#define REGISTRATION_FORBIDDEN 0x0011 -#define REGISTRATION_UNAUTHORIZED 0x0100 -#define REGISTRATION_UNREACHABLE 0x0101 -#define NETWORK_UNREACHABLE 0x0110 +#define NETWORK_UNREACHABLE 0x0011 #endif // __GLOBAL_H__ diff --git a/src/iaxvoiplink.cpp b/src/iaxvoiplink.cpp index 63286e92f923b36fbd943ffae053d5e9ce8848df..68f1cb2e167d436370e31fc8afb90f96ec6fd2e1 100644 --- a/src/iaxvoiplink.cpp +++ b/src/iaxvoiplink.cpp @@ -833,7 +833,7 @@ IAXVoIPLink::iaxHandleRegReply(iax_event* event) _mutexIAX.leaveMutex(); _regSession = NULL; - setRegistrationState(Error, REGISTRATION_FORBIDDEN); + setRegistrationState(Error); //Manager::instance().registrationFailed(getAccountID()); } diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 998d925b5b340eeac05bf087b3c1f76f7bb57a04..808e3588604933903fb820be371cb566f38ac970 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -1969,7 +1969,8 @@ ManagerImpl::getAccountDetails(const AccountID& accountID) (state == VoIPLink::Unregistered ? "UNREGISTERED": (state == VoIPLink::Trying ? "TRYING": (state == VoIPLink::ErrorAuth ? "ERROR_AUTH": - (state == VoIPLink::Error ? "ERROR": "ERROR"))))) + (state == VoIPLink::ErrorNetwork ? "ERROR_NETWORK": + (state == VoIPLink::Error ? "ERROR": "ERROR")))))) ) ); a.insert( @@ -2107,11 +2108,10 @@ ManagerImpl::setAccountDetails( const ::DBus::String& accountID, } } else { // Verify we are already registered, then unregister - if (acc->getRegistrationState() == VoIPLink::Registered) { + //if (acc->getRegistrationState() == VoIPLink::Registered) { _debug("SET ACCOUNTS DETAILS - registered - > non registered\n"); acc->unregisterVoIPLink(); - //unregisterAccount(accountID); - } + //} } // Update account details if (_dbus) _dbus->getConfigurationManager()->accountsChanged(); @@ -2128,33 +2128,18 @@ ManagerImpl::sendRegister( const ::DBus::String& accountID , bool expire ) { // Update the active field setConfig( accountID, CONFIG_ACCOUNT_ENABLE, expire ); - Account* acc = getAccount(accountID); acc->loadConfig(); // Test on the value freshly updated if ( acc->isEnabled() ) { - // As we don't support multiple SIP account, we have to unregister everything before - //AccountMap::iterator iter = _accountMap.begin(); - //while ( iter != _accountMap.end() ) { - //if ( iter->second ) { - //setConfig( iter->first , CONFIG_ACCOUNT_ENABLE , false ); - //iter->second->unregisterVoIPLink(); - //} - //iter++; - //} // Verify we aren't already registered, then register - //if (acc->getRegistrationState() != VoIPLink::Registered) { _debug("Send register for account %s\n" , accountID.c_str()); - //setConfig( accountID , CONFIG_ACCOUNT_ENABLE , true ); acc->registerVoIPLink(); - //} } else { // Verify we are already registered, then unregister - if (acc->getRegistrationState() == VoIPLink::Registered) { _debug("Send unregister for account %s\n" , accountID.c_str()); acc->unregisterVoIPLink(); - } } } diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index e6a18c7993e82a7d5266319d42d199ccef479c97..b33c4042dffd2b3011e25cb5edcd07fb39923c3b 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -200,6 +200,8 @@ SIPVoIPLink::loadSIPLocalIP() if (_localIPAddress == "127.0.0.1") { char* myIPAddress = new char[65]; if (eXosip_guess_localip(AF_INET, myIPAddress, 64) == EXOSIP_ERROR_STD) { + // Update the registration state if no network capabilities found + setRegistrationState( ErrorNetwork ); returnValue = false; } else { _localIPAddress = std::string(myIPAddress); @@ -457,6 +459,7 @@ SIPVoIPLink::sendRegister() { if (_eXosipRegID != EXOSIP_ERROR_STD) { + _debug("nlvnslvnlsnvaljsdnvjlasnvlsfvbnnns sjvlsvn\n"); Manager::instance().displayError("! SIP Error: Registration already sent. Try to unregister"); return false; } @@ -1464,7 +1467,7 @@ SIPVoIPLink::SIPRegistrationFailure( eXosip_event_t* event ) switch( event->response->status_code ) { case SIP_FORBIDDEN: _debug("SIP forbidden\n"); - setRegistrationState(ErrorAuth, REGISTRATION_FORBIDDEN); + setRegistrationState(ErrorAuth); break; case SIP_UNAUTHORIZED: _debug("SIP unauthorized\n"); diff --git a/src/voiplink.cpp b/src/voiplink.cpp index a164a581af498c42e55b927c917946f271d2d8f8..a6cbabe52ae46841e89a7b181bae11b4b3b186c1 100644 --- a/src/voiplink.cpp +++ b/src/voiplink.cpp @@ -106,6 +106,9 @@ VoIPLink::setRegistrationState(const enum RegistrationState state, const int& er case ErrorAuth: Manager::instance().registrationFailed(acc_ID); break; + case ErrorNetwork: + Manager::instance().registrationFailed(acc_ID); + break; case Unregistered: Manager::instance().unregistrationSucceed(acc_ID); break; diff --git a/src/voiplink.h b/src/voiplink.h index 3bbb3c5d838a683fc7480aa9afd9bbe0b3eed1d4..0af1ddc08f95797d0f884418346641d5fdf6860c 100644 --- a/src/voiplink.h +++ b/src/voiplink.h @@ -44,7 +44,7 @@ public: VoIPLink(const AccountID& accountID); virtual ~VoIPLink (void); - enum RegistrationState {Unregistered, Trying, Registered, Error, ErrorAuth}; + enum RegistrationState {Unregistered, Trying, Registered, Error, ErrorAuth , ErrorNetwork}; // Pure virtual functions virtual void getEvent (void) = 0;