[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 17:21:59 CDT 2011


branch "registrar" has been updated
       via  66b54622b2edd8c6f41fb76950e81121813804e2 (commit)
       via  66c548481a50dbbaaa4f886d41af64cc39a5bfa3 (commit)
       via  b694e978ae5146b198914f8e114fff6333a75662 (commit)
       via  1f56ea5e07117170b407e17cc298ea9a79b60860 (commit)
      from  706a6986e046909d0035038412d759ba1e6c199c (commit)

Summary of changes:
 local-slice/SipStateReplicationIf.ice    |   17 +++++
 src/PJSipManager.cpp                     |    9 ++-
 src/PJSipManager.h                       |    9 +++-
 src/PJSipRegistrarModule.cpp             |   69 ++++++++++++++++++---
 src/PJSipRegistrarModule.h               |   20 ++++++-
 src/PJSipRegistrarModuleConstruction.cpp |    7 ++-
 src/SipSessionManagerApp.cpp             |    2 +-
 src/SipStateReplicator.h                 |    1 +
 src/SipStateReplicatorListener.cpp       |   98 ++++++++++++++++++++++++++++++
 9 files changed, 214 insertions(+), 18 deletions(-)


- Log -----------------------------------------------------------------
commit 66b54622b2edd8c6f41fb76950e81121813804e2
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Jun 16 17:22:28 2011 -0500

    Progress towards setting registration state.

diff --git a/local-slice/SipStateReplicationIf.ice b/local-slice/SipStateReplicationIf.ice
index 0ea861d..9a0b52b 100644
--- a/local-slice/SipStateReplicationIf.ice
+++ b/local-slice/SipStateReplicationIf.ice
@@ -159,7 +159,16 @@ module V1
 
    class SipRegistrarStateItem extends SipStateItem
    {
+      /**
+       * The bindings whose states are being set/removed
+       */
       AsteriskSCF::SIP::Registration::V1::BindingDict bindings;
+      /**
+       * In the case of setting state, this distinguishes if
+       * the bindings are new. If not, then the bindings are
+       * all ones the replicator listener already has record of.
+       */
+      bool newBindings;
    };
 
 }; //module V1
diff --git a/src/PJSipRegistrarModule.cpp b/src/PJSipRegistrarModule.cpp
index f4c99ff..e002155 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/PJSipRegistrarModule.cpp
@@ -207,7 +207,7 @@ void PJSipRegistrarModule::replicateState(
     if (!newBindings.empty())
     {
         BindingDict newDict = mRegistrar->createBindingDict(aor, newBindings);
-        SipRegistrarStateItemPtr newItem(new SipRegistrarStateItem(aor, aor, newDict));
+        SipRegistrarStateItemPtr newItem(new SipRegistrarStateItem(aor, aor, newDict, true));
         SipStateItemSeq items;
         items.push_back(newItem);
         mStateReplicator->setState(items);
@@ -216,7 +216,7 @@ void PJSipRegistrarModule::replicateState(
     if (!existingBindings.empty())
     {
         BindingDict existingDict = mRegistrar->createBindingDict(aor, existingBindings);
-        SipRegistrarStateItemPtr existingItem(new SipRegistrarStateItem(aor, aor, existingDict));
+        SipRegistrarStateItemPtr existingItem(new SipRegistrarStateItem(aor, aor, existingDict, false));
         SipStateItemSeq items;
         items.push_back(existingItem);
         mStateReplicator->setState(items);
@@ -225,7 +225,7 @@ void PJSipRegistrarModule::replicateState(
     if (!removedBindings.empty())
     {
         BindingDict removedDict = mRegistrar->createBindingDict(aor, removedBindings);
-        SipRegistrarStateItemPtr removedItem(new SipRegistrarStateItem(aor, aor, removedDict));
+        SipRegistrarStateItemPtr removedItem(new SipRegistrarStateItem(aor, aor, removedDict, false));
         SipStateItemSeq items;
         items.push_back(removedItem);
         mStateReplicator->removeStateForItems(items);
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 580368d..15aa91b 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -121,19 +121,34 @@ public:
         }
     }
 
+    void setNewRegistrationState(const PJSipRegistrarModulePtr& regModule, const SipRegistrarStateItemPtr& regItem)
+    {
+        //For new registrations, we need to create a sequence of BindingHolders and call the registrar's
+        //updateBindings() function.
+        for (BindingDict::iterator dictIter = regItem->bindings.begin();
+                dictIter != regItem->bindings.end(); ++dictIter)
+        {
+        }
+    }
+    void setExistingRegistrationState(const PJSipRegistrarModulePtr& regModule, const SipRegistrarStateItemPtr& regItem)
+    {
+    }
+
     void setRegistrationState(const PJSipRegistrarModulePtr& regModule, const SipRegistrarStateItemPtr& regItem)
     {
         // When setting registration state, we will always either get information on
         // strictly new bindings (though not necessarily for new AoRs), or we will get
         // information strictly for existing bindings (to update the CSeq and expiration).
         // What we need to do is determine which this is and act appropriately.
-
-        //For the case where the bindings are new, we can use the registrar's updateBindings()
-        //function to set things up. For the case where the bindings exist, we can use the
-        //binding holder's updateBinding() to get the expiration rescheduled properly.
         
-        (void) regModule;
-        (void) regItem;
+        if (regItem->newItems)
+        {
+            setNewRegistrationState(regModule, regItem);
+        }
+        else
+        {
+            setExistingRegistrationState(regModule, regItem);
+        }
     }
 
     void setStateNoticeImpl(const SipStateItemSeq& items)

commit 66c548481a50dbbaaa4f886d41af64cc39a5bfa3
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Jun 16 16:44:14 2011 -0500

    Iniital state replication listener support.
    
    This gets the case of removal of bindings.

diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 15a7a66..df04edc 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -110,6 +110,11 @@ PJSipLoggingModulePtr PJSipManager::getLoggingModule()
     return mLoggingModule;
 }
 
+PJSipRegistrarModulePtr PJSipManager::getRegistrarModule()
+{
+    return mRegistrarModule;
+}
+
 bool PJSipManager::setTransports(pjsip_endpoint *endpoint, const Ice::PropertiesPtr& props)
 {
     //XXX We'll also want to allow for TCP and TLS-specific
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index 46a56ce..fdae905 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -67,6 +67,11 @@ public:
     PJSipLoggingModulePtr getLoggingModule();
 
     /**
+     * Get a reference to the PJSIP registrar module
+     */
+    PJSipRegistrarModulePtr getRegistrarModule();
+
+    /**
      * Register the PJSipSessionModule, responsible
      * for basic call handling
      */
diff --git a/src/PJSipRegistrarModule.cpp b/src/PJSipRegistrarModule.cpp
index 8136d19..f4c99ff 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/PJSipRegistrarModule.cpp
@@ -546,5 +546,10 @@ void PJSipRegistrarModule::on_tsx_state(pjsip_transaction *, pjsip_event *)
     // change.
 }
 
+RegistrarIPtr PJSipRegistrarModule::getRegistrar()
+{
+    return mRegistrar;
+}
+
 };
 };
diff --git a/src/PJSipRegistrarModule.h b/src/PJSipRegistrarModule.h
index d7d9c95..7637c69 100644
--- a/src/PJSipRegistrarModule.h
+++ b/src/PJSipRegistrarModule.h
@@ -109,6 +109,7 @@ public:
     pj_status_t on_tx_request(pjsip_tx_data *tdata);
     pj_status_t on_tx_response(pjsip_tx_data *tdata);
     void on_tsx_state(pjsip_transaction *tsx, pjsip_event *event);
+    RegistrarIPtr getRegistrar();
 private:
     std::string getAOR(pjsip_rx_data *rdata);
     std::vector<pjsip_contact_hdr *> extractRegisterContacts(pjsip_rx_data *rdata);
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index f77a1bf..580368d 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -13,6 +13,7 @@
  * the GNU General Public License Version 2. See the LICENSE.txt file
  * at the top of the source tree.
  */
+#include <AsteriskSCF/SIP/SIPRegistrarIf.h>
 
 #include "SipStateReplicator.h"
 #include "SipEndpoint.h"
@@ -31,6 +32,7 @@ namespace SipSessionManager
 {
 
 using namespace AsteriskSCF::SIP::V1;
+using namespace AsteriskSCF::SIP::Registration::V1;
 
 class SipStateReplicatorItem
 {
@@ -69,6 +71,71 @@ public:
             mStateItems.erase((*key));
         }
     }
+
+    void removeRegistrationState(
+            const PJSipRegistrarModulePtr& regModule,
+            const SipRegistrarStateItemPtr& regItem)
+    {
+        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, emptySeq, holderSeq);
+        }
+    }
+
+    void removeStateForItemsNoticeImpl(const SipStateItemSeq& items)
+    {
+        for (SipStateItemSeq::const_iterator iter = items.begin(); iter != items.end(); ++iter)
+        {
+            SipRegistrarStateItemPtr regItem;
+            if ((regItem = SipRegistrarStateItemPtr::dynamicCast((*iter))))
+            {
+                PJSipRegistrarModulePtr regModule;
+
+                regModule = mManager->getRegistrarModule();
+                if (regModule == 0)
+                {
+                    //No registrar module registered, so nothing to do
+                    continue;
+                }
+                removeRegistrationState(regModule, regItem);
+            }
+        }
+    }
+
+    void setRegistrationState(const PJSipRegistrarModulePtr& regModule, const SipRegistrarStateItemPtr& regItem)
+    {
+        // When setting registration state, we will always either get information on
+        // strictly new bindings (though not necessarily for new AoRs), or we will get
+        // information strictly for existing bindings (to update the CSeq and expiration).
+        // What we need to do is determine which this is and act appropriately.
+
+        //For the case where the bindings are new, we can use the registrar's updateBindings()
+        //function to set things up. For the case where the bindings exist, we can use the
+        //binding holder's updateBinding() to get the expiration rescheduled properly.
+        
+        (void) regModule;
+        (void) regItem;
+    }
+
     void setStateNoticeImpl(const SipStateItemSeq& items)
     {
         for (SipStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
@@ -79,6 +146,7 @@ public:
             SipDialogStateItemPtr dialog;
             SipInviteSessionStateItemPtr invitesession;
             SipTransactionStateItemPtr transaction;
+            SipRegistrarStateItemPtr regItem;
             boost::shared_ptr<SipStateReplicatorItem> localitem;
 
             // Depending on the type of state item we apply it differently
@@ -258,6 +326,17 @@ public:
                     continue;
                 }
             }
+            else if ((regItem = SipRegistrarStateItemPtr::dynamicCast((*item))))
+            {
+                PJSipRegistrarModulePtr regModule;
+                regModule = mManager->getRegistrarModule();
+                if (regModule == 0)
+                {
+                    //No registrar module registered, so nothing to do
+                    continue;
+                }
+                setRegistrationState(regModule, regItem);
+            }
         }
     }
     std::string mId;
@@ -272,9 +351,9 @@ SipStateReplicatorListenerI::SipStateReplicatorListenerI(const boost::shared_ptr
 {
 }
 
-void SipStateReplicatorListenerI::stateRemovedForItems(const SipStateItemSeq&, const Ice::Current&)
+void SipStateReplicatorListenerI::stateRemovedForItems(const SipStateItemSeq& items, const Ice::Current&)
 {
-    //stub
+    mImpl->removeStateForItemsNoticeImpl(items);
 }
 
 void SipStateReplicatorListenerI::stateRemoved(const Ice::StringSeq& itemKeys, const Ice::Current&)

commit b694e978ae5146b198914f8e114fff6333a75662
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Jun 16 14:34:14 2011 -0500

    Add initial state replication support.
    
    Next is to work on the listener.

diff --git a/local-slice/SipStateReplicationIf.ice b/local-slice/SipStateReplicationIf.ice
index aae6991..0ea861d 100644
--- a/local-slice/SipStateReplicationIf.ice
+++ b/local-slice/SipStateReplicationIf.ice
@@ -21,6 +21,7 @@
 #include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.ice>
 #include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice>
 #include <AsteriskSCF/System/Component/ConfigurationIf.ice>
+#include <AsteriskSCF/SIP/SIPRegistrarIf.ice>
 
 module AsteriskSCF
 {
@@ -48,6 +49,7 @@ module V1
    interface SipStateReplicatorListener
    {
       void stateRemoved(Ice::StringSeq itemKeys);
+      void stateRemovedForItems(SipStateItemSeq items);
 	  void stateSet(SipStateItemSeq items);
    };
 
@@ -57,6 +59,7 @@ module V1
       void removeListener(SipStateReplicatorListener *listener);
       void setState (SipStateItemSeq items);
       void removeState(Ice::StringSeq items);
+      void removeStateForItems(SipStateItemSeq items);
       idempotent SipStateItemSeq getState(Ice::StringSeq itemKeys);
       idempotent SipStateItemSeq getAllState();
    };
@@ -154,6 +157,11 @@ module V1
       AsteriskSCF::SessionCommunications::V1::Bridge *mBridge;
    };
 
+   class SipRegistrarStateItem extends SipStateItem
+   {
+      AsteriskSCF::SIP::Registration::V1::BindingDict bindings;
+   };
+
 }; //module V1
 }; //module SIP
 }; //module Asterisk SCF
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index bbcad80..15a7a66 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -95,9 +95,9 @@ void PJSipManager::registerLoggingModule()
     mLoggingModule = new PJSipLoggingModule(mEndpoint);
 }
 
-void PJSipManager::registerRegistrarModule(const RegistrarListenerPrx& defaultListener)
+void PJSipManager::registerRegistrarModule(const RegistrarListenerPrx& defaultListener, const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator)
 {
-    mRegistrarModule = new PJSipRegistrarModule(mEndpoint, defaultListener);
+    mRegistrarModule = new PJSipRegistrarModule(mEndpoint, defaultListener, stateReplicator);
 }
 
 PJSipSessionModulePtr PJSipManager::getSessionModule()
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index f90e46b..46a56ce 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -89,7 +89,9 @@ public:
      * for keeping track of bindings of contact URIs to
      * addresses of record.
      */
-    void registerRegistrarModule(const AsteriskSCF::SIP::Registration::V1::RegistrarListenerPrx& defaultListener);
+    void registerRegistrarModule(
+            const AsteriskSCF::SIP::Registration::V1::RegistrarListenerPrx& defaultListener,
+            const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator);
 
     /**
      * Create a UDP transport.
diff --git a/src/PJSipRegistrarModule.cpp b/src/PJSipRegistrarModule.cpp
index 5c69a71..8136d19 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/PJSipRegistrarModule.cpp
@@ -185,7 +185,54 @@ void RegistrarI::removeAOR(const std::string& aor)
     mBindings.erase(aor);
 }
 
-void RegistrarI::updateBindings(const std::string &aor, BindingHolderSeq&, BindingHolderSeq& newBindings, BindingHolderSeq& removedBindings)
+BindingDict RegistrarI::createBindingDict(const std::string& aor, const BindingHolderSeq& bindings)
+{
+    BindingSeq returnedBindings;
+    for (BindingHolderSeq::const_iterator seqIter = bindings.begin();
+            seqIter != bindings.end(); ++seqIter)
+    {
+        returnedBindings.push_back((*seqIter)->mBinding);
+    }
+    BindingDict dict;
+    dict.insert(make_pair(aor, returnedBindings));
+    return dict;
+}
+
+void PJSipRegistrarModule::replicateState(
+        const std::string &aor,
+        BindingHolderSeq& existingBindings,
+        BindingHolderSeq& newBindings,
+        BindingHolderSeq& removedBindings)
+{
+    if (!newBindings.empty())
+    {
+        BindingDict newDict = mRegistrar->createBindingDict(aor, newBindings);
+        SipRegistrarStateItemPtr newItem(new SipRegistrarStateItem(aor, aor, newDict));
+        SipStateItemSeq items;
+        items.push_back(newItem);
+        mStateReplicator->setState(items);
+    }
+    
+    if (!existingBindings.empty())
+    {
+        BindingDict existingDict = mRegistrar->createBindingDict(aor, existingBindings);
+        SipRegistrarStateItemPtr existingItem(new SipRegistrarStateItem(aor, aor, existingDict));
+        SipStateItemSeq items;
+        items.push_back(existingItem);
+        mStateReplicator->setState(items);
+    }
+
+    if (!removedBindings.empty())
+    {
+        BindingDict removedDict = mRegistrar->createBindingDict(aor, removedBindings);
+        SipRegistrarStateItemPtr removedItem(new SipRegistrarStateItem(aor, aor, removedDict));
+        SipStateItemSeq items;
+        items.push_back(removedItem);
+        mStateReplicator->removeStateForItems(items);
+    }
+}
+
+void RegistrarI::updateBindings(const std::string &aor, BindingHolderSeq& newBindings, BindingHolderSeq& removedBindings)
 {
 
     BindingHolderDict::iterator aorBindings = mBindings.find(aor);
@@ -228,7 +275,6 @@ void RegistrarI::updateBindings(const std::string &aor, BindingHolderSeq&, Bindi
         (*iter)->contactsAdded(newBindingUpdateSeq);
         (*iter)->contactsRemoved(removedBindingUpdateSeq);
     }
-    //XXX This would be where we replicate state. BACKBURNER!
 }
 
 BindingUpdateSeq RegistrarI::createBindingUpdateSeq(const std::string& aor, BindingHolderSeq& bindings)
@@ -464,12 +510,14 @@ pj_bool_t PJSipRegistrarModule::on_rx_request(pjsip_rx_data *rdata)
         }
     }
 
-    mRegistrar->updateBindings(aor, existingBindings, newBindings, removedBindings);
+    mRegistrar->updateBindings(aor, newBindings, removedBindings);
 
     pjsip_tx_data *tdata;
     pjsip_endpt_create_response(tsx->endpt, rdata, 200, NULL, &tdata);
     pjsip_tsx_send_msg(tsx, tdata);
 
+    replicateState(aor, newBindings, existingBindings, removedBindings);
+
     return PJ_TRUE;
 }
 
diff --git a/src/PJSipRegistrarModule.h b/src/PJSipRegistrarModule.h
index ff568b2..d7d9c95 100644
--- a/src/PJSipRegistrarModule.h
+++ b/src/PJSipRegistrarModule.h
@@ -16,8 +16,10 @@
 
 #pragma once
 
+#include <AsteriskSCF/Discovery/SmartProxy.h>
 #include <AsteriskSCF/SIP/SIPRegistrarIf.h>
 
+#include "SipStateReplicator.h"
 #include "PJSipModule.h"
 
 namespace AsteriskSCF
@@ -75,13 +77,16 @@ public:
 
     void updateBindings(
             const std::string &aor,
-            BindingHolderSeq& existingBindings,
             BindingHolderSeq& newBindings,
             BindingHolderSeq& removedBindings);
 
     AsteriskSCF::SIP::Registration::V1::BindingUpdateSeq createBindingUpdateSeq(
             const std::string& aor,
             BindingHolderSeq& bindings);
+
+    
+    AsteriskSCF::SIP::Registration::V1::BindingDict createBindingDict(const std::string& aor, const BindingHolderSeq& bindings);
+
 private:
     BindingHolderDict mBindings;
     AsteriskSCF::SIP::Registration::V1::ContactDict mContacts;
@@ -91,7 +96,10 @@ private:
 class PJSipRegistrarModule : public PJSipModule
 {
 public:
-    PJSipRegistrarModule(pjsip_endpoint *endpt, const AsteriskSCF::SIP::Registration::V1::RegistrarListenerPrx& defaultListener);
+    PJSipRegistrarModule(
+            pjsip_endpoint *endpt,
+            const AsteriskSCF::SIP::Registration::V1::RegistrarListenerPrx& defaultListener,
+            const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator);
     pj_status_t load(pjsip_endpoint *endpoint);
     pj_status_t start();
     pj_status_t stop();
@@ -110,8 +118,15 @@ private:
     BindingHolder *createNewBinding(pjsip_contact_hdr *contact,
             const std::string& callID, int cSeq, int expiration, const std::string& aor);
 
+    void replicateState(
+        const std::string &aor,
+        BindingHolderSeq& existingBindings,
+        BindingHolderSeq& newBindings,
+        BindingHolderSeq& removedBindings);
+
     pjsip_endpoint *mEndpoint;
     RegistrarIPtr mRegistrar;
+    AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> mStateReplicator;
 };
 
 typedef IceUtil::Handle<PJSipRegistrarModule> PJSipRegistrarModulePtr;
diff --git a/src/PJSipRegistrarModuleConstruction.cpp b/src/PJSipRegistrarModuleConstruction.cpp
index 9ec6148..2996cd8 100644
--- a/src/PJSipRegistrarModuleConstruction.cpp
+++ b/src/PJSipRegistrarModuleConstruction.cpp
@@ -73,8 +73,11 @@ static void registrarOnTsxState(pjsip_transaction *tsx, pjsip_event *event)
     return registrarModule->on_tsx_state(tsx, event);
 }
 
-PJSipRegistrarModule::PJSipRegistrarModule(pjsip_endpoint *endpt, const RegistrarListenerPrx& defaultListener)
-    : mEndpoint(endpt), mRegistrar(new RegistrarI(defaultListener))
+PJSipRegistrarModule::PJSipRegistrarModule(
+        pjsip_endpoint *endpt,
+        const RegistrarListenerPrx& defaultListener,
+        const AsteriskSCF::Discovery::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator)
+    : mEndpoint(endpt), mRegistrar(new RegistrarI(defaultListener)), mStateReplicator(stateReplicator)
 {
     registrarModule = this;
     mModule.name = pj_str(registrarModuleName);
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
index 4c7de36..10aef0a 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);
+            mPJSipManager->registerRegistrarModule(defaultListener, mStateReplicator);
         }
     }
     lg(Debug) << "Registered PJSIP modules";
diff --git a/src/SipStateReplicator.h b/src/SipStateReplicator.h
index 02fde05..47ef37c 100644
--- a/src/SipStateReplicator.h
+++ b/src/SipStateReplicator.h
@@ -44,6 +44,7 @@ class SipStateReplicatorListenerI : public AsteriskSCF::SIP::V1::SipStateReplica
 public:
     SipStateReplicatorListenerI(const boost::shared_ptr<SipEndpointFactory>& factory, PJSipManager *manager);
     void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
+    void stateRemovedForItems(const AsteriskSCF::SIP::V1::SipStateItemSeq&, const Ice::Current&);
     void stateSet(const AsteriskSCF::SIP::V1::SipStateItemSeq&, const Ice::Current&);
     bool operator==(const SipStateReplicatorListenerI &rhs);
 private:
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 7774efe..f77a1bf 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -272,6 +272,10 @@ SipStateReplicatorListenerI::SipStateReplicatorListenerI(const boost::shared_ptr
 {
 }
 
+void SipStateReplicatorListenerI::stateRemovedForItems(const SipStateItemSeq&, const Ice::Current&)
+{
+    //stub
+}
 
 void SipStateReplicatorListenerI::stateRemoved(const Ice::StringSeq& itemKeys, const Ice::Current&)
 {

commit 1f56ea5e07117170b407e17cc298ea9a79b60860
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Jun 16 10:49:03 2011 -0500

    Remove some comments and change a terrible variable name.

diff --git a/src/PJSipRegistrarModule.cpp b/src/PJSipRegistrarModule.cpp
index ec92bb9..5c69a71 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/PJSipRegistrarModule.cpp
@@ -187,14 +187,10 @@ void RegistrarI::removeAOR(const std::string& aor)
 
 void RegistrarI::updateBindings(const std::string &aor, BindingHolderSeq&, BindingHolderSeq& newBindings, BindingHolderSeq& removedBindings)
 {
-    //Best way to do this...
-    //First, find the sequence of bindings for this particular AoR that we are going to be
-    //updating.
 
-    BindingHolderDict::iterator thingy = mBindings.find(aor);
+    BindingHolderDict::iterator aorBindings = mBindings.find(aor);
 
-    //Let's add in the new bindings, shall we?
-    if (thingy == mBindings.end())
+    if (aorBindings == mBindings.end())
     {
         if (!newBindings.empty())
         {
@@ -204,7 +200,7 @@ void RegistrarI::updateBindings(const std::string &aor, BindingHolderSeq&, Bindi
     }
     else
     {
-        BindingHolderSeq& currentBindings = thingy->second;
+        BindingHolderSeq& currentBindings = aorBindings->second;
         if (!newBindings.empty())
         {
             lg(Debug) << "Adding new bindings for aor " << aor;

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list