[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Mon Oct 4 16:08:05 CDT 2010
branch "master" has been updated
via 1f706b33b2ae203003a54a75ad3ba4914a0b0aef (commit)
via 8047f0055243398ab5cec4ba6b0594a0b80c1c93 (commit)
via 948378455fd973d5884a1ba1af821a0f99ee3f04 (commit)
via 5838376cde3d6e516337139fa321a1b1e0d80bc1 (commit)
via 7381d02ee59919089afb793d037179ecae472482 (commit)
from 88fbb3b78ded6b6a48be306b56dca184f6d9f6bf (commit)
Summary of changes:
src/PJSipManager.cpp | 4 ++--
src/PJSipManager.h | 3 ++-
src/PJSipSessionModule.cpp | 3 +--
src/PJSipSessionModule.h | 3 ++-
src/PJSipSessionModuleConstruction.cpp | 6 ++----
src/SipChannelServiceApp.cpp | 17 +++++++++--------
src/SipEndpoint.cpp | 19 ++++++++++++-------
src/SipEndpoint.h | 2 +-
src/SipEndpointFactory.cpp | 2 +-
src/SipEndpointFactory.h | 7 ++++++-
src/SipSession.cpp | 21 ++++++++++++++-------
src/SipSession.h | 7 +++++--
src/SipStateReplicator.h | 2 +-
src/SipStateReplicatorListener.cpp | 14 +++++++-------
14 files changed, 65 insertions(+), 45 deletions(-)
- Log -----------------------------------------------------------------
commit 1f706b33b2ae203003a54a75ad3ba4914a0b0aef
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Oct 4 15:53:44 2010 -0500
Eliminate data model usage from the SipStateReplicatorListener.
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 1a656f6..ee0aa89 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -613,7 +613,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);
+ mReplicatorListener = new SipStateReplicatorListenerI(endpointFactoryPtr, mPJSipManager);
mReplicatorListenerProxy = SipStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
std::cerr << "[DEBUG] Got proxy to SIP state replicator" << std::endl;
diff --git a/src/SipStateReplicator.h b/src/SipStateReplicator.h
index 0b8b8d9..bcb9866 100644
--- a/src/SipStateReplicator.h
+++ b/src/SipStateReplicator.h
@@ -43,7 +43,7 @@ typedef IceUtil::Handle<SipStateReplicatorI> SipStateReplicatorIPtr;
class SipStateReplicatorListenerI : public SipStateReplicatorListener
{
public:
- SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory);
+ SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory, PJSipManager *manager);
~SipStateReplicatorListenerI();
void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
void stateSet(const SipStateItemSeq&, const Ice::Current&);
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 3f57cef..d3b446a 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -12,7 +12,6 @@
#include <boost/shared_ptr.hpp>
#include "SipStateReplicator.h"
-#include "SipChannelServiceDataModel.h"
#include "SipEndpoint.h"
#include "SipEndpointFactory.h"
#include "SipSession.h"
@@ -51,7 +50,8 @@ private:
struct SipStateReplicatorListenerImpl
{
public:
- SipStateReplicatorListenerImpl(boost::shared_ptr<SipEndpointFactory> factory) : mId(IceUtil::generateUUID()), mEndpointFactory(factory) {}
+ SipStateReplicatorListenerImpl(boost::shared_ptr<SipEndpointFactory> factory, PJSipManager *manager)
+ : mId(IceUtil::generateUUID()), mEndpointFactory(factory), mManager(manager) {}
void removeStateNoticeImpl(const Ice::StringSeq& itemKeys)
{
for (Ice::StringSeq::const_iterator key = itemKeys.begin(); key != itemKeys.end(); ++key)
@@ -76,7 +76,6 @@ public:
{
if (i == mStateItems.end())
{
- SipChannelServiceDataModel &dataModel = SipChannelServiceDataModel::getInstance();
SipEndpointPtr endpoint = mEndpointFactory->findByName(session->mEndpointName);
// If we lack the endpoint (due to misconfiguration) we can't procceed
@@ -132,7 +131,7 @@ public:
i->second->getSession()->setDialog(localDialog);
PJSipDialogModInfo *dlg_mod_info = new PJSipDialogModInfo(localDialog);
- localDialog->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule().id] = (void *) dlg_mod_info;
+ localDialog->mod_data[mManager->getSessionModule().id] = (void *) dlg_mod_info;
}
localDialog->state = (dialog->mIsDialogEstablished == true) ? PJSIP_DIALOG_STATE_ESTABLISHED : PJSIP_DIALOG_STATE_NULL;
@@ -180,7 +179,7 @@ public:
localInviteSession->role = localDialog->role;
PJSipSessionModInfo *session_mod_info = new PJSipSessionModInfo(localInviteSession, i->second->getSession());
- localInviteSession->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule().id] = session_mod_info;
+ localInviteSession->mod_data[mManager->getSessionModule().id] = session_mod_info;
i->second->getSession()->setInviteSession(localInviteSession);
}
@@ -238,10 +237,11 @@ public:
std::string mId;
std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> > mStateItems;
boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
+ PJSipManager *mManager;
};
-SipStateReplicatorListenerI::SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory)
- : mImpl(new SipStateReplicatorListenerImpl(factory)) {}
+SipStateReplicatorListenerI::SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory, PJSipManager *manager)
+ : mImpl(new SipStateReplicatorListenerImpl(factory, manager)) {}
SipStateReplicatorListenerI::~SipStateReplicatorListenerI()
{
commit 8047f0055243398ab5cec4ba6b0594a0b80c1c93
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Oct 4 15:38:06 2010 -0500
Add the SipEndpointFactory to the PJSipSessionModule to reduce data model dependency.
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index bee9e2a..0cdbcc9 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -54,9 +54,9 @@ PJSipManager::PJSipManager(Ice::PropertiesPtr props)
}
}
-void PJSipManager::registerSessionModule(pjsip_endpoint *endpt)
+void PJSipManager::registerSessionModule(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr)
{
- mSessionModule = new PJSipSessionModule(endpt);
+ mSessionModule = new PJSipSessionModule(endpt, endpointFactoryPtr);
}
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index 06ee84c..e7c1a17 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -50,7 +50,8 @@ public:
* Register the PJSipSessionModule, responsible
* for basic call handling
*/
- void registerSessionModule(pjsip_endpoint *endpt);
+ void registerSessionModule(pjsip_endpoint *endpt,
+ boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
private:
static PJSipManager *mInstance;
pjsip_endpoint *mEndpoint;
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 549e7fa..225208c 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -296,7 +296,6 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
}
SipChannelServiceDataModel &dataModel = SipChannelServiceDataModel::getInstance();
- boost::shared_ptr<SipEndpointFactory> factory = dataModel.getEndpointFactory();
pjsip_uri *from = rdata->msg_info.from->uri;
std::string callerName("");
if (PJSIP_URI_SCHEME_IS_SIP(from) || PJSIP_URI_SCHEME_IS_SIPS(from))
@@ -305,7 +304,7 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
callerName = std::string(pj_strbuf(&sipFrom->user), pj_strlen(&sipFrom->user));
std::cerr << "[DEBUG] Got caller name " << callerName << std::endl;
}
- SipEndpointPtr caller = factory->findByName(callerName);
+ SipEndpointPtr caller = mEndpointFactory->findByName(callerName);
if (caller == 0)
{
std::cerr << "[WARNING] Unknown calling endpoint " << callerName << std::endl;
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index 943ba6e..ba6d3b9 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -42,7 +42,7 @@ private:
class PJSipSessionModule : public PJSipModule
{
public:
- PJSipSessionModule(pjsip_endpoint *endpt);
+ PJSipSessionModule(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
pj_status_t load(pjsip_endpoint *endpoint);
pj_status_t start();
pj_status_t stop();
@@ -69,6 +69,7 @@ private:
pjsip_inv_callback mInvCallback;
pjsip_ua_init_param mUaParam;
const std::string mName;
+ boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
};
}; //end namespace SipChannelService
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index 87cc72f..303ee91 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -82,7 +82,8 @@ static pjsip_dialog *uaOnDialogForked(pjsip_dialog *first_set, pjsip_rx_data *rd
return sessionModule->uaOnDialogForked(first_set, rdata);
}
-PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt) : mName("Session Module")
+PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr)
+ : mName("Session Module"), mEndpointFactory(endpointFactoryPtr)
{
sessionModule = this;
mModule.priority = PJSIP_MOD_PRIORITY_APPLICATION;
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 7699bd8..1a656f6 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -173,7 +173,7 @@ private:
void registerWithRoutingService();
void deregisterFromRoutingService();
void configureEndpoints(boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
- void registerPJSipModules(pjsip_endpoint *endpt);
+ void registerPJSipModules(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
void deregisterFromStateReplicator();
bool mDone;
@@ -531,7 +531,8 @@ void SipChannelServiceApp::configureEndpoints(boost::shared_ptr<SipEndpointFacto
}
}
-void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt)
+void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt,
+ boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr)
{
Ice::PropertiesPtr props = communicator()->getProperties();
Ice::StringSeq moduleNames = props->getPropertyAsList("Sip.Modules");
@@ -545,7 +546,7 @@ void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt)
//we'll just do it here instead.
if (*i == "Session")
{
- mPJSipManager->registerSessionModule(endpt);
+ mPJSipManager->registerSessionModule(endpt, endpointFactoryPtr);
}
}
}
@@ -590,13 +591,13 @@ void SipChannelServiceApp::initialize(const std::string appName)
mLocalAdapter = communicator()->createObjectAdapter("SipChannelServiceLocalAdapter");
std::cerr << "[DEBUG] Created local object adapter" << std::endl;
- registerPJSipModules(mPJSipManager->getEndpoint());
- std::cerr << "[DEBUG] Registered PJSIP modules" << std::endl;
-
boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr(new SipEndpointFactory(mGlobalAdapter, mPJSipManager));
mDataModelInstance.mEndpointFactory = endpointFactoryPtr;
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);
mGlobalAdapter->add(mDataModelInstance.mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
commit 948378455fd973d5884a1ba1af821a0f99ee3f04
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Oct 4 15:27:53 2010 -0500
Reduce usage of data model more by adding the pjsip_endpoint to the
PJSipSessionModule's constructor.
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 3f85f7c..bee9e2a 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -54,9 +54,9 @@ PJSipManager::PJSipManager(Ice::PropertiesPtr props)
}
}
-void PJSipManager::registerSessionModule()
+void PJSipManager::registerSessionModule(pjsip_endpoint *endpt)
{
- mSessionModule = new PJSipSessionModule();
+ mSessionModule = new PJSipSessionModule(endpt);
}
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index 3c7dd0d..06ee84c 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -50,7 +50,7 @@ public:
* Register the PJSipSessionModule, responsible
* for basic call handling
*/
- void registerSessionModule();
+ void registerSessionModule(pjsip_endpoint *endpt);
private:
static PJSipManager *mInstance;
pjsip_endpoint *mEndpoint;
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index c4846a5..943ba6e 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -42,7 +42,7 @@ private:
class PJSipSessionModule : public PJSipModule
{
public:
- PJSipSessionModule();
+ PJSipSessionModule(pjsip_endpoint *endpt);
pj_status_t load(pjsip_endpoint *endpoint);
pj_status_t start();
pj_status_t stop();
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index 3d3a6ed..87cc72f 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -82,7 +82,7 @@ static pjsip_dialog *uaOnDialogForked(pjsip_dialog *first_set, pjsip_rx_data *rd
return sessionModule->uaOnDialogForked(first_set, rdata);
}
-PJSipSessionModule::PJSipSessionModule() : mName("Session Module")
+PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt) : mName("Session Module")
{
sessionModule = this;
mModule.priority = PJSIP_MOD_PRIORITY_APPLICATION;
@@ -115,9 +115,6 @@ PJSipSessionModule::PJSipSessionModule() : mName("Session Module")
mInvCallback.on_redirected = AsteriskSCF::SipChannelService::invOnRedirected;
}
- SipChannelServiceDataModel &dataModel = SipChannelServiceDataModel::getInstance();
- PJSipManager *manager = dataModel.getPJSipManager();
- pjsip_endpoint *endpt = manager->getEndpoint();
pjsip_tsx_layer_init_module(endpt);
pjsip_ua_init_module(endpt, &mUaParam);
pjsip_100rel_init_module(endpt);
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 8340501..7699bd8 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -173,7 +173,7 @@ private:
void registerWithRoutingService();
void deregisterFromRoutingService();
void configureEndpoints(boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr);
- void registerPJSipModules();
+ void registerPJSipModules(pjsip_endpoint *endpt);
void deregisterFromStateReplicator();
bool mDone;
@@ -531,7 +531,7 @@ void SipChannelServiceApp::configureEndpoints(boost::shared_ptr<SipEndpointFacto
}
}
-void SipChannelServiceApp::registerPJSipModules()
+void SipChannelServiceApp::registerPJSipModules(pjsip_endpoint *endpt)
{
Ice::PropertiesPtr props = communicator()->getProperties();
Ice::StringSeq moduleNames = props->getPropertyAsList("Sip.Modules");
@@ -545,7 +545,7 @@ void SipChannelServiceApp::registerPJSipModules()
//we'll just do it here instead.
if (*i == "Session")
{
- mPJSipManager->registerSessionModule();
+ mPJSipManager->registerSessionModule(endpt);
}
}
}
@@ -590,7 +590,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
mLocalAdapter = communicator()->createObjectAdapter("SipChannelServiceLocalAdapter");
std::cerr << "[DEBUG] Created local object adapter" << std::endl;
- registerPJSipModules();
+ registerPJSipModules(mPJSipManager->getEndpoint());
std::cerr << "[DEBUG] Registered PJSIP modules" << std::endl;
boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr(new SipEndpointFactory(mGlobalAdapter, mPJSipManager));
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index f938e0d..5ebc78c 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -359,7 +359,7 @@ void SipSession::start(const Ice::Current&)
// Record our session within the dialog so code handling pjsip events can do STUFF
SipSessionPtr session = new SipSession(*this);
PJSipSessionModInfo *session_mod_info = new PJSipSessionModInfo(inviteSession, session);
- inviteSession->mod_data[SipChannelServiceDataModel::getInstance().getPJSipManager()->getSessionModule().id] = (void*)session_mod_info;
+ inviteSession->mod_data[mImplPriv->mManager->getSessionModule().id] = (void*)session_mod_info;
// Create the actual INVITE packet
pjsip_tx_data *packet;
commit 5838376cde3d6e516337139fa321a1b1e0d80bc1
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Oct 4 15:17:47 2010 -0500
Change the module ID members to be pointers to the PJSIP manager.
This will give more power to perhaps grab other module IDs and other
stuff that may be needed and such.
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 5e308bd..8340501 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -593,7 +593,7 @@ void SipChannelServiceApp::initialize(const std::string appName)
registerPJSipModules();
std::cerr << "[DEBUG] Registered PJSIP modules" << std::endl;
- boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr(new SipEndpointFactory(mGlobalAdapter, mPJSipManager->getSessionModule().id));
+ boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr(new SipEndpointFactory(mGlobalAdapter, mPJSipManager));
mDataModelInstance.mEndpointFactory = endpointFactoryPtr;
std::cerr << "[DEBUG] Created SIP endpoint factory" << std::endl;
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 88772a7..480209a 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -28,8 +28,8 @@ public:
/**
* Constructor for the SipEndpointImplPriv class.
*/
-SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, int sessionModuleId) :
- mName(name), mAdapter(adapter), mEndpointFactory(factory), mSessionModuleId(sessionModuleId) { };
+SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, PJSipManager *manager) :
+ mName(name), mAdapter(adapter), mEndpointFactory(factory), mManager(manager) { };
/**
* The name of the endpoint.
*/
@@ -61,16 +61,16 @@ SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpoint
AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx mEndpointProxy;
/**
- * The id for the PJSIP session module
+ * The PJSIP manager
*/
- int mSessionModuleId;
+ PJSipManager *mManager;
};
/**
* Default constructor.
*/
-SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props, int sessionModuleId)
- : mImplPriv(new SipEndpointImplPriv(adapter, factory, name, sessionModuleId))
+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))
{
std::cout << "Constructing SIP endpoint " << name << std::endl;
@@ -192,14 +192,14 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
return 0;
}
- SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mSessionModuleId);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mManager);
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->mSessionModuleId);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0, mImplPriv->mManager);
mImplPriv->mSessions.push_back(session);
return session;
}
@@ -209,7 +209,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->mSessionModuleId);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, mediaid, mediasession, sources, sinks, mImplPriv->mManager);
mImplPriv->mSessions.push_back(session);
return session;
}
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 55f3a9f..8c39659 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -198,7 +198,7 @@ class SipEndpointImplPriv;
class SipEndpoint : public AsteriskSCF::SessionCommunications::V1::SessionEndpoint
{
public:
- SipEndpoint(Ice::ObjectAdapterPtr, boost::shared_ptr<SipEndpointFactory>, std::string name, Ice::PropertyDict props, int sessionModuleId);
+ SipEndpoint(Ice::ObjectAdapterPtr, boost::shared_ptr<SipEndpointFactory>, std::string name, Ice::PropertyDict props, PJSipManager *manager);
bool operator==(const std::string &name) const;
diff --git a/src/SipEndpointFactory.cpp b/src/SipEndpointFactory.cpp
index d86445a..9aa2e9a 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, mSessionModuleId);
+ SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this(), destination, endpointProps, mManager);
mEndpoints.push_back(endpoint);
return endpoint;
}
diff --git a/src/SipEndpointFactory.h b/src/SipEndpointFactory.h
index 217d973..49e47a9 100644
--- a/src/SipEndpointFactory.h
+++ b/src/SipEndpointFactory.h
@@ -28,7 +28,7 @@ namespace SipChannelService
class SipEndpointFactory : public boost::enable_shared_from_this<SipEndpointFactory>
{
public:
-SipEndpointFactory(Ice::ObjectAdapterPtr adapter, int sessionModuleId) : mAdapter(adapter), mSessionModuleId(sessionModuleId) { };
+SipEndpointFactory(Ice::ObjectAdapterPtr adapter, PJSipManager *manager) : mAdapter(adapter), mManager(manager) { };
SipEndpointPtr createEndpoint(std::string destination, Ice::PropertiesPtr props);
@@ -49,9 +49,9 @@ private:
std::vector<SipEndpointPtr> mEndpoints;
/**
- * The module ID of the PJSIP session module
+ * The PJSIP Manager.
*/
- int mSessionModuleId;
+ PJSipManager *mManager;
};
}; // end SipChannelService
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 4fe447a..f938e0d 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -61,9 +61,9 @@ public:
/**
* Constructor for the SipSessionPriv class.
*/
-SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, int sessionModuleId)
+SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, PJSipManager *manager)
: mAdapter(adapter), mDialog(0), mInviteSession(0), mEndpoint(endpoint), mDestination(destination),
- mSessionModuleId(sessionModuleId){ };
+ mManager(manager) { };
/**
* An instance of a media session.
@@ -126,16 +126,17 @@ SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std
std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx> mListeners;
/**
- * The id of the PJSIP session module
+ * The PJSIP manager
*/
- int mSessionModuleId;
+ PJSipManager *mManager;
};
/**
* Default constructor.
*/
-SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, int sessionModuleId)
-: mImplPriv(new SipSessionPriv(adapter, endpoint, destination, sessionModuleId))
+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))
{
if (listener != 0)
{
@@ -157,8 +158,8 @@ SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, c
*/
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, int sessionModuleId)
-: mImplPriv(new SipSessionPriv(adapter, endpoint, destination, sessionModuleId))
+ const AsteriskSCF::Media::V1::StreamSinkSeq& sinks, PJSipManager *manager)
+: mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager))
{
mImplPriv->mSessionProxy = AsteriskSCF::SessionCommunications::V1::SessionPrx::uncheckedCast(adapter->add(this, sessionid));
diff --git a/src/SipSession.h b/src/SipSession.h
index 81d4d48..18aee0d 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -41,15 +41,18 @@ typedef IceUtil::Handle<SipEndpoint> SipEndpointPtr;
*/
class SipSessionPriv;
+//I can haz forward declaration.
+class PJSipManager;
+
/*
* Implementation of the Session interface as defined in SessionCommunicationsIf.ice
*/
class SipSession : public AsteriskSCF::SessionCommunications::V1::Session
{
public:
- SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, int sessionModuleId);
+ 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&, int sessionModuleId);
+ const AsteriskSCF::Media::V1::SessionPrx&, const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&, PJSipManager *manager);
bool operator==(const SipSession &other) const;
commit 7381d02ee59919089afb793d037179ecae472482
Author: Mark Michelson <mmichelson at digium.com>
Date: Mon Oct 4 15:05:34 2010 -0500
Add the session module ID to several objects so that they don't have
to use the data model to get it.
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 82bf1e3..5e308bd 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -590,7 +590,10 @@ 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));
+ registerPJSipModules();
+ std::cerr << "[DEBUG] Registered PJSIP modules" << std::endl;
+
+ boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr(new SipEndpointFactory(mGlobalAdapter, mPJSipManager->getSessionModule().id));
mDataModelInstance.mEndpointFactory = endpointFactoryPtr;
std::cerr << "[DEBUG] Created SIP endpoint factory" << std::endl;
@@ -619,9 +622,6 @@ void SipChannelServiceApp::initialize(const std::string appName)
configureEndpoints(endpointFactoryPtr);
std::cerr << "[DEBUG] Endpoints configured" << std::endl;
-
- registerPJSipModules();
- std::cerr << "[DEBUG] Registered PJSIP modules" << std::endl;
}
catch(...)
{
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 8cfbd17..88772a7 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -28,8 +28,8 @@ public:
/**
* Constructor for the SipEndpointImplPriv class.
*/
-SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name) :
- mName(name), mAdapter(adapter), mEndpointFactory(factory) { };
+SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, int sessionModuleId) :
+ mName(name), mAdapter(adapter), mEndpointFactory(factory), mSessionModuleId(sessionModuleId) { };
/**
* The name of the endpoint.
*/
@@ -59,13 +59,18 @@ SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpoint
* A proxy to our endpoint.
*/
AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx mEndpointProxy;
+
+ /**
+ * The id for the PJSIP session module
+ */
+ int mSessionModuleId;
};
/**
* Default constructor.
*/
-SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props)
- : mImplPriv(new SipEndpointImplPriv(adapter, factory, name))
+SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props, int sessionModuleId)
+ : mImplPriv(new SipEndpointImplPriv(adapter, factory, name, sessionModuleId))
{
std::cout << "Constructing SIP endpoint " << name << std::endl;
@@ -187,14 +192,14 @@ AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(co
return 0;
}
- SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mSessionModuleId);
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);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0, mImplPriv->mSessionModuleId);
mImplPriv->mSessions.push_back(session);
return session;
}
@@ -204,7 +209,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);
+ SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, mediaid, mediasession, sources, sinks, mImplPriv->mSessionModuleId);
mImplPriv->mSessions.push_back(session);
return session;
}
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 5f3d2cd..55f3a9f 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -198,7 +198,7 @@ class SipEndpointImplPriv;
class SipEndpoint : public AsteriskSCF::SessionCommunications::V1::SessionEndpoint
{
public:
- SipEndpoint(Ice::ObjectAdapterPtr, boost::shared_ptr<SipEndpointFactory>, std::string name, Ice::PropertyDict props);
+ SipEndpoint(Ice::ObjectAdapterPtr, boost::shared_ptr<SipEndpointFactory>, std::string name, Ice::PropertyDict props, int sessionModuleId);
bool operator==(const std::string &name) const;
diff --git a/src/SipEndpointFactory.cpp b/src/SipEndpointFactory.cpp
index e9d7240..d86445a 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);
+ SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this(), destination, endpointProps, mSessionModuleId);
mEndpoints.push_back(endpoint);
return endpoint;
}
diff --git a/src/SipEndpointFactory.h b/src/SipEndpointFactory.h
index d8977f8..217d973 100644
--- a/src/SipEndpointFactory.h
+++ b/src/SipEndpointFactory.h
@@ -28,7 +28,7 @@ namespace SipChannelService
class SipEndpointFactory : public boost::enable_shared_from_this<SipEndpointFactory>
{
public:
-SipEndpointFactory(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter) { };
+SipEndpointFactory(Ice::ObjectAdapterPtr adapter, int sessionModuleId) : mAdapter(adapter), mSessionModuleId(sessionModuleId) { };
SipEndpointPtr createEndpoint(std::string destination, Ice::PropertiesPtr props);
@@ -47,6 +47,11 @@ private:
* A vector of endpoints that this factory has created.
*/
std::vector<SipEndpointPtr> mEndpoints;
+
+ /**
+ * The module ID of the PJSIP session module
+ */
+ int mSessionModuleId;
};
}; // end SipChannelService
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index a1842ec..4fe447a 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -61,8 +61,9 @@ public:
/**
* Constructor for the SipSessionPriv class.
*/
-SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination)
- : mAdapter(adapter), mDialog(0), mInviteSession(0), mEndpoint(endpoint), mDestination(destination) { };
+SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, int sessionModuleId)
+ : mAdapter(adapter), mDialog(0), mInviteSession(0), mEndpoint(endpoint), mDestination(destination),
+ mSessionModuleId(sessionModuleId){ };
/**
* An instance of a media session.
@@ -123,13 +124,18 @@ SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std
* A vector of listeners that want to be notified of responses from the SIP endpoint.
*/
std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx> mListeners;
+
+ /**
+ * The id of the PJSIP session module
+ */
+ int mSessionModuleId;
};
/**
* Default constructor.
*/
-SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener)
-: mImplPriv(new SipSessionPriv(adapter, endpoint, destination))
+SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, int sessionModuleId)
+: mImplPriv(new SipSessionPriv(adapter, endpoint, destination, sessionModuleId))
{
if (listener != 0)
{
@@ -151,8 +157,8 @@ SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, c
*/
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)
-: mImplPriv(new SipSessionPriv(adapter, endpoint, destination))
+ const AsteriskSCF::Media::V1::StreamSinkSeq& sinks, int sessionModuleId)
+: mImplPriv(new SipSessionPriv(adapter, endpoint, destination, sessionModuleId))
{
mImplPriv->mSessionProxy = AsteriskSCF::SessionCommunications::V1::SessionPrx::uncheckedCast(adapter->add(this, sessionid));
diff --git a/src/SipSession.h b/src/SipSession.h
index 93fe244..81d4d48 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -47,9 +47,9 @@ class SipSessionPriv;
class SipSession : public AsteriskSCF::SessionCommunications::V1::Session
{
public:
- SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&);
+ SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, int sessionModuleId);
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&);
+ const AsteriskSCF::Media::V1::SessionPrx&, const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&, int sessionModuleId);
bool operator==(const SipSession &other) const;
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list