[ekiga] Use a third compat mode for bogus registrars with respect to Contact field
- From: Eugen Dedu <ededu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Use a third compat mode for bogus registrars with respect to Contact field
- Date: Thu, 8 Sep 2011 10:18:47 +0000 (UTC)
commit 11209441a0aff1738c6d31540495a62afd3dae52
Author: Eugen Dedu <Eugen Dedu pu-pm univ-fcomte fr>
Date: Thu Sep 8 12:15:29 2011 +0200
Use a third compat mode for bogus registrars with respect to Contact field
The three compatibility modes are automatically tried one after the
other. %limit hack allows to start directly with the 2nd
compatibility mode.
lib/engine/components/opal/opal-account.cpp | 34 ++++++++++++++++++++------
lib/engine/components/opal/opal-account.h | 5 ++-
lib/engine/components/opal/opal-bank.cpp | 2 -
lib/engine/components/opal/sip-endpoint.cpp | 7 ++---
lib/engine/components/opal/sip-endpoint.h | 3 +-
5 files changed, 33 insertions(+), 18 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 4afae0e..51da80c 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -132,7 +132,8 @@ Opal::Account::Account (Ekiga::ServiceCore & _core,
else
type = Account::H323;
- limited = (name.find ("%limit") != std::string::npos);
+ if (name.find ("%limit") != std::string::npos)
+ compat_mode = SIPRegister::e_CannotRegisterMultipleContacts; // start registration in this compat mode
setup_presentity ();
}
@@ -340,9 +341,9 @@ bool Opal::Account::is_active () const
}
-bool Opal::Account::is_limited () const
+SIPRegister::CompatibilityModes Opal::Account::get_compat_mode () const
{
- return limited;
+ return compat_mode;
}
@@ -542,6 +543,7 @@ void
Opal::Account::handle_registration_event (RegistrationState state_,
const std::string info) const
{
+ boost::shared_ptr<Sip::EndPoint> endpoint;
switch (state_) {
case Registered:
@@ -582,16 +584,32 @@ Opal::Account::handle_registration_event (RegistrationState state_,
case RegistrationFailed:
- if (!limited) {
- limited = true;
- boost::shared_ptr<Sip::EndPoint> endpoint = core.get<Sip::EndPoint> ("opal-sip-endpoint");
+ switch (compat_mode) {
+ case SIPRegister::e_FullyCompliant:
+ // FullyCompliant did not work, try next compat mode
+ compat_mode = SIPRegister::e_CannotRegisterMultipleContacts;
+ PTRACE (4, "Register failed in FullyCompliant mode, retrying in CannotRegisterMultipleContacts mode");
+ endpoint = core.get<Sip::EndPoint> ("opal-sip-endpoint");
endpoint->subscribe (*this);
- } else {
- limited = false; // since limited did not work, put it back to false, to avoid being stuck to limited=true when retrying register later
+ break;
+ case SIPRegister::e_CannotRegisterMultipleContacts:
+ // CannotRegMC did not work, try next compat mode
+ compat_mode = SIPRegister::e_CannotRegisterPrivateContacts;
+ PTRACE (4, "Register failed in CannotRegisterMultipleContacts mode, retrying in CannotRegisterPrivateContacts mode");
+ endpoint = core.get<Sip::EndPoint> ("opal-sip-endpoint");
+ endpoint->subscribe (*this);
+ break;
+ case SIPRegister::e_CannotRegisterPrivateContacts:
+ // CannotRegPC did not work, stop registration with error
+ compat_mode = SIPRegister::e_FullyCompliant;
+ PTRACE (4, "Register failed in CannotRegisterPrivateContacts mode, aborting registration");
status = _("Could not register");
if (!info.empty ())
status = status + " (" + info + ")";
updated ();
+ break;
+ default:
+ break;
}
break;
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index 805ac6b..394bef3 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -43,6 +43,7 @@
#include "presence-core.h"
#include "personal-details.h"
#include "bank-impl.h"
+#include <sip/sippdu.h>
namespace Opal
{
@@ -133,7 +134,7 @@ public:
bool is_active () const;
- bool is_limited () const;
+ SIPRegister::CompatibilityModes get_compat_mode () const;
void remove ();
@@ -175,7 +176,7 @@ private:
mutable RegistrationState state;
bool dead;
bool enabled;
- mutable bool limited;
+ mutable SIPRegister::CompatibilityModes compat_mode;
unsigned timeout;
std::string aid;
std::string name;
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 8aa3816..b74efdc 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -43,8 +43,6 @@
#include <glib/gi18n.h>
-#include <sip/sipep.h>
-
#include "gmconf.h"
#include "menu-builder.h"
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index 5bee853..c892326 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -82,7 +82,7 @@ namespace Opal {
account.get_authentication_username (),
account.get_password (),
account.is_enabled (),
- account.is_limited (),
+ account.get_compat_mode (),
account.get_timeout ());
} else {
@@ -484,7 +484,7 @@ Opal::Sip::EndPoint::Register (const std::string username,
const std::string auth_username,
const std::string password,
bool is_enabled,
- bool is_limited,
+ SIPRegister::CompatibilityModes compat_mode,
unsigned timeout)
{
PString _aor;
@@ -502,8 +502,7 @@ Opal::Sip::EndPoint::Register (const std::string username,
SIPRegister::Params params;
params.m_addressOfRecord = PString (aor.str ());
params.m_registrarAddress = PString (host_);
- if (is_limited)
- params.m_compatibility = SIPRegister::e_CannotRegisterMultipleContacts;
+ params.m_compatibility = compat_mode;
params.m_authID = auth_username;
params.m_password = password;
params.m_expire = is_enabled ? timeout : 0;
diff --git a/lib/engine/components/opal/sip-endpoint.h b/lib/engine/components/opal/sip-endpoint.h
index 7bdd1ac..7dd9829 100644
--- a/lib/engine/components/opal/sip-endpoint.h
+++ b/lib/engine/components/opal/sip-endpoint.h
@@ -140,8 +140,7 @@ namespace Opal {
const std::string auth_username,
const std::string password,
bool is_enabled,
- bool is_limited, /* limited registrar = which do not accept
- extra contact addresses, such as private ones*/
+ SIPRegister::CompatibilityModes compat_mode,
unsigned timeout);
void OnRegistered (const PString & aor,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]