[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
Wed Sep 15 14:17:01 CDT 2010
branch "master" has been updated
via 0ec999f182c937b27c2efa34c621c3f61c5189da (commit)
via 639c3b7e0f8318875545b63d30f8db3012828388 (commit)
via d04fefb409fd0ab0c8ff6abd8c31521c8b2626ff (commit)
from 0c484b67b48ba5812459eb9c15cc7d4a8a8416e4 (commit)
Summary of changes:
src/PJSipSessionModule.cpp | 75 +++++++++++++++++++++++++++++++------------
1 files changed, 54 insertions(+), 21 deletions(-)
- Log -----------------------------------------------------------------
commit 0ec999f182c937b27c2efa34c621c3f61c5189da
Author: Mark Michelson <mmichelson at digium.com>
Date: Wed Sep 15 14:17:52 2010 -0500
Allow replicateState to remove state items as well.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 5a13047..810a917 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -115,6 +115,11 @@ public:
* if nothing has actually changed for the dialog.
*/
bool mNeedsReplication;
+ /**
+ * An indicator of whether state needs to be removed from the state replicator.
+ * This will coincide with when the corresponding PJSIP item is destroyed.
+ */
+ bool mNeedsRemoval;
};
class PJSipTransactionModInfo
@@ -134,6 +139,7 @@ public:
}
SipTransactionStateItemPtr mTransactionState;
bool mNeedsReplication;
+ bool mNeedsRemoval;
private:
TransactionState transactionStateTranslate(pjsip_tsx_state_e state)
{
@@ -200,6 +206,7 @@ public:
SipSessionStateItemPtr mSessionState;
SipSessionPtr mSession;
bool mNeedsReplication;
+ bool mNeedsRemoval;
};
static pj_status_t sessionLoad(pjsip_endpoint *endpt)
@@ -765,26 +772,52 @@ PJSipSessionModule::PJSipSessionModule() : mName("Session Module")
void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo,
PJSipTransactionModInfo *tsxInfo, PJSipSessionModInfo *sessionInfo)
{
- SipStateItemSeq items;
- if (dlgInfo && dlgInfo->mNeedsReplication == true)
+ SipStateItemSeq setItems;
+ SipStateItemSeq removeItems;
+ if (dlgInfo)
+ {
+ if (dlgInfo->mNeedsReplication == true)
+ {
+ setItems.push_back(dlgInfo->mDialogState);
+ dlgInfo->mNeedsReplication = false;
+ }
+ else if (dlgInfo->mNeedsRemoval == true)
+ {
+ removeItems.push_back(dlgInfo->mDialogState);
+ }
+ }
+ if (tsxInfo)
{
- items.push_back(dlgInfo->mDialogState);
- dlgInfo->mNeedsReplication = false;
+ if (tsxInfo->mNeedsReplication == true)
+ {
+ setItems.push_back(tsxInfo->mTransactionState);
+ tsxInfo->mNeedsReplication = false;
+ }
+ else if (tsxInfo->mNeedsRemoval == true)
+ {
+ removeItems.push_back(tsxInfo->mTransactionState);
+ }
}
- if (tsxInfo && tsxInfo->mNeedsReplication == true)
+ if (sessionInfo)
{
- items.push_back(tsxInfo->mTransactionState);
- tsxInfo->mNeedsReplication = false;
+ if (sessionInfo->mNeedsReplication == true)
+ {
+ setItems.push_back(sessionInfo->mSessionState);
+ sessionInfo->mNeedsReplication = false;
+ }
+ else if (sessionInfo->mNeedsRemoval == true)
+ {
+ removeItems.push_back(sessionInfo->mSessionState);
+ }
}
- if (sessionInfo && sessionInfo->mNeedsReplication == true)
+ SipStateReplicatorPrx replicator = SipChannelServiceDataModel::getInstance().getStateReplicator();
+ if (setItems.size() != 0)
{
- items.push_back(sessionInfo->mSessionState);
- sessionInfo->mNeedsReplication = false;
+ replicator->setState(setItems);
}
- if (items.size() != 0)
+ if (removeItems.size() != 0)
{
- SipStateReplicatorPrx replicator = SipChannelServiceDataModel::getInstance().getStateReplicator();
- replicator->setState(items);
+ replicator->removeState(removeItems);
}
}
commit 639c3b7e0f8318875545b63d30f8db3012828388
Author: Mark Michelson <mmichelson at digium.com>
Date: Wed Sep 15 14:04:34 2010 -0500
Change mNeedsUpdate to mNeedsReplication to be more clear.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 1fc3cb7..5a13047 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -49,7 +49,7 @@ const int URI_SIZE = 64;
class PJSipDialogModInfo
{
public:
- PJSipDialogModInfo(pjsip_dialog *dialog) : mDialogState(new SipDialogStateItem) , mNeedsUpdate(true)
+ PJSipDialogModInfo(pjsip_dialog *dialog) : mDialogState(new SipDialogStateItem) , mNeedsReplication(true)
{
//XXX Is there a way to tell ICE to make the default
//constructor for SipStateItem set mId?
@@ -103,7 +103,7 @@ public:
//I'll just hardcode this as UDP until we start wanting to actually implement
//other transports.
mDialogState->mTransport = "UDP";
- mNeedsUpdate = true;
+ mNeedsReplication = true;
}
/**
* The associated dialog information. Used for state replication
@@ -114,13 +114,13 @@ public:
* This is in place so we don't send needless updates to the state replicator
* if nothing has actually changed for the dialog.
*/
- bool mNeedsUpdate;
+ bool mNeedsReplication;
};
class PJSipTransactionModInfo
{
public:
- PJSipTransactionModInfo(pjsip_transaction *transaction) : mTransactionState(new SipTransactionStateItem), mNeedsUpdate(true)
+ PJSipTransactionModInfo(pjsip_transaction *transaction) : mTransactionState(new SipTransactionStateItem), mNeedsReplication(true)
{
mTransactionState->mId = IceUtil::generateUUID();
updateTransactionState(transaction);
@@ -130,10 +130,10 @@ public:
mTransactionState->mBranch = std::string(pj_strbuf(&transaction->branch), pj_strlen(&transaction->branch));
mTransactionState->mIsClient = (transaction->role == PJSIP_ROLE_UAC || transaction->role == PJSIP_UAC_ROLE) ? true : false;
mTransactionState->mCurrentState = transactionStateTranslate(transaction->state);
- mNeedsUpdate = true;
+ mNeedsReplication = true;
}
SipTransactionStateItemPtr mTransactionState;
- bool mNeedsUpdate;
+ bool mNeedsReplication;
private:
TransactionState transactionStateTranslate(pjsip_tsx_state_e state)
{
@@ -176,7 +176,7 @@ private:
class PJSipSessionModInfo
{
public:
- PJSipSessionModInfo(pjsip_inv_session *inv_session) : mSessionState(new SipSessionStateItem), mNeedsUpdate(true)
+ PJSipSessionModInfo(pjsip_inv_session *inv_session) : mSessionState(new SipSessionStateItem), mNeedsReplication(true)
{
mSessionState->mId = IceUtil::generateUUID();
}
@@ -199,7 +199,7 @@ public:
}
SipSessionStateItemPtr mSessionState;
SipSessionPtr mSession;
- bool mNeedsUpdate;
+ bool mNeedsReplication;
};
static pj_status_t sessionLoad(pjsip_endpoint *endpt)
@@ -766,20 +766,20 @@ void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo,
PJSipTransactionModInfo *tsxInfo, PJSipSessionModInfo *sessionInfo)
{
SipStateItemSeq items;
- if (dlgInfo && dlgInfo->mNeedsUpdate == true)
+ if (dlgInfo && dlgInfo->mNeedsReplication == true)
{
items.push_back(dlgInfo->mDialogState);
- dlgInfo->mNeedsUpdate = false;
+ dlgInfo->mNeedsReplication = false;
}
- if (tsxInfo && tsxInfo->mNeedsUpdate == true)
+ if (tsxInfo && tsxInfo->mNeedsReplication == true)
{
items.push_back(tsxInfo->mTransactionState);
- tsxInfo->mNeedsUpdate = false;
+ tsxInfo->mNeedsReplication = false;
}
- if (sessionInfo && sessionInfo->mNeedsUpdate == true)
+ if (sessionInfo && sessionInfo->mNeedsReplication == true)
{
items.push_back(sessionInfo->mSessionState);
- sessionInfo->mNeedsUpdate = false;
+ sessionInfo->mNeedsReplication = false;
}
if (items.size() != 0)
{
commit d04fefb409fd0ab0c8ff6abd8c31521c8b2626ff
Author: Mark Michelson <mmichelson at digium.com>
Date: Wed Sep 15 14:03:34 2010 -0500
Allow for NULL input to replicateState().
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index d1d632a..1fc3cb7 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -766,17 +766,17 @@ void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo,
PJSipTransactionModInfo *tsxInfo, PJSipSessionModInfo *sessionInfo)
{
SipStateItemSeq items;
- if (dlgInfo->mNeedsUpdate == true)
+ if (dlgInfo && dlgInfo->mNeedsUpdate == true)
{
items.push_back(dlgInfo->mDialogState);
dlgInfo->mNeedsUpdate = false;
}
- if (tsxInfo->mNeedsUpdate == true)
+ if (tsxInfo && tsxInfo->mNeedsUpdate == true)
{
items.push_back(tsxInfo->mTransactionState);
tsxInfo->mNeedsUpdate = false;
}
- if (sessionInfo->mNeedsUpdate == true)
+ if (sessionInfo && sessionInfo->mNeedsUpdate == true)
{
items.push_back(sessionInfo->mSessionState);
sessionInfo->mNeedsUpdate = false;
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list