[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "nodatamodel" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu Oct 7 13:38:27 CDT 2010
branch "nodatamodel" has been created
at b4378e9cf3e50afaecd66f8a9b791136315328d4 (commit)
- Log -----------------------------------------------------------------
commit b4378e9cf3e50afaecd66f8a9b791136315328d4
Merge: 8c7bc76 65548ca
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Oct 7 13:36:02 2010 -0500
Merge branch 'master' of git.asterisk.org:asterisk-scf/integration/sip into nodatamodel
Conflicts:
src/PJSipSessionModule.cpp
diff --cc src/PJSipSessionModule.cpp
index a25531a,fc26353..66f3b3b
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@@ -342,9 -354,18 +351,17 @@@ void PJSipSessionModule::handleNewInvit
std::cerr << "[DEBUG] Replicating state on reception of new SIP INVITE." << std::endl;
replicateState(dlg_mod_info, tsx_mod_info, session_mod_info);
- AsteriskSCF::SessionCommunications::V1::SessionRouterPrx router = dataModel.getSessionRouter();
try
{
- mSessionRouter->routeSession(session->getSessionProxy(), destination);
+ if (replaced_dlg)
+ {
+ // For attended transfers we need to contact the routing service which should then (hopefully) replace the other session
+ }
+ else
+ {
+ // If this is not an attended transfer we can just route the session as normally
- router->routeSession(session->getSessionProxy(), destination);
++ mSessionRouter->routeSession(session->getSessionProxy(), destination);
+ }
}
catch (AsteriskSCF::Core::Routing::V1::DestinationNotFoundException&)
{
commit 8c7bc76d9103dd895516b553b14fa17c32ed2861
Author: Mark Michelson <mmichelson at digium.com>
Date: Wed Oct 6 12:41:21 2010 -0500
Add the module name back to the session module so there won't be a segfault.
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index a0e49fd..2fcddc6 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -92,6 +92,8 @@ PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt,
mStateReplicator(stateReplicator), mReplica(replica)
{
sessionModule = this;
+ char name[] = "AsteriskSCF";
+ mModule.name = pj_str(name);
mModule.priority = PJSIP_MOD_PRIORITY_APPLICATION;
mModule.load = sessionLoad;
mModule.start = sessionStart;
commit d8563760b1a953532ca0b0ebf4c8ba4ea1371d57
Author: Mark Michelson <mmichelson at digium.com>
Date: Wed Oct 6 12:40:12 2010 -0500
The data model is no more.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index cb9c075..c8dcd8b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,7 +17,6 @@ hydra_component_add_slice(SipChannelService ReplicaIf)
hydra_component_add_slice(SipChannelService SipIf)
hydra_component_add_file(SipChannelService SipChannelServiceApp.cpp)
-hydra_component_add_file(SipChannelService SipChannelServiceDataModel.h)
hydra_component_add_file(SipChannelService SipChannelServiceEventPublisher.cpp)
hydra_component_add_file(SipChannelService SipChannelServiceEventPublisher.h)
hydra_component_add_file(SipChannelService SipChannelServiceEndpointLocator.cpp)
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index d1fba6e..a0e49fd 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -7,7 +7,6 @@
*/
#include "PJSipSessionModule.h"
-#include "SipChannelServiceDataModel.h"
namespace AsteriskSCF
{
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index dae561d..91619db 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -21,11 +21,11 @@
#include "SessionCommunicationsIf.h"
#include "ReplicaIf.h"
-#include "SipChannelServiceDataModel.h"
#include "SipChannelServiceEventPublisher.h"
#include "SipChannelServiceEndpointLocator.h"
#include "SipEndpointFactory.h"
#include "PJSipSessionModule.h"
+#include "PJSipManager.h"
#include "SipSession.h"
#include "SipStateReplicator.h"
@@ -41,105 +41,6 @@ namespace AsteriskSCF
{
namespace SipChannelService
{
-/**
- * Private implementation of the BasicRoutingServiceDataModel singleton. This
- * object provides access to the data model of the component.
- * TBD... This may well turn into the Data Store. Or, at least some of the
- * data items managed here should be in the Data Store.
- */
-class SipChannelServiceDataModelImpl : public SipChannelServiceDataModel
-{
-public: // Overrides of the SipChannelServiceDataModel singleton's public interface.
-
- virtual const Ice::CommunicatorPtr getCommunicator() const
- {
- return mCommunicator;
- }
-
- virtual const SipChannelServiceEventPublisher& getEventPublisher() const
- {
- return *mEventPublisher;
- }
-
- virtual Routing::V1::EndpointLocatorPtr getEndpointLocator() const
- {
- return mEndpointLocator;
- }
-
- virtual Routing::V1::LocatorRegistryPrx getRoutingService() const
- {
- return mRoutingServiceLocatorRegistry;
- }
-
- virtual AsteriskSCF::SessionCommunications::V1::SessionRouterPrx getSessionRouter() const
- {
- return mSessionRouter;
- }
-
- virtual Bridging::V1::BridgeManagerPrx getBridgeManager() const
- {
- return mBridgeManager;
- }
-
- virtual boost::shared_ptr<SipEndpointFactory> getEndpointFactory() const
- {
- return mEndpointFactory;
- }
-
- virtual ServiceLocatorPrx getServiceLocator() const
- {
- return mServiceLocator;
- }
-
- virtual PJSipManager *getPJSipManager() const
- {
- return mPJSipManager;
- }
-
- virtual SipStateReplicatorPrx getStateReplicator() const
- {
- return mStateReplicator;
- }
-
- virtual bool IsPaused() const
- {
- return mPaused;
- }
-
- virtual bool isActive() const
- {
- return mActive;
- }
-
-public: // Implementation details are visible to this file's classes.
-
- void cleanup()
- {
- }
-
- Ice::CommunicatorPtr mCommunicator;
- boost::shared_ptr<SipChannelServiceEventPublisher> mEventPublisher;
- Routing::V1::EndpointLocatorPtr mEndpointLocator;
- Routing::V1::LocatorRegistryPrx mRoutingServiceLocatorRegistry;
- AsteriskSCF::SessionCommunications::V1::SessionRouterPrx mSessionRouter;
- Bridging::V1::BridgeManagerPrx mBridgeManager;
- boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
- ServiceLocatorPrx mServiceLocator;
- PJSipManager *mPJSipManager;
- SipStateReplicatorPrx mStateReplicator;
-
- bool mPaused;
-
- bool mActive;
-
-SipChannelServiceDataModelImpl() : mPaused(false), mActive(true) {}
-};
-
-SipChannelServiceDataModelImpl mDataModelInstance;
-SipChannelServiceDataModel& SipChannelServiceDataModel::getInstance()
-{
- return mDataModelInstance;
-}
/**
* This private class initializes the startup and controls the shutdown of the component.
@@ -197,6 +98,10 @@ private:
ServiceLocatorPrx mServiceLocator;
SipStateReplicatorPrx mStateReplicator;
AsteriskSCF::SessionCommunications::V1::SessionRouterPrx mSessionRouter;
+ Routing::V1::LocatorRegistryPrx mRoutingServiceLocatorRegistry;
+ Bridging::V1::BridgeManagerPrx mBridgeManager;
+ boost::shared_ptr<SipChannelServiceEventPublisher> mEventPublisher;
+ Routing::V1::EndpointLocatorPtr mEndpointLocator;
};
static const string ComponentServiceId("SipChannelComponent");
@@ -238,20 +143,20 @@ private:
class ReplicaImpl : public Replica
{
public:
-ReplicaImpl(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter) { }
+ReplicaImpl(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter), mActive(true), mPaused(false) { }
bool isActive(const Ice::Current&)
{
- return mDataModelInstance.mActive;
+ return mActive;
}
bool activate(const Ice::Current&)
{
- mDataModelInstance.mActive = true;
+ mActive = true;
for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
{
- (*listener)->activated(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mDataModelInstance.mCommunicator->stringToIdentity(ReplicaServiceId))));
+ (*listener)->activated(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
}
return true;
@@ -259,11 +164,11 @@ ReplicaImpl(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter) { }
void standby(const Ice::Current&)
{
- mDataModelInstance.mActive = false;
+ mActive = false;
for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
{
- (*listener)->onStandby(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mDataModelInstance.mCommunicator->stringToIdentity(ReplicaServiceId))));
+ (*listener)->onStandby(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
}
}
@@ -287,6 +192,10 @@ private:
* Listeners that we need to push state change notifications out to.
*/
vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx> mListeners;
+
+ bool mPaused;
+
+ bool mActive;
};
/**
@@ -408,10 +317,10 @@ void SipChannelServiceApp::registerWithRoutingService()
{
RegExSeq destinations;
- mDataModelInstance.mEndpointFactory->generateRoutingDestinations(destinations);
+ mEndpointFactory->generateRoutingDestinations(destinations);
EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(mGlobalAdapter->createDirectProxy(communicator()->stringToIdentity(EndpointLocatorObjectId)));
- mDataModelInstance.mRoutingServiceLocatorRegistry->addEndpointLocator("pjsip", destinations, locator);
+ mRoutingServiceLocatorRegistry->addEndpointLocator("pjsip", destinations, locator);
}
/**
@@ -419,7 +328,7 @@ void SipChannelServiceApp::registerWithRoutingService()
*/
void SipChannelServiceApp::deregisterFromRoutingService()
{
- mDataModelInstance.mRoutingServiceLocatorRegistry->removeEndpointLocator("pjsip");
+ mRoutingServiceLocatorRegistry->removeEndpointLocator("pjsip");
}
/**
@@ -428,24 +337,24 @@ void SipChannelServiceApp::deregisterFromRoutingService()
*/
void SipChannelServiceApp::locateRoutingService()
{
- if (mDataModelInstance.mServiceLocator == 0)
+ if (mServiceLocator == 0)
{
- mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+ mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
}
ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
genericparams->category = Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory;
- Ice::ObjectPrx objectPrx = mDataModelInstance.mServiceLocator->locate(genericparams);
- mDataModelInstance.mRoutingServiceLocatorRegistry = Routing::V1::LocatorRegistryPrx::checkedCast(objectPrx);
+ Ice::ObjectPrx objectPrx = mServiceLocator->locate(genericparams);
+ mRoutingServiceLocatorRegistry = Routing::V1::LocatorRegistryPrx::checkedCast(objectPrx);
}
void SipChannelServiceApp::locateStateReplicator()
{
- if (mDataModelInstance.mServiceLocator == 0)
+ if (mServiceLocator == 0)
{
- mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+ mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
}
SIP::V1::SipStateReplicatorParamsPtr replicatorParams = new SIP::V1::SipStateReplicatorParams();
@@ -454,14 +363,14 @@ void SipChannelServiceApp::locateStateReplicator()
try
{
- Ice::ObjectPrx objectPrx = mDataModelInstance.mServiceLocator->locate(replicatorParams);
- mDataModelInstance.mStateReplicator = SIP::V1::SipStateReplicatorPrx::checkedCast(objectPrx);
+ Ice::ObjectPrx objectPrx = mServiceLocator->locate(replicatorParams);
+ mStateReplicator = SIP::V1::SipStateReplicatorPrx::checkedCast(objectPrx);
// Are we a listener?
if (communicator()->getProperties()->getPropertyWithDefault("Sip.StateReplicatorListener", "no") == "yes")
{
- mDataModelInstance.mStateReplicator->addListener(mReplicatorListenerProxy);
- mDataModelInstance.mActive = false;
+ mStateReplicator->addListener(mReplicatorListenerProxy);
+ mReplicaService->standby();
}
}
catch (...)
@@ -476,16 +385,16 @@ void SipChannelServiceApp::locateStateReplicator()
*/
void SipChannelServiceApp::locateSessionRouter()
{
- if (mDataModelInstance.mServiceLocator == 0)
+ if (mServiceLocator == 0)
{
- mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+ mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
}
ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
genericparams->category = Routing::V1::SessionRouterDiscoveryCategory;
- Ice::ObjectPrx objectPrx = mDataModelInstance.mServiceLocator->locate(genericparams);
- mDataModelInstance.mSessionRouter = AsteriskSCF::SessionCommunications::V1::SessionRouterPrx::checkedCast(objectPrx);
+ Ice::ObjectPrx objectPrx = mServiceLocator->locate(genericparams);
+ mSessionRouter = AsteriskSCF::SessionCommunications::V1::SessionRouterPrx::checkedCast(objectPrx);
}
/**
@@ -494,16 +403,16 @@ void SipChannelServiceApp::locateSessionRouter()
*/
void SipChannelServiceApp::locateBridgeService()
{
- if (mDataModelInstance.mServiceLocator == 0)
+ if (mServiceLocator == 0)
{
- mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+ mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
}
ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
// genericparams->category = Bridging::V1::BridgeServiceDiscoveryCategory;
- Ice::ObjectPrx objectPrx = mDataModelInstance.mServiceLocator->locate(genericparams);
- mDataModelInstance.mBridgeManager = Bridging::V1::BridgeManagerPrx::checkedCast(objectPrx);
+ Ice::ObjectPrx objectPrx = mServiceLocator->locate(genericparams);
+ mBridgeManager = Bridging::V1::BridgeManagerPrx::checkedCast(objectPrx);
}
/**
@@ -558,12 +467,12 @@ void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt)
void SipChannelServiceApp::deregisterFromStateReplicator()
{
- if (mDataModelInstance.mActive == true)
+ if (mReplicaService->isActive() == true)
{
return;
}
- mDataModelInstance.mStateReplicator->removeListener(mReplicatorListenerProxy);
+ mStateReplicator->removeListener(mReplicatorListenerProxy);
}
/**
@@ -575,19 +484,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
try
{
mAppName = appName;
-
- // Init the fields of the Data Model singleton.
- mDataModelInstance.mCommunicator = communicator();
-
- boost::shared_ptr<SipChannelServiceEventPublisher> eventPublisherPtr(new SipChannelServiceEventPublisher());
- mDataModelInstance.mEventPublisher = eventPublisherPtr;
- std::cerr << "[DEBUG] Created SIP Channel Service event publisher" << std::endl;
-
- // Initialize PJSIP
- mPJSipManager = new PJSipManager(communicator()->getProperties());
- mDataModelInstance.mPJSipManager = mPJSipManager;
- std::cerr << "[DEBUG] Created PJSIP manager" << std::endl;
-
+
// Create the global adapter.
mGlobalAdapter = communicator()->createObjectAdapter("SipChannelServiceAdapter");
std::cerr << "[DEBUG] Created global object adapter" << std::endl;
@@ -595,6 +492,13 @@ void SipChannelServiceApp::initialize(const std::string appName)
// Create the local adapter.
mLocalAdapter = communicator()->createObjectAdapter("SipChannelServiceLocalAdapter");
std::cerr << "[DEBUG] Created local object adapter" << std::endl;
+
+ mEventPublisher.reset(new SipChannelServiceEventPublisher(mLocalAdapter));
+ std::cerr << "[DEBUG] Created SIP Channel Service event publisher" << std::endl;
+
+ // Initialize PJSIP
+ mPJSipManager = new PJSipManager(communicator()->getProperties());
+ std::cerr << "[DEBUG] Created PJSIP manager" << std::endl;
// We're not actually registering with the service locator at this point, but
// several components we create could really use the proxy, so we create
@@ -610,8 +514,8 @@ void SipChannelServiceApp::initialize(const std::string appName)
std::cerr << "[DEBUG] Created SIP endpoint factory" << std::endl;
// Create and configure our Endpoint Locator.
- mDataModelInstance.mEndpointLocator = new SipChannelServiceEndpointLocator(mEndpointFactory);
- mGlobalAdapter->add(mDataModelInstance.mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
+ mEndpointLocator = new SipChannelServiceEndpointLocator(mEndpointFactory);
+ mGlobalAdapter->add(mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
std::cerr << "[DEBUG] Got proxy to endpoint locator" << std::endl;
// Create and publish our ComponentService interface support.
@@ -678,9 +582,6 @@ int SipChannelServiceApp::run(int argc, char* argv[])
// Remove our state listener
deregisterFromStateReplicator();
- // Give our singleton a chance to shut down gracefully.
- mDataModelInstance.cleanup();
-
return EXIT_SUCCESS;
}
diff --git a/src/SipChannelServiceDataModel.h b/src/SipChannelServiceDataModel.h
deleted file mode 100644
index 5a9dc9e..0000000
--- a/src/SipChannelServiceDataModel.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Asterisk Scalable Communications Framework
- *
- * Copyright (C) 2010 -- Digium, Inc.
- *
- * All rights reserved.
- */
-
-#pragma once
-
-#include <Ice/Ice.h>
-#include <boost/shared_ptr.hpp>
-#include "RoutingIf.h"
-#include "BridgingIf.h"
-#include "ServiceLocatorIf.h"
-#include "PJSipManager.h"
-#include "SipStateReplicator.h"
-
-namespace AsteriskSCF
-{
-namespace SipChannelService
-{
-class SipChannelServiceEventPublisher;
-class EndpointRegistry;
-class SipEndpointFactory;
-
-/**
- * Singleton for access to the service's data model.
- * TBD... This may well go away, and be replaced by the Data Store.
- * (At least for most of the items referenced here.)
- */
-class SipChannelServiceDataModel
-{
-public:
- static SipChannelServiceDataModel &getInstance();
-
- virtual const Ice::CommunicatorPtr getCommunicator() const = 0;
- virtual const SipChannelServiceEventPublisher& getEventPublisher() const = 0;
- virtual AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr getEndpointLocator() const = 0;
- virtual AsteriskSCF::Core::Routing::V1::LocatorRegistryPrx getRoutingService() const = 0;
- virtual AsteriskSCF::SessionCommunications::V1::SessionRouterPrx getSessionRouter() const = 0;
- virtual AsteriskSCF::SessionCommunications::Bridging::V1::BridgeManagerPrx getBridgeManager() const = 0;
- virtual boost::shared_ptr<SipEndpointFactory> getEndpointFactory() const = 0;
- virtual AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx getServiceLocator() const = 0;
- virtual PJSipManager *getPJSipManager() const = 0;
- virtual SipStateReplicatorPrx getStateReplicator() const = 0;
- virtual bool IsPaused() const = 0;
- virtual bool isActive() const = 0;
-
-protected:
- SipChannelServiceDataModel() {};
- ~SipChannelServiceDataModel() {};
-};
-
-}; // SipChannelService
-}; // AsteriskSCF
-
diff --git a/src/SipChannelServiceEndpointLocator.h b/src/SipChannelServiceEndpointLocator.h
index 380e7fe..7da0201 100644
--- a/src/SipChannelServiceEndpointLocator.h
+++ b/src/SipChannelServiceEndpointLocator.h
@@ -9,6 +9,7 @@
#pragma once
#include "RoutingIf.h"
+#include "SipEndpointFactory.h"
namespace AsteriskSCF
{
diff --git a/src/SipChannelServiceEventPublisher.cpp b/src/SipChannelServiceEventPublisher.cpp
index 7bbbff1..4c40152 100644
--- a/src/SipChannelServiceEventPublisher.cpp
+++ b/src/SipChannelServiceEventPublisher.cpp
@@ -9,7 +9,6 @@
#include <Ice/Ice.h>
#include <IceStorm/IceStorm.h>
-#include "SipChannelServiceDataModel.h"
#include "SipChannelServiceEventPublisher.h"
using namespace ::std;
@@ -26,7 +25,7 @@ namespace SipChannelService
class SipChannelServiceEventPublisherPriv
{
public:
- SipChannelServiceEventPublisherPriv() : mInitialized(false)
+ SipChannelServiceEventPublisherPriv(Ice::ObjectAdapterPtr adapter) : mInitialized(false), mAdapter(adapter)
{
initialize();
}
@@ -36,7 +35,7 @@ public:
*/
void initialize()
{
- const Ice::CommunicatorPtr& communicator = SipChannelServiceDataModel::getInstance().getCommunicator();
+ const Ice::CommunicatorPtr& communicator = mAdapter->getCommunicator();
IceStorm::TopicManagerPrx topicManager(0);
try
@@ -96,14 +95,15 @@ public:
public:
Event::SipChannelServiceEventsPrx mEventTopic;
+ Ice::ObjectAdapterPtr mAdapter;
bool mInitialized;
};
/**
* Class constructor.
*/
-SipChannelServiceEventPublisher::SipChannelServiceEventPublisher()
- : mImpl(new SipChannelServiceEventPublisherPriv())
+SipChannelServiceEventPublisher::SipChannelServiceEventPublisher(Ice::ObjectAdapterPtr adapter)
+ : mImpl(new SipChannelServiceEventPublisherPriv(adapter))
{
}
diff --git a/src/SipChannelServiceEventPublisher.h b/src/SipChannelServiceEventPublisher.h
index b8e9869..0a157aa 100644
--- a/src/SipChannelServiceEventPublisher.h
+++ b/src/SipChannelServiceEventPublisher.h
@@ -24,7 +24,7 @@ class SipChannelServiceEventPublisherPriv;
class SipChannelServiceEventPublisher
{
public:
- SipChannelServiceEventPublisher();
+ SipChannelServiceEventPublisher(Ice::ObjectAdapterPtr adapter);
/**
* Send a message to the service's event topic to report a lookup event.
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 643bc2c..0e17b19 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -11,7 +11,6 @@
#include <Core/Discovery/ServiceLocatorIf.h>
-#include "SipChannelServiceDataModel.h"
#include "PJSipManager.h"
#include "SipEndpointFactory.h"
#include "SipSession.h"
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 1bc2f91..c23a481 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -9,7 +9,6 @@
#include <Ice/Ice.h>
#include <IceUtil/UUID.h>
-#include "SipChannelServiceDataModel.h"
#include "PJSipManager.h"
#include "SipEndpointFactory.h"
#include "SipEndpoint.h"
@@ -438,7 +437,7 @@ void SipSession::destroy()
mImplPriv->mAdapter->remove(mImplPriv->mMediaSessionProxy->ice_getIdentity());
mImplPriv->mMediaSession = 0;
- if (SipChannelServiceDataModel::getInstance().isActive() == true)
+ if (mImplPriv->mReplica->isActive() == true)
{
// Release all the RTP sessions we are using
for (std::vector<AsteriskSCF::Media::RTP::V1::RTPSessionPrx>::const_iterator i = mImplPriv->mRTPSessions.begin(); i != mImplPriv->mRTPSessions.end(); ++i)
@@ -521,8 +520,7 @@ void SipSession::requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats)
AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParamsPtr params = new AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParams();
params->category = "rtp";
- SipChannelServiceDataModel& mDataModelInstance(SipChannelServiceDataModel::getInstance());
- AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx factory = AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx::uncheckedCast(mDataModelInstance.getServiceLocator()->locate(params));
+ AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx factory = AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx::uncheckedCast(mImplPriv->mServiceLocator->locate(params));
AsteriskSCF::Media::RTP::V1::RTPSessionPrx session = factory->allocate(formats);
mImplPriv->mRTPSessions.push_back(session);
commit 04eeb1e5a3fe9b0c22904ab856c3c011ffdd4800
Author: Mark Michelson <mmichelson at digium.com>
Date: Wed Oct 6 10:31:07 2010 -0500
Get the SipSession files to stop using the data model.
Next set of changes will be to finally eliminate the data model
once and for all.
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 32bbd45..dae561d 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -596,7 +596,17 @@ void SipChannelServiceApp::initialize(const std::string appName)
mLocalAdapter = communicator()->createObjectAdapter("SipChannelServiceLocalAdapter");
std::cerr << "[DEBUG] Created local object adapter" << std::endl;
- mEndpointFactory.reset(new SipEndpointFactory(mGlobalAdapter, mPJSipManager));
+ // We're not actually registering with the service locator at this point, but
+ // several components we create could really use the proxy, so we create
+ // it now.
+ mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+
+ // Create and publish our Replica interface support.
+ mReplicaService = new ReplicaImpl(mLocalAdapter);
+ mLocalAdapter->add(mReplicaService, communicator()->stringToIdentity(ReplicaServiceId));
+ std::cerr << "[DEBUG] Created SIP Replica Implementation" << std::endl;
+
+ mEndpointFactory.reset(new SipEndpointFactory(mGlobalAdapter, mPJSipManager, mServiceLocator, mReplicaService));
std::cerr << "[DEBUG] Created SIP endpoint factory" << std::endl;
// Create and configure our Endpoint Locator.
@@ -604,10 +614,6 @@ void SipChannelServiceApp::initialize(const std::string appName)
mGlobalAdapter->add(mDataModelInstance.mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
std::cerr << "[DEBUG] Got proxy to endpoint locator" << std::endl;
- // Create and publish our Replica interface support.
- mReplicaService = new ReplicaImpl(mLocalAdapter);
- mLocalAdapter->add(mReplicaService, communicator()->stringToIdentity(ReplicaServiceId));
-
// Create and publish our ComponentService interface support.
mComponentService = new ComponentServiceImpl(*this);
mLocalAdapter->add(mComponentService, communicator()->stringToIdentity(ComponentServiceId));
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 480209a..643bc2c 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -9,6 +9,8 @@
#include <Ice/Ice.h>
#include <IceUtil/UUID.h>
+#include <Core/Discovery/ServiceLocatorIf.h>
+
#include "SipChannelServiceDataModel.h"
#include "PJSipManager.h"
#include "SipEndpointFactory.h"
@@ -28,8 +30,9 @@ public:
/**
* Constructor for the SipEndpointImplPriv class.
*/
-SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, PJSipManager *manager) :
- mName(name), mAdapter(adapter), mEndpointFactory(factory), mManager(manager) { };
+SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, PJSipManager *manager,
+ const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica) :
+ mName(name), mAdapter(adapter), mEndpointFactory(factory), mManager(manager), mServiceLocator(serviceLocator), mReplica(replica) { };
/**
* The name of the endpoint.
*/
@@ -64,13 +67,24 @@ SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpoint
* The PJSIP manager
*/
PJSipManager *mManager;
+
+ /**
+ *
+ */
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx mServiceLocator;
+
+ /**
+ *
+ */
+ AsteriskSCF::System::Component::V1::ReplicaPtr mReplica;
};
/**
* Default constructor.
*/
-SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props, PJSipManager *manager)
- : mImplPriv(new SipEndpointImplPriv(adapter, factory, name, manager))
+SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props, PJSipManager *manager,
+ const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+ : mImplPriv(new SipEndpointImplPriv(adapter, factory, name, manager, serviceLocator, replica))
{
std::cout << "Constructing SIP endpoint " << name << std::endl;
@@ -192,14 +206,14 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
return 0;
}
- SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mManager);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplica);
mImplPriv->mSessions.push_back(session);
return session->getSessionProxy();
}
AsteriskSCF::SipChannelService::SipSessionPtr SipEndpoint::createSession(const std::string& destination)
{
- SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0, mImplPriv->mManager);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplica);
mImplPriv->mSessions.push_back(session);
return session;
}
@@ -209,7 +223,7 @@ AsteriskSCF::SipChannelService::SipSessionPtr SipEndpoint::createSession(const s
const AsteriskSCF::Media::V1::StreamSourceSeq& sources,
const AsteriskSCF::Media::V1::StreamSinkSeq& sinks)
{
- SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, mediaid, mediasession, sources, sinks, mImplPriv->mManager);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, mediaid, mediasession, sources, sinks, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplica);
mImplPriv->mSessions.push_back(session);
return session;
}
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 8c39659..52309e3 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -198,7 +198,8 @@ class SipEndpointImplPriv;
class SipEndpoint : public AsteriskSCF::SessionCommunications::V1::SessionEndpoint
{
public:
- SipEndpoint(Ice::ObjectAdapterPtr, boost::shared_ptr<SipEndpointFactory>, std::string name, Ice::PropertyDict props, PJSipManager *manager);
+ SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props, PJSipManager *manager,
+ const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica);
bool operator==(const std::string &name) const;
diff --git a/src/SipEndpointFactory.cpp b/src/SipEndpointFactory.cpp
index 9aa2e9a..7a62660 100644
--- a/src/SipEndpointFactory.cpp
+++ b/src/SipEndpointFactory.cpp
@@ -19,7 +19,7 @@ SipEndpointPtr SipEndpointFactory::createEndpoint(std::string destination, Ice::
std::string prefix("Sip.Endpoint.");
prefix.append(destination);
Ice::PropertyDict endpointProps = props->getPropertiesForPrefix(prefix);
- SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this(), destination, endpointProps, mManager);
+ SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this(), destination, endpointProps, mManager, mServiceLocator, mReplica);
mEndpoints.push_back(endpoint);
return endpoint;
}
diff --git a/src/SipEndpointFactory.h b/src/SipEndpointFactory.h
index 49e47a9..c24a67f 100644
--- a/src/SipEndpointFactory.h
+++ b/src/SipEndpointFactory.h
@@ -28,7 +28,10 @@ namespace SipChannelService
class SipEndpointFactory : public boost::enable_shared_from_this<SipEndpointFactory>
{
public:
-SipEndpointFactory(Ice::ObjectAdapterPtr adapter, PJSipManager *manager) : mAdapter(adapter), mManager(manager) { };
+ SipEndpointFactory(Ice::ObjectAdapterPtr adapter, PJSipManager *manager,
+ const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
+ const AsteriskSCF::System::Component::V1::ReplicaPtr replica) :
+ mAdapter(adapter), mManager(manager), mServiceLocator(serviceLocator), mReplica(replica) { };
SipEndpointPtr createEndpoint(std::string destination, Ice::PropertiesPtr props);
@@ -52,6 +55,16 @@ private:
* The PJSIP Manager.
*/
PJSipManager *mManager;
+
+ /**
+ *
+ */
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx mServiceLocator;
+
+ /**
+ *
+ */
+ AsteriskSCF::System::Component::V1::ReplicaPtr mReplica;
};
}; // end SipChannelService
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 5ebc78c..1bc2f91 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -61,9 +61,12 @@ public:
/**
* Constructor for the SipSessionPriv class.
*/
-SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, PJSipManager *manager)
+SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint,
+ const std::string& destination, PJSipManager *manager,
+ const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+ const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
: mAdapter(adapter), mDialog(0), mInviteSession(0), mEndpoint(endpoint), mDestination(destination),
- mManager(manager) { };
+ mManager(manager), mServiceLocator(serviceLocator), mReplica(replica) { };
/**
* An instance of a media session.
@@ -129,14 +132,20 @@ SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std
* The PJSIP manager
*/
PJSipManager *mManager;
+
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx mServiceLocator;
+
+ AsteriskSCF::System::Component::V1::ReplicaPtr mReplica;
};
/**
* Default constructor.
*/
-SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint,
- const std::string& destination, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- PJSipManager *manager) : mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager))
+SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination,
+ const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, PJSipManager *manager,
+ const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+ const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+ : mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager, serviceLocator, replica))
{
if (listener != 0)
{
@@ -157,9 +166,11 @@ SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint,
* Replica constructor.
*/
SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, const Ice::Identity& sessionid,
- const Ice::Identity& mediaid, const AsteriskSCF::Media::V1::SessionPrx& mediasession, const AsteriskSCF::Media::V1::StreamSourceSeq& sources,
- const AsteriskSCF::Media::V1::StreamSinkSeq& sinks, PJSipManager *manager)
-: mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager))
+ const Ice::Identity& mediaid, const AsteriskSCF::Media::V1::SessionPrx& mediasession,
+ const AsteriskSCF::Media::V1::StreamSourceSeq& sources, const AsteriskSCF::Media::V1::StreamSinkSeq& sinks,
+ PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+ const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+ : mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager, serviceLocator, replica))
{
mImplPriv->mSessionProxy = AsteriskSCF::SessionCommunications::V1::SessionPrx::uncheckedCast(adapter->add(this, sessionid));
diff --git a/src/SipSession.h b/src/SipSession.h
index 18aee0d..2ef6f54 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -19,6 +19,7 @@
#include <Media/RTP/MediaRTPIf.h>
#include "SipStateReplicationIf.h"
+#include "ReplicaIf.h"
#include <pjsip.h>
#include <pjmedia.h>
@@ -50,9 +51,16 @@ class PJSipManager;
class SipSession : public AsteriskSCF::SessionCommunications::V1::Session
{
public:
- SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, PJSipManager *manager);
- SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&, const Ice::Identity&, const Ice::Identity&,
- const AsteriskSCF::Media::V1::SessionPrx&, const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&, PJSipManager *manager);
+ SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&,
+ const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, PJSipManager *manager,
+ const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+ const AsteriskSCF::System::Component::V1::ReplicaPtr replica);
+
+ SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&, const Ice::Identity&,
+ const Ice::Identity&, const AsteriskSCF::Media::V1::SessionPrx&,
+ const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&,
+ PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+ const AsteriskSCF::System::Component::V1::ReplicaPtr replica);
bool operator==(const SipSession &other) const;
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index d3b446a..e241fe9 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -90,7 +90,8 @@ public:
localitem = newitem;
// Now that all is well we can create an actual session
- SipSessionPtr localSession = endpoint->createSession("", session->mSessionObjectId, session->mMediaSessionObjectId, session->mMediaSession, session->mSources, session->mSinks);
+ SipSessionPtr localSession = endpoint->createSession("", session->mSessionObjectId,
+ session->mMediaSessionObjectId, session->mMediaSession, session->mSources, session->mSinks);
localitem->setSession(localSession);
}
else
@@ -241,7 +242,7 @@ public:
};
SipStateReplicatorListenerI::SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory, PJSipManager *manager)
- : mImpl(new SipStateReplicatorListenerImpl(factory, manager)) {}
+ : mImpl(new SipStateReplicatorListenerImpl(factory, manager)) {}
SipStateReplicatorListenerI::~SipStateReplicatorListenerI()
{
commit 3d40f19897cd8902335663bec044efc669f2e464
Author: Mark Michelson <mmichelson at digium.com>
Date: Tue Oct 5 11:17:46 2010 -0500
Remove data model usage from PJSIP session module.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 225208c..a25531a 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -14,7 +14,6 @@
#include <Media/MediaIf.h>
#include "PJSipSessionModule.h"
-#include "SipChannelServiceDataModel.h"
#include "SipEndpoint.h"
#include "SipEndpointFactory.h"
#include "SipSession.h"
@@ -198,16 +197,15 @@ void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo, PJSipTransa
}
}
std::cout << "========== End State Replication Dump ==========" << std::endl;
- if (SipChannelServiceDataModel::getInstance().isActive() == true)
+ if (mReplica->isActive() == true)
{
- SipStateReplicatorPrx replicator = SipChannelServiceDataModel::getInstance().getStateReplicator();
- if (setItems.size() != 0 && replicator)
+ if (setItems.size() != 0 && mStateReplicator)
{
- replicator->setState(setItems);
+ mStateReplicator->setState(setItems);
}
- if (removeItems.size() != 0 && replicator)
+ if (removeItems.size() != 0 && mStateReplicator)
{
- replicator->removeState(removeItems);
+ mStateReplicator->removeState(removeItems);
}
}
}
@@ -295,7 +293,6 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
}
- SipChannelServiceDataModel &dataModel = SipChannelServiceDataModel::getInstance();
pjsip_uri *from = rdata->msg_info.from->uri;
std::string callerName("");
if (PJSIP_URI_SCHEME_IS_SIP(from) || PJSIP_URI_SCHEME_IS_SIPS(from))
@@ -345,10 +342,9 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
std::cerr << "[DEBUG] Replicating state on reception of new SIP INVITE." << std::endl;
replicateState(dlg_mod_info, tsx_mod_info, session_mod_info);
- AsteriskSCF::SessionCommunications::V1::SessionRouterPrx router = dataModel.getSessionRouter();
try
{
- router->routeSession(session->getSessionProxy(), destination);
+ mSessionRouter->routeSession(session->getSessionProxy(), destination);
}
catch (AsteriskSCF::Core::Routing::V1::DestinationNotFoundException&)
{
@@ -707,11 +703,9 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t st
params->parameters.push_back(parameter);
}
- SipChannelServiceDataModel &dataModel = SipChannelServiceDataModel::getInstance();
-
try
{
- MediaFormatServicePrx service = MediaFormatServicePrx::uncheckedCast(dataModel.getServiceLocator()->locate(params));
+ MediaFormatServicePrx service = MediaFormatServicePrx::uncheckedCast(mServiceLocator->locate(params));
// It is entirely possible for the service locator to not find a service that knows about this media format
if (service != 0)
commit cdf69412947aa08f113aaf4ae0b16c424ec8c41b
Author: Mark Michelson <mmichelson at digium.com>
Date: Tue Oct 5 11:11:24 2010 -0500
Add appropriate objects to the PJSIP session module so that data model
usage can be eliminated.
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 0cdbcc9..09edfba 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -54,9 +54,16 @@ PJSipManager::PJSipManager(Ice::PropertiesPtr props)
}
}
-void PJSipManager::registerSessionModule(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr)
+void PJSipManager::registerSessionModule(pjsip_endpoint *endpt,
+ boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr,
+ AsteriskSCF::SessionCommunications::V1::SessionRouterPrx sessionRouter,
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
+ AsteriskSCF::SIP::V1::SipStateReplicatorPrx stateReplicator,
+ AsteriskSCF::System::Component::V1::ReplicaPtr replica
+ )
{
- mSessionModule = new PJSipSessionModule(endpt, endpointFactoryPtr);
+ mSessionModule = new PJSipSessionModule(endpt, endpointFactoryPtr, sessionRouter,
+ serviceLocator, stateReplicator, replica);
}
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index e7c1a17..60b3036 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -51,7 +51,12 @@ public:
* for basic call handling
*/
void registerSessionModule(pjsip_endpoint *endpt,
- boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
+ boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr,
+ AsteriskSCF::SessionCommunications::V1::SessionRouterPrx sessionRouter,
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
+ AsteriskSCF::SIP::V1::SipStateReplicatorPrx stateReplicator,
+ AsteriskSCF::System::Component::V1::ReplicaPtr replica
+ );
private:
static PJSipManager *mInstance;
pjsip_endpoint *mEndpoint;
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index ba6d3b9..b18329d 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -15,6 +15,7 @@
#include "SipStateReplicator.h"
#include "SipSession.h"
#include "PJSipModule.h"
+#include "ReplicaIf.h"
namespace AsteriskSCF
{
@@ -42,7 +43,11 @@ private:
class PJSipSessionModule : public PJSipModule
{
public:
- PJSipSessionModule(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
+ PJSipSessionModule(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr,
+ AsteriskSCF::SessionCommunications::V1::SessionRouterPrx sessionRouter,
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
+ AsteriskSCF::SIP::V1::SipStateReplicatorPrx stateReplicator,
+ AsteriskSCF::System::Component::V1::ReplicaPtr replica);
pj_status_t load(pjsip_endpoint *endpoint);
pj_status_t start();
pj_status_t stop();
@@ -70,6 +75,10 @@ private:
pjsip_ua_init_param mUaParam;
const std::string mName;
boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
+ AsteriskSCF::SessionCommunications::V1::SessionRouterPrx mSessionRouter;
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx mServiceLocator;
+ AsteriskSCF::SIP::V1::SipStateReplicatorPrx mStateReplicator;
+ AsteriskSCF::System::Component::V1::ReplicaPtr mReplica;
};
}; //end namespace SipChannelService
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index 303ee91..d1fba6e 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -82,8 +82,15 @@ static pjsip_dialog *uaOnDialogForked(pjsip_dialog *first_set, pjsip_rx_data *rd
return sessionModule->uaOnDialogForked(first_set, rdata);
}
-PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr)
- : mName("Session Module"), mEndpointFactory(endpointFactoryPtr)
+PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt,
+ boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr,
+ AsteriskSCF::SessionCommunications::V1::SessionRouterPrx sessionRouter,
+ AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
+ AsteriskSCF::SIP::V1::SipStateReplicatorPrx stateReplicator,
+ AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+ : mName("Session Module"), mEndpointFactory(endpointFactoryPtr),
+ mSessionRouter(sessionRouter), mServiceLocator(serviceLocator),
+ mStateReplicator(stateReplicator), mReplica(replica)
{
sessionModule = this;
mModule.priority = PJSIP_MOD_PRIORITY_APPLICATION;
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index ee0aa89..32bbd45 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -172,8 +172,8 @@ private:
void locateBridgeService();
void registerWithRoutingService();
void deregisterFromRoutingService();
- void configureEndpoints(boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
- void registerPJSipModules(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
+ void configureEndpoints();
+ void registerPJSipModules(pjsip_endpoint *endpt);
void deregisterFromStateReplicator();
bool mDone;
@@ -193,6 +193,10 @@ private:
PJSipManager *mPJSipManager;
SipStateReplicatorListenerPtr mReplicatorListener;
SipStateReplicatorListenerPrx mReplicatorListenerProxy;
+ boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
+ ServiceLocatorPrx mServiceLocator;
+ SipStateReplicatorPrx mStateReplicator;
+ AsteriskSCF::SessionCommunications::V1::SessionRouterPrx mSessionRouter;
};
static const string ComponentServiceId("SipChannelComponent");
@@ -519,7 +523,7 @@ void SipChannelServiceApp::deregisterFromServiceLocator()
}
}
-void SipChannelServiceApp::configureEndpoints(boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr)
+void SipChannelServiceApp::configureEndpoints()
{
Ice::PropertiesPtr props = communicator()->getProperties();
Ice::StringSeq endpointNames = props->getPropertyAsList("Sip.Endpoints");
@@ -527,12 +531,11 @@ void SipChannelServiceApp::configureEndpoints(boost::shared_ptr<SipEndpointFacto
i != endpointNames.end();
++i)
{
- SipEndpointPtr endpoint = endpointFactoryPtr->createEndpoint(*i, props);
+ SipEndpointPtr endpoint = mEndpointFactory->createEndpoint(*i, props);
}
}
-void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt,
- boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr)
+void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt)
{
Ice::PropertiesPtr props = communicator()->getProperties();
Ice::StringSeq moduleNames = props->getPropertyAsList("Sip.Modules");
@@ -546,9 +549,11 @@ void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt,
//we'll just do it here instead.
if (*i == "Session")
{
- mPJSipManager->registerSessionModule(endpt, endpointFactoryPtr);
+ mPJSipManager->registerSessionModule(endpt, mEndpointFactory,
+ mSessionRouter, mServiceLocator, mStateReplicator, mReplicaService);
}
}
+ std::cerr << "[DEBUG] Registered PJSIP modules" << std::endl;
}
void SipChannelServiceApp::deregisterFromStateReplicator()
@@ -591,15 +596,11 @@ void SipChannelServiceApp::initialize(const std::string appName)
mLocalAdapter = communicator()->createObjectAdapter("SipChannelServiceLocalAdapter");
std::cerr << "[DEBUG] Created local object adapter" << std::endl;
- boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr(new SipEndpointFactory(mGlobalAdapter, mPJSipManager));
- mDataModelInstance.mEndpointFactory = endpointFactoryPtr;
+ mEndpointFactory.reset(new SipEndpointFactory(mGlobalAdapter, mPJSipManager));
std::cerr << "[DEBUG] Created SIP endpoint factory" << std::endl;
- registerPJSipModules(mPJSipManager->getEndpoint(), endpointFactoryPtr);
- std::cerr << "[DEBUG] Registered PJSIP modules" << std::endl;
-
// Create and configure our Endpoint Locator.
- mDataModelInstance.mEndpointLocator = new SipChannelServiceEndpointLocator(endpointFactoryPtr);
+ mDataModelInstance.mEndpointLocator = new SipChannelServiceEndpointLocator(mEndpointFactory);
mGlobalAdapter->add(mDataModelInstance.mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
std::cerr << "[DEBUG] Got proxy to endpoint locator" << std::endl;
@@ -613,7 +614,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
std::cerr << "[DEBUG] Added component service to object adapter" << std::endl;
// Create and publish our state replicator listener interface.
- mReplicatorListener = new SipStateReplicatorListenerI(endpointFactoryPtr, mPJSipManager);
+ mReplicatorListener = new SipStateReplicatorListenerI(mEndpointFactory, mPJSipManager);
mReplicatorListenerProxy = SipStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
std::cerr << "[DEBUG] Got proxy to SIP state replicator" << std::endl;
@@ -621,7 +622,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
mLocalAdapter->activate();
std::cerr << "[DEBUG] Activated object adapters" << std::endl;
- configureEndpoints(endpointFactoryPtr);
+ configureEndpoints();
std::cerr << "[DEBUG] Endpoints configured" << std::endl;
}
catch(...)
@@ -651,6 +652,7 @@ int SipChannelServiceApp::run(int argc, char* argv[])
// Locate the State Replicator so we can fail over!
locateStateReplicator();
+ registerPJSipModules(mPJSipManager->getEndpoint());
// Register our Endpoint Locator so that we can provide endpoints to the
// Routing Service for the endpoints we manage.
registerWithRoutingService();
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list