[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
Thu Jun 16 22:53:19 CDT 2011
branch "registrar" has been updated
via 9394b46cf8c83c0cfa83e73a34886aeb9f63913b (commit)
from 66b54622b2edd8c6f41fb76950e81121813804e2 (commit)
Summary of changes:
src/PJSipRegistrarModule.cpp | 10 ++++++++++
src/PJSipRegistrarModule.h | 2 ++
src/SipStateReplicatorListener.cpp | 32 +++++++++++++++++++++++++++++++-
3 files changed, 43 insertions(+), 1 deletions(-)
- Log -----------------------------------------------------------------
commit 9394b46cf8c83c0cfa83e73a34886aeb9f63913b
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Jun 16 22:53:04 2011 -0500
Almost finished with state replication stuff.
There is a compilation issue because of something screwy I'm doing
with std::find and the == operator in the BindingHolder. I'll get
to that in the morning though.
diff --git a/src/PJSipRegistrarModule.cpp b/src/PJSipRegistrarModule.cpp
index e002155..ff5a3b9 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/PJSipRegistrarModule.cpp
@@ -73,6 +73,16 @@ bool BindingHolder::operator==(const BindingHolder& rhs)
return mBinding->contact == rhs.mBinding->contact;
}
+bool BindingHolder::operator==(const BindingPtr& rhs)
+{
+ return mBinding->contact == rhs->contact;
+}
+
+bool BindingHolder::operator==(const Binding& rhs)
+{
+ return mBinding->contact == rhs.contact;
+}
+
void BindingHolder::cancelRegistrationExpiration()
{
pjsip_endpt_cancel_timer(mEndpoint, &mEntry);
diff --git a/src/PJSipRegistrarModule.h b/src/PJSipRegistrarModule.h
index 7637c69..1510c96 100644
--- a/src/PJSipRegistrarModule.h
+++ b/src/PJSipRegistrarModule.h
@@ -50,6 +50,8 @@ public:
void updateBinding(const std::string &callID, int cSeq, int expiration);
bool operator==(const BindingHolder& rhs);
+ bool operator==(const AsteriskSCF::SIP::Registration::V1::BindingPtr& rhs);
+ bool operator==(const AsteriskSCF::SIP::Registration::V1::Binding& rhs);
RegistrarIPtr mRegistrar;
AsteriskSCF::SIP::Registration::V1::BindingPtr mBinding;
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 15aa91b..0fb5c15 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -128,10 +128,40 @@ public:
for (BindingDict::iterator dictIter = regItem->bindings.begin();
dictIter != regItem->bindings.end(); ++dictIter)
{
+ BindingSeq bindings = dictIter->second;
+ BindingHolderSeq emptySeq;
+ BindingHolderSeq holderSeq;
+ for (BindingSeq::iterator seqIter = bindings.begin();
+ seqIter != bindings.end(); ++seqIter)
+ {
+ int relativeExpiration = (*seqIter)->expiration - time(NULL);
+
+ BindingHolder *holder(new BindingHolder(
+ relativeExpiration,
+ *seqIter,
+ regModule->getRegistrar(),
+ mManager->getEndpoint(),
+ dictIter->first));
+
+ holderSeq.push_back(holder);
+ }
+ regModule->getRegistrar()->updateBindings(dictIter->first, holderSeq, emptySeq);
}
}
void setExistingRegistrationState(const PJSipRegistrarModulePtr& regModule, const SipRegistrarStateItemPtr& regItem)
{
+ for (BindingDict::iterator dictIter = regItem->bindings.begin();
+ dictIter != regItem->bindings.end(); ++dictIter)
+ {
+ BindingHolderSeq& bindings = regModule->getRegistrar()->getAORBindingHolders(dictIter->first);
+ for (BindingSeq::iterator seqIter = dictIter->second.begin();
+ seqIter != dictIter->second.end(); ++seqIter)
+ {
+ BindingHolderSeq::iterator bindingToUpdate =
+ std::find(bindings.begin(), bindings.end(), *seqIter);
+ (*bindingToUpdate)->updateBinding((*seqIter)->callid, (*seqIter)->cseq, (*seqIter)->expiration - time(NULL));
+ }
+ }
}
void setRegistrationState(const PJSipRegistrarModulePtr& regModule, const SipRegistrarStateItemPtr& regItem)
@@ -141,7 +171,7 @@ public:
// information strictly for existing bindings (to update the CSeq and expiration).
// What we need to do is determine which this is and act appropriately.
- if (regItem->newItems)
+ if (regItem->newBindings)
{
setNewRegistrationState(regModule, regItem);
}
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list