[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
Thu Sep 30 10:26:16 CDT 2010
branch "master" has been updated
via 0d48515dabb96e2bfe40a29545f154186506686a (commit)
via 5818a89113831a40bfa5e1bd96e344ceb7578794 (commit)
via 37f701b5899eab43b9bf328a4ea4c20e721ac616 (commit)
via 6d566d79b43569fb0770dd2c19dd4943691928c4 (commit)
via 2fc696ad3dcd5289aebd4f14970d3c250665382d (commit)
via 0792de5e4dedcf1c50c262bb96cad06569534095 (commit)
from 9e99b6d939369a2d6a3a6c4699cd35b11a67abbb (commit)
Summary of changes:
config/test_sip.conf | 2 +-
slice | 2 +-
src/CMakeLists.txt | 1 +
src/PJSipSessionModule.cpp | 8 +---
src/SipChannelServiceApp.cpp | 77 +++++++++++++++++++++++++++++++++++-
src/SipChannelServiceDataModel.h | 1 +
src/SipSession.cpp | 18 +++++++-
src/SipSession.h | 2 +
src/SipStateReplicatorListener.cpp | 9 ++++-
9 files changed, 106 insertions(+), 14 deletions(-)
- Log -----------------------------------------------------------------
commit 0d48515dabb96e2bfe40a29545f154186506686a
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Sep 30 12:27:46 2010 -0300
Update slice to latest version to get the Replica interface.
diff --git a/slice b/slice
index df22de4..36a57a4 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit df22de4cdfa237ab7cbabbc8af895de73f554a9a
+Subproject commit 36a57a423c849ff5688d8c4f3569bf3639feed36
commit 5818a89113831a40bfa5e1bd96e344ceb7578794
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Sep 30 10:00:40 2010 -0300
pjsip wants a cause code, despite me not wanting it to send anything.
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index a162d8e..d665109 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -32,7 +32,7 @@ public:
~SipStateReplicatorItem()
{
// Since we are acting in a standby fashion outside influences will not have caused our pjsip structures to go away so we must do it ourselves
- pjsip_inv_terminate(mSession->getInviteSession(), 0, PJ_FALSE);
+ pjsip_inv_terminate(mSession->getInviteSession(), 500, PJ_FALSE);
// Now that pjsip is taken care of we can drop the session itself and consider life good
mSession->destroy();
commit 37f701b5899eab43b9bf328a4ea4c20e721ac616
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Sep 30 09:53:03 2010 -0300
Use the new method of knowing if we are active to do things proper.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 08607ea..726cb69 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -323,7 +323,7 @@ static void replicateState(PJSipDialogModInfo *dlgInfo, PJSipTransactionModInfo
}
}
std::cout << "========== End State Replication Dump ==========" << std::endl;
- if (SipChannelServiceDataModel::getInstance().getCommunicator()->getProperties()->getPropertyWithDefault("Sip.StateReplicatorListener", "no") == "no")
+ if (SipChannelServiceDataModel::getInstance().isActive() == true)
{
SipStateReplicatorPrx replicator = SipChannelServiceDataModel::getInstance().getStateReplicator();
if (setItems.size() != 0 && replicator)
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index c511693..9a6602a 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -420,10 +420,13 @@ void SipSession::destroy()
mImplPriv->mAdapter->remove(mImplPriv->mMediaSessionProxy->ice_getIdentity());
mImplPriv->mMediaSession = 0;
- // Release all the RTP sessions we are using
- for (std::vector<AsteriskSCF::Media::RTP::V1::RTPSessionPrx>::const_iterator i = mImplPriv->mRTPSessions.begin(); i != mImplPriv->mRTPSessions.end(); ++i)
+ if (SipChannelServiceDataModel::getInstance().isActive() == true)
{
- (*i)->release();
+ // Release all the RTP sessions we are using
+ for (std::vector<AsteriskSCF::Media::RTP::V1::RTPSessionPrx>::const_iterator i = mImplPriv->mRTPSessions.begin(); i != mImplPriv->mRTPSessions.end(); ++i)
+ {
+ (*i)->release();
+ }
}
mImplPriv->mEndpoint->removeSession(this);
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 71a2be1..a162d8e 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -29,7 +29,14 @@ class SipStateReplicatorItem
{
public:
SipStateReplicatorItem() { }
- ~SipStateReplicatorItem() { }
+ ~SipStateReplicatorItem()
+ {
+ // Since we are acting in a standby fashion outside influences will not have caused our pjsip structures to go away so we must do it ourselves
+ pjsip_inv_terminate(mSession->getInviteSession(), 0, PJ_FALSE);
+
+ // Now that pjsip is taken care of we can drop the session itself and consider life good
+ mSession->destroy();
+ }
// Helper function which sets the session on this replicator item
void setSession(SipSessionPtr session) { mSession = session; };
commit 6d566d79b43569fb0770dd2c19dd4943691928c4
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Sep 30 09:42:16 2010 -0300
Add an implementation of the replica interface which will provide control to toggle between standby/active status.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0938b12..9881a5e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -11,6 +11,7 @@ hydra_component_add_slice(SipChannelService MediaIf)
hydra_component_add_slice(SipChannelService MediaRTPIf)
hydra_component_add_slice(SipChannelService SessionCommunicationsIf)
hydra_component_add_slice(SipChannelService SipStateReplicationIf)
+hydra_component_add_slice(SipChannelService ReplicaIf)
# Add our component's own slice types.
hydra_component_add_slice(SipChannelService SipIf)
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index a490ff0..0a0942a 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -19,6 +19,7 @@
#include "ComponentServiceIf.h"
#include "BridgingIf.h"
#include "SessionCommunicationsIf.h"
+#include "ReplicaIf.h"
#include "SipChannelServiceDataModel.h"
#include "SipChannelServiceEventPublisher.h"
@@ -104,7 +105,12 @@ public: // Overrides of the SipChannelServiceDataModel singleton's public inter
{
return mPaused;
}
-
+
+ virtual bool isActive() const
+ {
+ return mActive;
+ }
+
public: // Implementation details are visible to this file's classes.
void cleanup()
@@ -124,7 +130,9 @@ public: // Implementation details are visible to this file's classes.
bool mPaused;
- SipChannelServiceDataModelImpl() : mPaused(false) {}
+ bool mActive;
+
+SipChannelServiceDataModelImpl() : mPaused(false), mActive(true) {}
};
SipChannelServiceDataModelImpl mDataModelInstance;
@@ -143,6 +151,7 @@ public:
~SipChannelServiceApp()
{
// Smart pointers do your thing.
+ mReplicaService = 0;
mComponentService = 0;
mGlobalAdapter = 0;
mLocalAdapter = 0;
@@ -178,6 +187,7 @@ private:
ServiceLocatorManagementPrx mServiceLocatorManagement;
Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
+ ReplicaPtr mReplicaService;
ComponentServicePtr mComponentService;
PJSipManager *mPJSipManager;
SipStateReplicatorListenerPtr mReplicatorListener;
@@ -186,6 +196,7 @@ private:
static const string ComponentServiceId("SipChannelComponent");
static const string EndpointLocatorObjectId("SipChannelEndpointLocator");
+static const string ReplicaServiceId("SipChannelReplica");
/**
* This class provides implementation for the ComponentService interface, which
@@ -217,6 +228,63 @@ private:
};
/**
+ * This class provides implementation for the Replica interface.
+ */
+class ReplicaImpl : public Replica
+{
+public:
+ReplicaImpl(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter) { }
+
+ bool isActive(const Ice::Current&)
+ {
+ return mDataModelInstance.mActive;
+ }
+
+ bool activate(const Ice::Current&)
+ {
+ mDataModelInstance.mActive = true;
+
+ for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
+ {
+ (*listener)->activated(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mDataModelInstance.mCommunicator->stringToIdentity(ReplicaServiceId))));
+ }
+
+ return true;
+ }
+
+ void standby(const Ice::Current&)
+ {
+ mDataModelInstance.mActive = false;
+
+ for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
+ {
+ (*listener)->onStandby(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mDataModelInstance.mCommunicator->stringToIdentity(ReplicaServiceId))));
+ }
+ }
+
+ void addListener(const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, const Ice::Current&)
+ {
+ mListeners.push_back(listener);
+ }
+
+ void removeListener(const AsteriskSCF::System::Component::V1::ReplicaListenerPrx& listener, const Ice::Current&)
+ {
+ mListeners.erase(std::remove(mListeners.begin(), mListeners.end(), listener), mListeners.end());
+ }
+
+private:
+ /**
+ * Pointer to the object adapter we exist on.
+ */
+ Ice::ObjectAdapterPtr mAdapter;
+
+ /**
+ * Listeners that we need to push state change notifications out to.
+ */
+ vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx> mListeners;
+};
+
+/**
* Wrapper class around pj_thread_desc.
*/
class ThreadDescWrapper
@@ -388,6 +456,7 @@ void SipChannelServiceApp::locateStateReplicator()
if (communicator()->getProperties()->getPropertyWithDefault("Sip.StateReplicatorListener", "no") == "yes")
{
mDataModelInstance.mStateReplicator->addListener(mReplicatorListenerProxy);
+ mDataModelInstance.mActive = false;
}
}
catch (...)
@@ -519,6 +588,10 @@ void SipChannelServiceApp::initialize(const std::string appName)
mGlobalAdapter->add(mDataModelInstance.mEndpointLocator, communicator()->stringToIdentity(EndpointLocatorObjectId));
std::cerr << "[DEBUG] Got proxy to endpoint locator" << std::endl;
+ // Create and publish our Replica interface support.
+ mReplicaService = new ReplicaImpl(mLocalAdapter);
+ mLocalAdapter->add(mReplicaService, communicator()->stringToIdentity(ReplicaServiceId));
+
// Create and publish our ComponentService interface support.
mComponentService = new ComponentServiceImpl(*this);
mLocalAdapter->add(mComponentService, communicator()->stringToIdentity(ComponentServiceId));
diff --git a/src/SipChannelServiceDataModel.h b/src/SipChannelServiceDataModel.h
index 87e0164..5a9dc9e 100644
--- a/src/SipChannelServiceDataModel.h
+++ b/src/SipChannelServiceDataModel.h
@@ -45,6 +45,7 @@ public:
virtual PJSipManager *getPJSipManager() const = 0;
virtual SipStateReplicatorPrx getStateReplicator() const = 0;
virtual bool IsPaused() const = 0;
+ virtual bool isActive() const = 0;
protected:
SipChannelServiceDataModel() {};
commit 2fc696ad3dcd5289aebd4f14970d3c250665382d
Author: Joshua Colp <jcolp at digium.com>
Date: Tue Sep 28 10:10:14 2010 -0300
When replicating session data we want to replicate the media sessions external to our component that we are using, not a proxy to our own.
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 3e44027..08607ea 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -187,11 +187,7 @@ void PJSipSessionModInfo::updateSessionState(pjsip_inv_session *inv_session)
mSessionState->mMediaSessionObjectId = mSession->getMediaSessionProxy()->ice_getIdentity();
mSessionState->mSources = mSession->getSources();
mSessionState->mSinks = mSession->getSinks();
- //getMediaSession requires an Ice::Current reference. Since
- //it's not actually used, we can get away with passing a dummy
- //instead.
- Ice::Current dummy;
- mSessionState->mMediaSession = mSession->getMediaSession(dummy);
+ mSessionState->mMediaSession = mSession->getHiddenMediaSession();
mSessionState->mListeners = mSession->getListeners();
}
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 117f94e..c511693 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -621,6 +621,15 @@ void SipSession::setListeners(const AsteriskSCF::SIP::V1::SessionListenerSeq& li
mImplPriv->mListeners = listeners;
}
+/**
+ * Internal function which returns the media session that is hidden inside the SIP session.
+ */
+AsteriskSCF::Media::V1::SessionPrx SipSession::getHiddenMediaSession()
+{
+ // TODO: This should return a sequence
+ return mImplPriv->mRTPSessions.front();
+}
+
bool SipSession::operator==(const SipSession &other) const {
return (this->mImplPriv->mInviteSession == other.mImplPriv->mInviteSession);
}
diff --git a/src/SipSession.h b/src/SipSession.h
index 86ca0d1..93fe244 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -100,6 +100,8 @@ public:
AsteriskSCF::Media::V1::SessionPrx& getMediaSessionProxy();
void setListeners(const AsteriskSCF::SIP::V1::SessionListenerSeq&);
+
+ AsteriskSCF::Media::V1::SessionPrx getHiddenMediaSession();
private:
void requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats);
commit 0792de5e4dedcf1c50c262bb96cad06569534095
Author: Joshua Colp <jcolp at digium.com>
Date: Tue Sep 28 10:09:52 2010 -0300
We need to use a specifically configured port when doing failover otherwise a random one will be used, and the master and backup must use the same one.
diff --git a/config/test_sip.conf b/config/test_sip.conf
index 1877ee3..6143a9b 100644
--- a/config/test_sip.conf
+++ b/config/test_sip.conf
@@ -1,7 +1,7 @@
# This is a configuration file used in conjunction with the pjsip sip test driver
# Adapter parameters for this component
-SipChannelServiceAdapter.Endpoints=default
+SipChannelServiceAdapter.Endpoints=tcp -p 9985
SipChannelServiceAdapter.ThreadPool.Size=4
SipChannelServiceLocalAdapter.Endpoints=default
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list