[ekiga] H.323: Fixed Gatekeeper support.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] H.323: Fixed Gatekeeper support.
- Date: Sat, 24 Nov 2012 14:08:03 +0000 (UTC)
commit c1ce2d29bb309e2d00205539289fd8773f387601
Author: Damien Sandras <dsandras beip be>
Date: Sat Nov 24 15:06:59 2012 +0100
H.323: Fixed Gatekeeper support.
This closes bug #592363.
lib/engine/components/opal/h323-endpoint.cpp | 4 +-
lib/engine/components/opal/opal-account.cpp | 128 +++++++++++++++++---------
lib/engine/components/opal/opal-account.h | 10 ++-
lib/engine/components/opal/opal-main.cpp | 24 +++---
4 files changed, 108 insertions(+), 58 deletions(-)
---
diff --git a/lib/engine/components/opal/h323-endpoint.cpp b/lib/engine/components/opal/h323-endpoint.cpp
index ce5dbac..b1b4aab 100644
--- a/lib/engine/components/opal/h323-endpoint.cpp
+++ b/lib/engine/components/opal/h323-endpoint.cpp
@@ -282,7 +282,7 @@ bool
Opal::H323::EndPoint::subscribe (const Opal::Account & account,
const PSafePtr<OpalPresentity> & presentity)
{
- if (account.get_protocol_name () != "H323" || account.is_enabled ())
+ if (account.get_protocol_name () != "H323")
return false;
new subscriber (account, *this, presentity);
@@ -295,7 +295,7 @@ bool
Opal::H323::EndPoint::unsubscribe (const Opal::Account & account,
const PSafePtr<OpalPresentity> & presentity)
{
- if (account.get_protocol_name () != "H323" || !account.is_enabled ())
+ if (account.get_protocol_name () != "H323")
return false;
new subscriber (account, *this, presentity);
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index c3609a7..dac5f8e 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -35,6 +35,8 @@
*
*/
+#include "config.h"
+
#include <string.h>
#include <stdlib.h>
#include <algorithm>
@@ -58,12 +60,14 @@
#include "audiooutput-core.h"
#include "sip-endpoint.h"
+#ifdef HAVE_H323
+#include "h323-endpoint.h"
+#endif
Opal::Account::Account (Ekiga::ServiceCore & _core,
const std::string & account)
: core (_core)
{
- endpoint = core.get<Sip::EndPoint> ("opal-sip-endpoint");
notification_core = core.get<Ekiga::NotificationCore> ("notification-core");
state = Unregistered;
status = _("Unregistered");
@@ -135,10 +139,20 @@ Opal::Account::Account (Ekiga::ServiceCore & _core,
else
type = Account::H323;
- if (name.find ("%limit") != std::string::npos)
- compat_mode = SIPRegister::e_CannotRegisterMultipleContacts; // start registration in this compat mode
- else
- compat_mode = SIPRegister::e_FullyCompliant;
+#ifdef HAVE_H323
+ if (type == Account::H323)
+ h323_endpoint = core.get<H323::EndPoint> ("opal-h323-endpoint");
+ else {
+#endif
+ sip_endpoint = core.get<Sip::EndPoint> ("opal-sip-endpoint");
+
+ if (name.find ("%limit") != std::string::npos)
+ compat_mode = SIPRegister::e_CannotRegisterMultipleContacts; // start registration in this compat mode
+ else
+ compat_mode = SIPRegister::e_FullyCompliant;
+#ifdef HAVE_H323
+ }
+#endif
setup_presentity ();
}
@@ -155,7 +169,6 @@ Opal::Account::Account (Ekiga::ServiceCore & _core,
unsigned _timeout)
: core (_core)
{
- endpoint = core.get<Sip::EndPoint> ("opal-sip-endpoint");
notification_core = core.get<Ekiga::NotificationCore> ("notification-core");
state = Unregistered;
@@ -177,6 +190,13 @@ Opal::Account::Account (Ekiga::ServiceCore & _core,
failed_registration_already_notified = false;
dead = false;
+#ifdef HAVE_H323
+ if (type == Account::H323)
+ h323_endpoint = core.get<H323::EndPoint> ("opal-h323-endpoint");
+ else
+#endif
+ sip_endpoint = core.get<Sip::EndPoint> ("opal-sip-endpoint");
+
setup_presentity ();
if (enabled)
@@ -299,7 +319,12 @@ void Opal::Account::enable ()
state = Processing;
status = _("Processing...");
- endpoint->subscribe (*this, presentity);
+#ifdef HAVE_H323
+ if (type == Account::H323)
+ h323_endpoint->subscribe (*this, presentity);
+ else
+#endif
+ sip_endpoint->subscribe (*this, presentity);
updated ();
trigger_saving ();
@@ -318,7 +343,12 @@ void Opal::Account::disable ()
Ekiga::Runtime::run_in_main (boost::bind (&Opal::Account::presence_status_in_main, this, *iter, "unknown", ""));
}
}
- endpoint->unsubscribe (*this, presentity);
+#ifdef HAVE_H323
+ if (type == Account::H323)
+ h323_endpoint->unsubscribe (*this, presentity);
+ else
+#endif
+ sip_endpoint->unsubscribe (*this, presentity);
// Translators: this is a state, not an action, i.e. it should be read as
// "(you are) unregistered", and not as "(you have been) unregistered"
@@ -653,47 +683,59 @@ Opal::Account::handle_registration_event (RegistrationState state_,
case RegistrationFailed:
state = state_;
- 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->subscribe (*this, presentity);
- 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->subscribe (*this, presentity);
- break;
- case SIPRegister::e_CannotRegisterPrivateContacts:
- // CannotRegMC did not work, try next compat mode
- compat_mode = SIPRegister::e_HasApplicationLayerGateway;
- PTRACE (4, "Register failed in CannotRegisterMultipleContacts mode, retrying in HasApplicationLayerGateway mode");
- endpoint->subscribe (*this, presentity);
- break;
- case SIPRegister::e_HasApplicationLayerGateway:
- // HasAppLG did not work, stop registration with error
- compat_mode = SIPRegister::e_FullyCompliant;
- PTRACE (4, "Register failed in HasApplicationLayerGateway mode, aborting registration");
- status = _("Could not register");
- if (!info.empty ())
- status = status + " (" + info + ")";
- if (!failed_registration_already_notified) {
+#ifdef HAVE_H323
+ if (type == Account::H323) {
std::stringstream msg;
msg << _("Could not register to ") << get_name ();
boost::shared_ptr<Ekiga::Notification> notif (new Ekiga::Notification (Ekiga::Notification::Warning, msg.str (), info, _("Edit"), boost::bind (&Opal::Account::edit, (Opal::Account*) this)));
notification_core->push_notification (notif);
+ }
+ else {
+#endif
+ 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");
+ sip_endpoint->subscribe (*this, presentity);
+ 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");
+ sip_endpoint->subscribe (*this, presentity);
+ break;
+ case SIPRegister::e_CannotRegisterPrivateContacts:
+ // CannotRegMC did not work, try next compat mode
+ compat_mode = SIPRegister::e_HasApplicationLayerGateway;
+ PTRACE (4, "Register failed in CannotRegisterMultipleContacts mode, retrying in HasApplicationLayerGateway mode");
+ sip_endpoint->subscribe (*this, presentity);
+ break;
+ case SIPRegister::e_HasApplicationLayerGateway:
+ // HasAppLG did not work, stop registration with error
+ compat_mode = SIPRegister::e_FullyCompliant;
+ PTRACE (4, "Register failed in HasApplicationLayerGateway mode, aborting registration");
+ status = _("Could not register");
+ if (!info.empty ())
+ status = status + " (" + info + ")";
+ if (!failed_registration_already_notified) {
+ std::stringstream msg;
+ msg << _("Could not register to ") << get_name ();
+ boost::shared_ptr<Ekiga::Notification> notif (new Ekiga::Notification (Ekiga::Notification::Warning, msg.str (), info, _("Edit"), boost::bind (&Opal::Account::edit, (Opal::Account*) this)));
+ notification_core->push_notification (notif);
+ }
+ updated ();
+ failed_registration_already_notified = true;
+ break;
+ default:
+
+ state = state_;
+ updated();
+ break;
}
- updated ();
- failed_registration_already_notified = true;
- break;
- default:
-
- state = state_;
- updated();
- break;
+#ifdef HAVE_H323
}
+#endif
break;
case Processing:
diff --git a/lib/engine/components/opal/opal-account.h b/lib/engine/components/opal/opal-account.h
index 54c274c..4d9ec66 100644
--- a/lib/engine/components/opal/opal-account.h
+++ b/lib/engine/components/opal/opal-account.h
@@ -38,6 +38,8 @@
#ifndef __OPAL_ACCOUNT_H__
#define __OPAL_ACCOUNT_H__
+#include "config.h"
+
#include <opal/pres_ent.h>
#include "notification-core.h"
@@ -50,6 +52,9 @@ namespace Opal
{
// forward declaration:
namespace Sip { class EndPoint; };
+#ifdef HAVE_H323
+ namespace H323 { class EndPoint; };
+#endif
/**
* @addtogroup accounts
@@ -208,7 +213,10 @@ private:
std::string status);
Ekiga::ServiceCore & core;
- boost::shared_ptr<Sip::EndPoint> endpoint;
+ boost::shared_ptr<Opal::Sip::EndPoint> sip_endpoint;
+#ifdef HAVE_H323
+ boost::shared_ptr<Opal::H323::EndPoint> h323_endpoint;
+#endif
boost::shared_ptr<Ekiga::NotificationCore> notification_core;
};
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index 49a0349..26b1776 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -106,11 +106,12 @@ struct OPALSpark: public Ekiga::Spark
boost::shared_ptr<Ekiga::PersonalDetails> personal_details = core.get<Ekiga::PersonalDetails> ("personal-details");
boost::shared_ptr<Bank> account_store = core.get<Bank> ("opal-account-store");
Ekiga::ServicePtr sip_endpoint = core.get ("opal-sip-endpoint");
+ Ekiga::ServicePtr h323_endpoint = core.get ("opal-h323-endpoint");
if (contact_core && presence_core && call_core && chat_core
&& account_core && audioinput_core && videoinput_core
&& audiooutput_core && videooutput_core && personal_details
- && !account_store && !sip_endpoint) {
+ && !account_store && !sip_endpoint && !h323_endpoint) {
PIPSocket::SetSuppressCanonicalName (true); // avoid long delays
@@ -123,6 +124,16 @@ struct OPALSpark: public Ekiga::Spark
boost::shared_ptr<Sip::EndPoint> sip_manager (new Sip::EndPoint (*call_manager, core, sip_port), null_deleter ());
core.add (sip_manager);
+#ifdef HAVE_H323
+ unsigned h323_port = gm_conf_get_int (H323_KEY "listen_port");
+ unsigned kind_of_net = gm_conf_get_int (GENERAL_KEY "kind_of_net");
+ boost::shared_ptr<H323::EndPoint> h323_manager (new H323::EndPoint (*call_manager, core, h323_port, kind_of_net), null_deleter ());
+ call_manager->add_protocol_manager (h323_manager);
+ contact_core->add_contact_decorator (h323_manager);
+ presence_core->add_presentity_decorator (h323_manager);
+ core.add (h323_manager);
+#endif
+
call_manager->add_protocol_manager (sip_manager);
contact_core->add_contact_decorator (sip_manager);
presence_core->add_presentity_decorator (sip_manager);
@@ -135,17 +146,6 @@ struct OPALSpark: public Ekiga::Spark
presence_core->add_presence_publisher (bank);
presence_core->add_presence_fetcher (bank);
-
-#ifdef HAVE_H323
- unsigned h323_port = gm_conf_get_int (H323_KEY "listen_port");
- unsigned kind_of_net = gm_conf_get_int (GENERAL_KEY "kind_of_net");
- boost::shared_ptr<H323::EndPoint> h323_manager (new H323::EndPoint (*call_manager, core, h323_port, kind_of_net), null_deleter ());
- call_manager->add_protocol_manager (h323_manager);
- contact_core->add_contact_decorator (h323_manager);
- presence_core->add_presentity_decorator (h323_manager);
- core.add (h323_manager);
-#endif
-
call_core->add_manager (call_manager);
new ConfBridge (*call_manager); // FIXME: isn't that leaked!?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]