[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 Sep 20 16:47:54 CDT 2010


branch "master" has been updated
       via  d257d40461e57f1c4c759e370e84db34d3ca9448 (commit)
       via  c0b4d3b3ae4e4e4c65834afd175093e17da5ae97 (commit)
       via  73aac1d17a5a0c7a712b06d28c2f7132d24f7cc6 (commit)
      from  ee225ed798f3bf72962d6b62bd03ea128eebd285 (commit)

Summary of changes:
 local-slice/SipStateReplicationIf.ice |    1 +
 src/SipStateReplicator.cpp            |   60 +++++++++++++++++++++++++++++++-
 2 files changed, 59 insertions(+), 2 deletions(-)


- Log -----------------------------------------------------------------
commit d257d40461e57f1c4c759e370e84db34d3ca9448
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 20 18:53:36 2010 -0300

    Take into account differing state items.

diff --git a/src/SipStateReplicator.cpp b/src/SipStateReplicator.cpp
index c4c3eb8..e63caab 100644
--- a/src/SipStateReplicator.cpp
+++ b/src/SipStateReplicator.cpp
@@ -141,23 +141,44 @@ public:
    {
       for (SipStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
       {
-	 std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> >::iterator i = mStateItems.find((*item)->mId);
+	 std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> >::iterator i = mStateItems.find((*item)->mSessionId);
+	 SipSessionStateItemPtr session;
+	 SipDialogStateItemPtr dialog;
+	 SipTransactionStateItemPtr transaction;
 	 boost::shared_ptr<SipStateReplicatorItem> localitem;
 
-	 // Is this an update to an existing state item?
-	 if (i == mStateItems.end())
+	 // Depending on the type of state item we apply it differently
+	 if ((session = SipSessionStateItemPtr::dynamicCast((*item))))
 	 {
-	    // Uh... no! We need to create a new one.
-	    boost::shared_ptr<SipStateReplicatorItem> newitem(new SipStateReplicatorItem());
-	    mStateItems.insert(std::make_pair<std::string, boost::shared_ptr<SipStateReplicatorItem> >((*item)->mId, newitem));
-	    localitem = newitem;
+	    if (i == mStateItems.end())
+	    {
+	       // Unlike other state items sessions are special in that they create the local class that binds everything together
+	       boost::shared_ptr<SipStateReplicatorItem> newitem(new SipStateReplicatorItem());
+	       mStateItems.insert(std::make_pair<std::string, boost::shared_ptr<SipStateReplicatorItem> >((*item)->mSessionId, newitem));
+	       localitem = newitem;
+	    }
+	    else
+	    {
+	       localitem = i->second;
+	    }
 	 }
-	 else
+	 else if ((dialog = SipDialogStateItemPtr::dynamicCast((*item))))
 	 {
+	    if (i == mStateItems.end())
+	    {
+	       continue;
+	    }
+	    localitem = i->second;
+	 }
+	 else if ((transaction = SipTransactionStateItemPtr::dynamicCast((*item))))
+	 {
+	    // This check also needs to look for the dialog
+	    if (i == mStateItems.end())
+	    {
+	       continue;
+	    }
 	    localitem = i->second;
 	 }
-
-	 // Now we need to move on to checking what stuff changed
       }
    }
    std::string mId;

commit c0b4d3b3ae4e4e4c65834afd175093e17da5ae97
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 20 18:40:22 2010 -0300

    Add an mSessionId to all state items so we can bind them together in the darkness.

diff --git a/local-slice/SipStateReplicationIf.ice b/local-slice/SipStateReplicationIf.ice
index 4483bc7..ff35e0c 100644
--- a/local-slice/SipStateReplicationIf.ice
+++ b/local-slice/SipStateReplicationIf.ice
@@ -14,6 +14,7 @@ module V1
    class SipStateItem
    {
       string mId;
+      string mSessionId;
    };
 
    sequence<SipStateItem> SipStateItemSeq;

commit 73aac1d17a5a0c7a712b06d28c2f7132d24f7cc6
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Sep 20 18:34:43 2010 -0300

    Add the basis of a listener implementation. It's woefully incomplete and needs to change based on discussions I've had with Mark.

diff --git a/src/SipStateReplicator.cpp b/src/SipStateReplicator.cpp
index 73d8f4d..c4c3eb8 100644
--- a/src/SipStateReplicator.cpp
+++ b/src/SipStateReplicator.cpp
@@ -8,6 +8,9 @@
 
 #include <IceUtil/UUID.h>
 
+#include <boost/thread.hpp>
+#include <boost/shared_ptr.hpp>
+
 #include "SipStateReplicator.h"
 
 namespace AsteriskSCF
@@ -114,19 +117,51 @@ SipStateItemSeq SipStateReplicatorI::getAllStates(Ice::Current &)
    return mImpl->getAllStatesImpl();
 }
 
+class SipStateReplicatorItem
+{
+public:
+	SipStateReplicatorItem() { }
+	~SipStateReplicatorItem() { }
+private:
+};
+
 struct SipStateReplicatorListenerImpl
 {
 public:
    SipStateReplicatorListenerImpl() : mId(IceUtil::generateUUID()) {}
    void removeStateNoticeImpl(Ice::StringSeq itemKeys)
    {
-      //stub
+      for (Ice::StringSeq::const_iterator key = itemKeys.begin(); key != itemKeys.end(); ++key)
+      {
+	 // Just erasing this from the map will cause the destructor to actually shut things down
+	 mStateItems.erase((*key));
+      }
    }
    void setStateNoticeImpl(SipStateItemSeq items)
    {
-      //stub
+      for (SipStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
+      {
+	 std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> >::iterator i = mStateItems.find((*item)->mId);
+	 boost::shared_ptr<SipStateReplicatorItem> localitem;
+
+	 // Is this an update to an existing state item?
+	 if (i == mStateItems.end())
+	 {
+	    // Uh... no! We need to create a new one.
+	    boost::shared_ptr<SipStateReplicatorItem> newitem(new SipStateReplicatorItem());
+	    mStateItems.insert(std::make_pair<std::string, boost::shared_ptr<SipStateReplicatorItem> >((*item)->mId, newitem));
+	    localitem = newitem;
+	 }
+	 else
+	 {
+	    localitem = i->second;
+	 }
+
+	 // Now we need to move on to checking what stuff changed
+      }
    }
    std::string mId;
+   std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> > mStateItems;
 };
 
 SipStateReplicatorListenerI::SipStateReplicatorListenerI() : mImpl(new SipStateReplicatorListenerImpl) {}

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list