[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "registrar" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Jun 17 02:57:21 CDT 2011
branch "registrar" has been updated
via 47ce4d4e87b887297289ff6511bde2feb807a476 (commit)
via e2736843dca94388a5ad562b7096a53451e2d037 (commit)
from 9394b46cf8c83c0cfa83e73a34886aeb9f63913b (commit)
Summary of changes:
src/PJSipManager.cpp | 11 ++++++++++-
src/PJSipManager.h | 3 ++-
src/SipSessionManagerApp.cpp | 2 +-
src/SipStateReplicatorListener.cpp | 14 +++++++++++++-
4 files changed, 26 insertions(+), 4 deletions(-)
- Log -----------------------------------------------------------------
commit 47ce4d4e87b887297289ff6511bde2feb807a476
Author: Mark Michelson <mmichelson at digium.com>
Date: Fri Jun 17 02:57:48 2011 -0500
Add the registrar to our object adapter.
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index df04edc..4e96b4c 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -24,6 +24,7 @@ using namespace AsteriskSCF::System::Logging;
namespace
{
Logger lg = getLoggerFactory().getLogger("AsteriskSCF.SipSessionManager");
+const std::string& RegistrarId("SipRegistrar");
}
@@ -95,9 +96,17 @@ void PJSipManager::registerLoggingModule()
mLoggingModule = new PJSipLoggingModule(mEndpoint);
}
-void PJSipManager::registerRegistrarModule(const RegistrarListenerPrx& defaultListener, const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator)
+void PJSipManager::registerRegistrarModule(
+ const RegistrarListenerPrx& defaultListener,
+ const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+ Ice::ObjectAdapterPtr& adapter)
{
mRegistrarModule = new PJSipRegistrarModule(mEndpoint, defaultListener, stateReplicator);
+ //The registrar implements a published interface, so we need to add it to
+ //the object adapter
+ adapter->add(mRegistrarModule->getRegistrar(),
+ adapter->getCommunicator()->stringToIdentity(RegistrarId));
+ //XXX I suppose we need to add the registrar to the service locator too.
}
PJSipSessionModulePtr PJSipManager::getSessionModule()
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index fdae905..361b40a 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -96,7 +96,8 @@ public:
*/
void registerRegistrarModule(
const AsteriskSCF::SIP::Registration::V1::RegistrarListenerPrx& defaultListener,
- const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator);
+ const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
+ Ice::ObjectAdapterPtr& adapter);
/**
* Create a UDP transport.
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
index 10aef0a..15a9977 100644
--- a/src/SipSessionManagerApp.cpp
+++ b/src/SipSessionManagerApp.cpp
@@ -500,7 +500,7 @@ void SipSessionManager::registerPJSipModules()
{
lg(Warning) << "Adding NULL RegistrarListener as default listener????" << std::endl;
}
- mPJSipManager->registerRegistrarModule(defaultListener, mStateReplicator);
+ mPJSipManager->registerRegistrarModule(defaultListener, mStateReplicator, mGlobalAdapter);
}
}
lg(Debug) << "Registered PJSIP modules";
commit e2736843dca94388a5ad562b7096a53451e2d037
Author: Mark Michelson <mmichelson at digium.com>
Date: Fri Jun 17 02:35:40 2011 -0500
Fix my broken usage of std::find by using std::find_if with a custom predicate.
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 0fb5c15..4769f8f 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -148,6 +148,18 @@ public:
regModule->getRegistrar()->updateBindings(dictIter->first, holderSeq, emptySeq);
}
}
+
+ struct BindingFinder
+ {
+ BindingFinder(const BindingPtr& binding)
+ : mBinding(binding) { }
+ bool operator()(BindingHolder *holder)
+ {
+ return *holder == mBinding;
+ }
+ BindingPtr mBinding;
+ };
+
void setExistingRegistrationState(const PJSipRegistrarModulePtr& regModule, const SipRegistrarStateItemPtr& regItem)
{
for (BindingDict::iterator dictIter = regItem->bindings.begin();
@@ -158,7 +170,7 @@ public:
seqIter != dictIter->second.end(); ++seqIter)
{
BindingHolderSeq::iterator bindingToUpdate =
- std::find(bindings.begin(), bindings.end(), *seqIter);
+ std::find_if(bindings.begin(), bindings.end(), BindingFinder(*seqIter));
(*bindingToUpdate)->updateBinding((*seqIter)->callid, (*seqIter)->cseq, (*seqIter)->expiration - time(NULL));
}
}
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list