[ekiga] Added workaround for registrars which refuse registrations containing extra contact addresses



commit 83cfd07e6d722782f0aa3e511003a60b1c7c5f97
Author: Michael Rickmann <mrickma gwdg de>
Date:   Wed Jul 22 17:45:34 2009 +0200

    Added workaround for registrars which refuse registrations containing extra contact addresses
    
    This patch lets Ekiga try twice to register, the second time setting
    %LIMITED.  If you know before that you have a limited provider you can
    put the string %limit into the name of your account and Ekiga will
    succeed without retry.  I tried under Linux only and only with
    sip.1und1.de with which Ekiga could not register before, but now it
    works.

 lib/engine/components/opal/opal-account.cpp |   22 ++++++++++++++++++----
 lib/engine/components/opal/opal-account.h   |    3 +++
 lib/engine/components/opal/sip-endpoint.cpp |    4 ++++
 lib/engine/components/opal/sip-endpoint.h   |    2 ++
 4 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index 0a50ec3..1ba7204 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -127,6 +127,8 @@ Opal::Account::Account (Ekiga::ServiceCore & _core,
     type = Account::SIP;
   else
     type = Account::H323;
+
+  limited = (name.find ("%limit") != std::string::npos);
 }
 
 
@@ -301,6 +303,12 @@ bool Opal::Account::is_enabled () const
 }
 
 
+bool Opal::Account::is_limited () const
+{
+  return limited;
+}
+
+
 bool Opal::Account::is_active () const
 {
   return enabled;
@@ -494,10 +502,16 @@ Opal::Account::handle_registration_event (RegistrationState state_,
 
   case RegistrationFailed:
 
-    status = _("Could not register");
-    if (!info.empty ())
-      status = status + " (" + info + ")";
-    updated.emit ();
+    if (!limited) {
+      limited = true;
+      gmref_ptr<Sip::EndPoint> endpoint = core.get ("opal-sip-endpoint");
+      endpoint->subscribe (*this);
+    } else {
+      status = _("Could not register");
+      if (!info.empty ())
+        status = status + " (" + info + ")";
+      updated.emit ();
+    }
     break;
 
   case Processing:
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index 57a0ae2..e6b5e7c 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -128,6 +128,8 @@ public:
 
     bool is_enabled () const;
 
+    bool is_limited () const;
+
     bool is_active () const;
 
     void remove ();
@@ -160,6 +162,7 @@ private:
     RegistrationState state;
     bool dead;
     bool enabled;
+    bool limited;
     unsigned timeout;
     std::string aid;
     std::string name;
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index 579e35a..8199548 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -82,6 +82,7 @@ namespace Opal {
 			    account.get_authentication_username (),
 			    account.get_password (),
 			    account.is_enabled (),
+			    account.is_limited (),
 			    account.get_timeout ());
 	} else {
 
@@ -574,6 +575,7 @@ Opal::Sip::EndPoint::Register (const std::string username,
 			       const std::string auth_username,
 			       const std::string password,
 			       bool is_enabled,
+			       bool is_limited,
 			       unsigned timeout)
 {
   PWaitAndSignal mut(listsMutex);
@@ -592,6 +594,8 @@ Opal::Sip::EndPoint::Register (const std::string username,
   SIPRegister::Params params;
   params.m_addressOfRecord = aor.str ();
   params.m_registrarAddress = host;
+  if (is_limited)
+    params.m_contactAddress = "%LIMITED";
   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 23b5419..4de4108 100644
--- a/lib/engine/components/opal/sip-endpoint.h
+++ b/lib/engine/components/opal/sip-endpoint.h
@@ -160,6 +160,8 @@ 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*/
 		     unsigned timeout);
 
       void OnRegistered (const PString & aor,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]