[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "client-registration" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Sep 1 18:14:43 CDT 2011
branch "client-registration" has been created
at ed312ad27eeb19dc1fe4a4742e5bc1b0ee57bcfc (commit)
- Log -----------------------------------------------------------------
commit ed312ad27eeb19dc1fe4a4742e5bc1b0ee57bcfc
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Sep 1 18:15:52 2011 -0500
Add initial header file for SIP client registration.
diff --git a/src/AuthManager.h b/src/AuthManager.h
index 07930ab..e2d7188 100644
--- a/src/AuthManager.h
+++ b/src/AuthManager.h
@@ -175,6 +175,19 @@ public:
* Remove all registered authentication hooks from the AuthManager
*/
void clearAuthHooks();
+ /**
+ * Register a new authentication client hook with the AuthManager
+ */
+ void addAuthClientHook(const AsteriskSCF::SIP::ExtensionPoint::V1::AuthHookPrx &hook, int priority, const AsteriskSCF::SIP::ExtensionPoint::V1::RequestTypeSeq &types);
+ /**
+ * Remove a registered authentication client hook from the AuthManager
+ */
+ void removeAuthClientHook(const AsteriskSCF::SIP::ExtensionPoint::V1::AuthHookPrx &hook);
+ /**
+ * Remove all registered authentication client hooks from the AuthManager
+ */
+ void clearAuthClientHooks();
+
private:
boost::shared_ptr<AuthManagerPriv> mImpl;
};
diff --git a/src/Component.cpp b/src/Component.cpp
index 75bacbe..12ff379 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -71,6 +71,7 @@ namespace AsteriskSCF
{
namespace SipSessionManager
{
+
class SipAuthExtensionPoint : public AuthExtensionPoint
{
public:
@@ -103,6 +104,37 @@ private:
typedef IceUtil::Handle<SipAuthExtensionPoint> SipAuthExtensionPointPtr;
+class SipAuthClientExtensionPoint : public AuthClientExtensionPoint
+{
+public:
+ SipAuthClientExtensionPoint(const PJSipManagerPtr& manager)
+ : mPJSipManager(manager)
+ {
+ }
+
+ void addAuthClientHook(
+ const AuthClientHookPrx &hook,
+ int priority,
+ const RequestTypeSeq &requestTypes,
+ const Ice::Current&)
+ {
+ mPJSipManager->addAuthClientHook(hook, priority, requestTypes);
+ }
+
+ void removeAuthHook(const AuthClientHookPrx &hook, const Ice::Current&)
+ {
+ mPJSipManager->removeAuthClientHook(hook);
+ }
+
+ void clearAuthHooks(const Ice::Current&)
+ {
+ mPJSipManager->clearAuthClientHooks();
+ }
+private:
+ PJSipManagerPtr mPJSipManager;
+};
+
+typedef IceUtil::Handle<SipAuthClientExtensionPoint> SipAuthClientExtensionPointPtr;
/**
* This private class initializes the startup and controls the shutdown of the component.
@@ -179,6 +211,10 @@ private:
AuthExtensionPointPrx mAuthExtensionPrx;
LocatorRegistrationWrapperPtr mAuthExtensionRegistration;
+ SipAuthClientExtensionPointPtr mAuthClientExtension;
+ AuthExtensionPointPrx mAuthClientExtensionPrx;
+ LocatorRegistrationWrapperPtr mAuthClientExtensionRegistration;
+
RegistrarListenerPtr mDefaultRegistrarListener;
RegistrarListenerPrx mDefaultRegistrarListenerPrx;
@@ -213,6 +249,10 @@ void Component::preparePrimaryServicesForDiscovery()
mAuthExtensionRegistration = wrapServiceForRegistration(mAuthExtensionPrx,
AsteriskSCF::SIP::V1::AuthExtensionPointCategory);
managePrimaryService(mAuthExtensionRegistration);
+
+ mAuthClientExtensionRegistration = wrapServiceForRegistration(mAuthClientExtensionPrx,
+ AsteriskSCF::SIP::V1::AuthClientExtensionPointCategory);
+ managePrimaryService(mAuthClientExtensionRegistration);
}
catch(const std::exception& e)
{
@@ -551,6 +591,10 @@ void Component::createPrimaryServices()
getServiceAdapter()->add(mAuthExtension, getCommunicator()->stringToIdentity(AuthServiceId)));
lg(Debug) << "Added Authentication extension point to object adapter";
+ mAuthClientExtension = new SipAuthClientExtensionPoint(mPJSipManager);
+ mAuthClientExtensionPrx = AuthClientExtensionPointPrx::uncheckedCast(
+ getServiceAdapter()->add(mAuthClientExtension, getCommunicator()->stringToIdentity(AuthClientServiceId)));
+ lg(Debug) << "Added Authentication client extension point to object adapter";
}
catch(const Ice::Exception& e)
{
diff --git a/src/SipClientRegistration.h b/src/SipClientRegistration.h
new file mode 100644
index 0000000..79c7d18
--- /dev/null
+++ b/src/SipClientRegistration.h
@@ -0,0 +1,77 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2011, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+#include <pjsipua.h>
+
+namespace AsteriskSCF
+{
+
+namespace SipSessionManager
+{
+
+/**
+ * A centralized class.
+ *
+ * Outside entities will populate this with information
+ * central to all client registrations.
+ *
+ * The client registrations themselves will then use
+ * accessors in order to get the necessary information.
+ */
+class SipRegistrationClientManager
+{
+public:
+ SipRegistraitonClientManager();
+
+ void addAllow(const Ice::StringSeq& allows);
+
+ Ice::StringSeq getAllow();
+
+ void addSupported(const Ice::StringSeq& supporteds);
+
+ Ice::StringSeq getSupported();
+
+ AsteriskSCF::SIP::ExtensionPoint::V1::AuthClientHookSeq getAuthClientHooks();
+
+private:
+ Ice::StringSeq mAllow;
+ Ice::StringSeq mSupported;
+ boost::shared_lock mLock;
+};
+
+typedef std::pair<std::string, int> RegPair;
+typedef std::vector<RegPair> RegPairSeq;
+
+/**
+ * One of these exists per endpoint.
+ * This takes care of sending REGISTER
+ * to the configured endpoint.
+ */
+class SipRegistrationClient
+{
+public:
+ SipRegistrationClient(const std::string& aor, const RegPairSeq& contacts);
+
+ void addContacts(const RegPairSeq& contacts);
+
+ void removeContacts(const Ice::StringSeq& contacts);
+private:
+ RegPairSeq mContacts;
+ SipRegistrationClientManager mManager;
+};
+
+}
+}
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list