[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:01:04 CDT 2010


branch "master" has been updated
       via  0c484b67b48ba5812459eb9c15cc7d4a8a8416e4 (commit)
       via  41e40f626021f1b7f8b00557dc21af2d2b15b495 (commit)
      from  85e7377b38c2b6ea08fc3d47d6b13bd53f15ef36 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp       |   33 ++++++++++++++++++++++++++++++---
 src/PJSipSessionModule.h         |    7 +++++++
 src/SipChannelServiceDataModel.h |    2 ++
 src/SipStateReplicator.h         |    2 ++
 4 files changed, 41 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 0c484b67b48ba5812459eb9c15cc7d4a8a8416e4
Merge: 41e40f6 85e7377
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Sep 15 14:02:06 2010 -0500

    Merge branch 'master' of git.asterisk.org:asterisk-scf/integration/sip


commit 41e40f626021f1b7f8b00557dc21af2d2b15b495
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Sep 15 14:01:37 2010 -0500

    Add a simple function to "commit" all pending state updates.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 85de8e9..13f9bc9 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -119,6 +119,7 @@ public:
 
 class PJSipTransactionModInfo
 {
+public:
    PJSipTransactionModInfo(pjsip_transaction *transaction) : mTransactionState(new SipTransactionStateItem), mNeedsUpdate(true)
    {
       mTransactionState->mId = IceUtil::generateUUID();
@@ -131,6 +132,8 @@ class PJSipTransactionModInfo
 	  mTransactionState->mCurrentState = transactionStateTranslate(transaction->state);
 	  mNeedsUpdate = true;
    }
+   SipTransactionStateItemPtr mTransactionState;
+   bool mNeedsUpdate;
 private:
    TransactionState transactionStateTranslate(pjsip_tsx_state_e state)
    {
@@ -168,12 +171,11 @@ private:
 	  }
 	  return retState;
    }
-   SipTransactionStateItemPtr mTransactionState;
-   bool mNeedsUpdate;
 };
 
 class PJSipSessionModInfo
 {
+public:
    PJSipSessionModInfo(pjsip_inv_session *inv_session) : mSessionState(new SipSessionStateItem), mNeedsUpdate(true)
    {
       mSessionState->mId = IceUtil::generateUUID();
@@ -195,7 +197,6 @@ class PJSipSessionModInfo
    {
       mSession = sessionPtr;
    }
-private:
    SipSessionStateItemPtr mSessionState;
    SipSessionPtr mSession;
    bool mNeedsUpdate;
@@ -751,6 +752,32 @@ PJSipSessionModule::PJSipSessionModule() : mName("Session Module")
 	pjsip_endpt_register_module(endpt, &mModule);
 }
 
+void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo,
+		PJSipTransactionModInfo *tsxInfo, PJSipSessionModInfo *sessionInfo)
+{
+	SipStateItemSeq items;
+	if (dlgInfo->mNeedsUpdate == true)
+	{
+		items.push_back(dlgInfo->mDialogState);
+		dlgInfo->mNeedsUpdate = false;
+	}
+	if (tsxInfo->mNeedsUpdate == true)
+	{
+		items.push_back(tsxInfo->mTransactionState);
+		tsxInfo->mNeedsUpdate = false;
+	}
+	if (sessionInfo->mNeedsUpdate == true)
+	{
+		items.push_back(sessionInfo->mSessionState);
+		sessionInfo->mNeedsUpdate = false;
+	}
+	if (items.size() != 0)
+	{
+		SipStateReplicatorPrx replicator = SipChannelServiceDataModel::getInstance().getStateReplicator();
+		replicator->setState(items);
+	}
+}
+
 pjsip_module *PJSipSessionModule::getModule()
 {
 	return &mModule;
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index 22f0b8c..14c9a3d 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -18,11 +18,18 @@ namespace AsteriskSCF
 namespace SipChannelService
 {
 
+class PJSipDialogModInfo;
+class PJSipTransactionModInfo;
+class PJSipSessionModInfo;
+
 class PJSipSessionModule
 {
 public:
 	PJSipSessionModule();
 	pjsip_module *getModule();
+	void replicateState(PJSipDialogModInfo *dlgInfo,
+			PJSipTransactionModInfo *tsxInfo,
+			PJSipSessionModInfo *sessionInfo);
 private:
 	pjsip_module mModule;
 	pjsip_inv_callback mInvCallback;
diff --git a/src/SipChannelServiceDataModel.h b/src/SipChannelServiceDataModel.h
index 4e8a6d0..87e0164 100644
--- a/src/SipChannelServiceDataModel.h
+++ b/src/SipChannelServiceDataModel.h
@@ -14,6 +14,7 @@
 #include "BridgingIf.h"
 #include "ServiceLocatorIf.h"
 #include "PJSipManager.h"
+#include "SipStateReplicator.h"
 
 namespace AsteriskSCF
 {
@@ -42,6 +43,7 @@ public:
    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;
 
 protected:
diff --git a/src/SipStateReplicator.h b/src/SipStateReplicator.h
index 8e1ec6a..8e1b696 100644
--- a/src/SipStateReplicator.h
+++ b/src/SipStateReplicator.h
@@ -6,6 +6,8 @@
  * All rights reserved.
  */
 
+#pragma once
+
 #include "SipStateReplicationIf.h"
 
 namespace AsteriskSCF

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list