[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "rearrange" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Sun Aug 28 00:44:22 CDT 2011
branch "rearrange" has been created
at 42e66ded3b440ec80bf272d26336546b3f056931 (commit)
- Log -----------------------------------------------------------------
commit 42e66ded3b440ec80bf272d26336546b3f056931
Author: Mark Michelson <mmichelson at digium.com>
Date: Sun Aug 28 00:45:09 2011 -0500
A few more operations moved over.
diff --git a/src/Session/SipSession.cpp b/src/Session/SipSession.cpp
index 42f3966..9aaeaa7 100755
--- a/src/Session/SipSession.cpp
+++ b/src/Session/SipSession.cpp
@@ -149,6 +149,42 @@ public:
}
/**
+ * If this session is being started as the result of
+ * a transfer, there may be a Referred-By header to
+ * include.
+ */
+ void addReferredBy(pjsip_tx_data *packet)
+ {
+ AsteriskSCF::SessionCommunications::V1::SessionCookieDict::const_iterator iter =
+ mSessionCookies.find(AsteriskSCF::SessionCookies::SipSessionManager::V1::ReferredByCookie::ice_staticId());
+
+ if (iter == mSessionCookies.end())
+ {
+ lg(Debug) << "No ReferredBy cookie present";
+ return;
+ }
+
+ AsteriskSCF::SessionCookies::SipSessionManager::V1::ReferredByCookiePtr referredBy =
+ AsteriskSCF::SessionCookies::SipSessionManager::V1::ReferredByCookiePtr::dynamicCast(iter->second);
+
+ if (referredBy->value.empty())
+ {
+ lg(Debug) << "Referred-By is empty.";
+ return;
+ }
+
+ pj_str_t referredByHdrStr;
+ pj_cstr(&referredByHdrStr, "Referred-By");
+ pj_str_t referredByValStr;
+ pj_cstr(&referredByValStr, referredBy->value.c_str());
+
+ pjsip_generic_string_hdr *hdr =
+ pjsip_generic_string_hdr_create(packet->pool, &referredByHdrStr, &referredByValStr);
+
+ pjsip_msg_add_hdr(packet->msg, (pjsip_hdr*) hdr);
+ }
+
+ /**
* An instance of a media session.
*/
AsteriskSCF::Media::V1::SessionPtr mMediaSession;
@@ -1055,34 +1091,6 @@ SessionControllerPrx SipSession::setAndGetSessionController(const SessionControl
return mImplPriv->mOurSessionControllerProxy;
}
-class RemoveSessionControllerOperation : public SuspendableWork
-{
-public:
- RemoveSessionControllerOperation(const AsteriskSCF::SessionCommunications::V1::AMD_Session_removeSessionControllerPtr& cb,
- const AsteriskSCF::SessionCommunications::V1::SessionControllerPrx& controller,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mCb(cb), mController(controller), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
- {
- lg(Debug) << "Executing a RemoveSessionController operation";
-
- if (mImplPriv->mSessionController == mController)
- {
- mImplPriv->mSessionController = 0;
- }
-
- mCb->ice_response();
- return Complete;
- }
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_removeSessionControllerPtr mCb;
- AsteriskSCF::SessionCommunications::V1::SessionControllerPrx mController;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
-
-
/**
* An implementation of the removeSessionController method as defined in SessionCommunications.ice
*/
@@ -1091,38 +1099,16 @@ void SipSession::removeSessionController_async(const AsteriskSCF::SessionCommuni
const Ice::Current&)
{
lg(Debug) << "queueing a removeSessionController operation";
- enqueueSessionWork(new RemoveSessionControllerOperation(cb, controller, mImplPriv));
+ enqueueSessionWork(new RemoveSessionControllerOperation(cb, controller, this));
}
-class SetBridgeOperation : public SuspendableWork
+void SipSession::removeSessionController(const SessionControllerPrx& controller)
{
-public:
- SetBridgeOperation(
- const AsteriskSCF::SessionCommunications::V1::AMD_Session_setBridgePtr& cb,
- const SipSessionPtr& session,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv,
- const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
- const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- const Ice::Current& current)
- : mCb(cb), mSession(session), mImplPriv(sessionPriv), mBridge(bridge), mListener(listener), mCurrent(current) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+ if (mImplPriv->mSessionController == controller)
{
- lg(Debug) << "Executing a SetBridge operation";
- mSession->setBridge(mBridge);
- mImplPriv->addListener(mListener);
- mCb->ice_response(mSession->getInfo());
- return Complete;
+ mImplPriv->mSessionController = 0;
}
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_setBridgePtr mCb;
- SipSessionPtr mSession;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
- AsteriskSCF::SessionCommunications::V1::BridgePrx mBridge;
- AsteriskSCF::SessionCommunications::V1::SessionListenerPrx mListener;
- Ice::Current mCurrent;
-};
+}
/**
* An implementation of the setBridge method as defined in SessionCommunications.ice
@@ -1131,10 +1117,19 @@ void SipSession::setBridge_async(
const AsteriskSCF::SessionCommunications::V1::AMD_Session_setBridgePtr& cb,
const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- const Ice::Current& current)
+ const Ice::Current&)
{
lg(Debug) << "queuing a setBridge operation";
- enqueueSessionWork(new SetBridgeOperation(cb, this, mImplPriv, bridge, listener, current));
+ enqueueSessionWork(new SetBridgeOperation(cb, bridge, listener, this));
+}
+
+SessionInfoPtr SipSession::setBridge(
+ const BridgePrx& bridge,
+ const SessionListenerPrx& listener)
+{
+ setBridge(bridge);
+ mImplPriv->addListener(listener);
+ return getInfo();
}
/**
@@ -1145,39 +1140,6 @@ void SipSession::setBridge(const AsteriskSCF::SessionCommunications::V1::BridgeP
mImplPriv->mBridge = bridge;
}
-class RemoveBridgeOperation : public SuspendableWork
-{
-public:
- RemoveBridgeOperation(
- const AsteriskSCF::SessionCommunications::V1::AMD_Session_removeBridgePtr& cb,
- const SipSessionPtr& session,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv,
- const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- const Ice::Current& current)
- : mCb(cb), mSession(session), mImplPriv(sessionPriv), mListener(listener), mCurrent(current) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
- {
- if (mImplPriv->mBridge == 0)
- {
- mCb->ice_exception(AsteriskSCF::SessionCommunications::V1::NotBridged());
- return Complete;
- }
-
- mSession->setBridge(0);
-
- mImplPriv->removeListener(mListener);
- mCb->ice_response();
- return Complete;
- }
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_removeBridgePtr mCb;
- SipSessionPtr mSession;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
- AsteriskSCF::SessionCommunications::V1::SessionListenerPrx mListener;
- Ice::Current mCurrent;
-};
/**
* An implementation of the removeBridge method as defined in SessionCommunications.ice
@@ -1185,30 +1147,23 @@ private:
void SipSession::removeBridge_async(
const AsteriskSCF::SessionCommunications::V1::AMD_Session_removeBridgePtr& cb,
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- const Ice::Current& current)
+ const Ice::Current&)
{
lg(Debug) << "queuing a removeBridge operation";
- enqueueSessionWork(new RemoveBridgeOperation(cb, this, mImplPriv, listener, current));
+ enqueueSessionWork(new RemoveBridgeOperation(cb, listener, this));
}
-class RemoveListenerOperation : public SuspendableWork
+void SipSession::removeBridge(const SessionListenerPrx& listener)
{
-public:
- RemoveListenerOperation(
- const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mListener(listener), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+ if (mImplPriv->mBridge == 0)
{
- lg(Debug) << "Actually removing listener";
- mImplPriv->removeListener(mListener);
- return Complete;
+ throw NotBridged();
}
-private:
- AsteriskSCF::SessionCommunications::V1::SessionListenerPrx mListener;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
+
+ setBridge(0);
+ mImplPriv->removeListener(listener);
+}
+
/**
* An implementation of the removeListener method as defined in SessionCommunications.ice
@@ -1216,78 +1171,14 @@ private:
void SipSession::removeListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current&)
{
lg(Debug) << "removeListener called. Queuing operation";
- enqueueSessionWork(new RemoveListenerOperation(listener, mImplPriv));
+ enqueueSessionWork(new RemoveListenerOperation(listener, this));
}
-class StartOperation : public SuspendableWork
+void SipSession::removeListener(const SessionListenerPrx& listener)
{
-public:
- StartOperation(const SipSessionPtr& session, const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mSession(session), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
- {
- //lg(Debug) << "Sending new SIP INVITE to " << remote;
-
- // Record our session within the dialog so code handling pjsip events can do STUFF
- SipSessionPtr session = new SipSession(*mSession);
-
- // Create the actual INVITE packet
- pjsip_tx_data *packet;
- if ((pjsip_inv_invite(mImplPriv->mInviteSession, &packet)) != PJ_SUCCESS)
- {
- pjsip_inv_terminate(mImplPriv->mInviteSession, 500, 0);
- pjsip_dlg_terminate(mImplPriv->mInviteSession->dlg);
- // What should we do here? Throw an exception?
- return Complete;
- }
-
- addReferredBy(packet);
-
- // Boom! Houston, we have transmission.
- pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
- return Complete;
- }
-
-private:
- /**
- * If this session is being started as the result of
- * a transfer, there may be a Referred-By header to
- * include.
- */
- void addReferredBy(pjsip_tx_data *packet)
- {
- AsteriskSCF::SessionCommunications::V1::SessionCookieDict::const_iterator iter =
- mImplPriv->mSessionCookies.find(AsteriskSCF::SessionCookies::SipSessionManager::V1::ReferredByCookie::ice_staticId());
-
- if (iter == mImplPriv->mSessionCookies.end())
- {
- lg(Debug) << "No ReferredBy cookie present";
- return;
- }
-
- AsteriskSCF::SessionCookies::SipSessionManager::V1::ReferredByCookiePtr referredBy =
- AsteriskSCF::SessionCookies::SipSessionManager::V1::ReferredByCookiePtr::dynamicCast(iter->second);
-
- if (referredBy->value.empty())
- {
- lg(Debug) << "Referred-By is empty.";
- return;
- }
-
- pj_str_t referredByHdrStr;
- pj_cstr(&referredByHdrStr, "Referred-By");
- pj_str_t referredByValStr;
- pj_cstr(&referredByValStr, referredBy->value.c_str());
-
- pjsip_generic_string_hdr *hdr =
- pjsip_generic_string_hdr_create(packet->pool, &referredByHdrStr, &referredByValStr);
+ mImplPriv->removeListener(listener);
+}
- pjsip_msg_add_hdr(packet->msg, (pjsip_hdr*) hdr);
- }
- SipSessionPtr mSession;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
/**
* An implementation of the start method as defined in SessionCommunications.ice which sends
@@ -1296,7 +1187,30 @@ private:
void SipSession::start(const Ice::Current&)
{
lg(Debug) << "We've been asked to start a session.";
- enqueueSessionWork(new StartOperation(this, mImplPriv));
+ enqueueSessionWork(new StartOperation(this));
+}
+
+void SipSession::start()
+{
+ //lg(Debug) << "Sending new SIP INVITE to " << remote;
+
+ // Record our session within the dialog so code handling pjsip events can do STUFF
+ SipSessionPtr session = new SipSession(*this);
+
+ // Create the actual INVITE packet
+ pjsip_tx_data *packet;
+ if ((pjsip_inv_invite(mImplPriv->mInviteSession, &packet)) != PJ_SUCCESS)
+ {
+ pjsip_inv_terminate(mImplPriv->mInviteSession, 500, 0);
+ pjsip_dlg_terminate(mImplPriv->mInviteSession->dlg);
+ // What should we do here? Throw an exception?
+ return;
+ }
+
+ mImplPriv->addReferredBy(packet);
+
+ // Boom! Houston, we have transmission.
+ pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
}
class StopOperation : public SuspendableWork
diff --git a/src/Session/SipSession.h b/src/Session/SipSession.h
index 68e2665..a6f2436 100644
--- a/src/Session/SipSession.h
+++ b/src/Session/SipSession.h
@@ -190,6 +190,10 @@ public:
const AsteriskSCF::SessionCommunications::V1::BridgePrx&,
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
+ AsteriskSCF::SessionCommunications::V1::SessionInfoPtr setBridge(
+ const AsteriskSCF::SessionCommunications::V1::BridgePrx&,
+ const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&);
+
void setBridge(const AsteriskSCF::SessionCommunications::V1::BridgePrx&);
void removeBridge_async(
@@ -197,13 +201,21 @@ public:
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&,
const Ice::Current&);
+ void removeBridge(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&);
+
void activateIceObjects(const AsteriskSCF::SessionCommunications::ExtensionPoints::V1::SessionCreationHookSeq& hooks);
void hold(const Ice::Current&);
void progress(const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr&, const Ice::Current&);
+
void removeListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
+ void removeListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&);
+
void ring(const Ice::Current&);
+
void start(const Ice::Current&);
+ void start();
+
void stop(const AsteriskSCF::SessionCommunications::V1::ResponseCodePtr&, const Ice::Current&);
void unhold(const Ice::Current&);
void setCookies(const AsteriskSCF::SessionCommunications::V1::SessionCookies&, const Ice::Current&);
@@ -239,6 +251,7 @@ public:
const AsteriskSCF::SessionCommunications::V1::SessionControllerPrx&,
const Ice::Current&);
+ void removeSessionController(const AsteriskSCF::SessionCommunications::V1::SessionControllerPrx&);
/**
* TelephonySession overrides
*/
commit 73be4f7404afc83cbfec0b1e3b25d39478a2cb1d
Author: Mark Michelson <mmichelson at digium.com>
Date: Sat Aug 27 23:33:35 2011 -0500
Save some progress towards moving classes around.
This is a lot more work than I thought it would be.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7ea63d9..6d0fd3e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -29,6 +29,8 @@ astscf_component_add_files(SipSessionManager SipEndpoint.cpp)
astscf_component_add_files(SipSessionManager SipEndpoint.h)
astscf_component_add_files(SipSessionManager Session/SipSession.cpp)
astscf_component_add_files(SipSessionManager Session/SipSession.h)
+astscf_component_add_files(SipSessionManager Session/SipSessionOperations.cpp)
+astscf_component_add_files(SipSessionManager Session/SipSessionOperations.h)
astscf_component_add_files(SipSessionManager Session/SipTelephonyEventSource.cpp)
astscf_component_add_files(SipSessionManager Session/SipTelephonyEventSource.h)
astscf_component_add_files(SipSessionManager Session/SipTelephonyEventSink.cpp)
diff --git a/src/Session/SipSession.cpp b/src/Session/SipSession.cpp
index 41ca950..42f3966 100755
--- a/src/Session/SipSession.cpp
+++ b/src/Session/SipSession.cpp
@@ -20,6 +20,7 @@
#include "Session/SipSession.h"
#include "Session/SipTelephonyEventSource.h"
#include "Session/SipTelephonyEventSink.h"
+#include "Session/SipSessionOperations.h"
#include <Ice/Ice.h>
#include <IceUtil/UUID.h>
@@ -111,44 +112,6 @@ public:
{
}
- AsteriskSCF::SessionCommunications::V1::SessionInfoPtr getInfo()
- {
- AsteriskSCF::SessionCommunications::V1::SessionInfoPtr sessioninfo =
- new AsteriskSCF::SessionCommunications::V1::SessionInfo();
-
- /* TODO: Utilize locking so this becomes safe
- if (!mImplPriv->mInviteSession || mImplPriv->mInviteSession->state == PJSIP_INV_STATE_NULL)
- {
- sessioninfo->currentState = "ready";
- }
- else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_CALLING)
- {
- sessioninfo->currentState = "outbound";
- }
- else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_INCOMING)
- {
- sessioninfo->currentState = "inbound";
- }
- else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_EARLY)
- {
- sessioninfo->currentState = "early";
- }
- else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_CONNECTING)
- {
- sessioninfo->currentState = "connecting";
- }
- else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_CONFIRMED)
- {
- sessioninfo->currentState = "connected";
- }
- else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_DISCONNECTED)
- {
- sessioninfo->currentState = "disconnected";
- }
- */
- return sessioninfo;
- }
-
void addListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener)
{
mListeners.push_back(listener);
@@ -185,15 +148,6 @@ public:
}
}
- AsteriskSCF::SessionCommunications::V1::BridgePrx getBridge()
- {
- if (mBridge == 0)
- {
- throw AsteriskSCF::SessionCommunications::V1::NotBridged();
- }
- return mBridge;
- }
-
/**
* An instance of a media session.
*/
@@ -883,115 +837,20 @@ SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter,
activateIceObjects(hooks);
}
-class AddListenerOperation : public SuspendableWork
-{
-public:
- AddListenerOperation(
- const AsteriskSCF::SessionCommunications::V1::AMD_Session_addListenerPtr& cb,
- const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mCb(cb), mListener(listener), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
- {
- lg(Debug) << "Executing addListener operation";
- mImplPriv->addListener(mListener);
- AsteriskSCF::SessionCommunications::V1::SessionInfoPtr sessionInfo =
- mImplPriv->getInfo();
- mCb->ice_response(sessionInfo);
- return Complete;
- }
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_addListenerPtr mCb;
- AsteriskSCF::SessionCommunications::V1::SessionListenerPrx mListener;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
-
void SipSession::addListener_async(
const AsteriskSCF::SessionCommunications::V1::AMD_Session_addListenerPtr& cb,
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
const Ice::Current&)
{
lg(Debug) << "Queueing addListener operation";
- enqueueSessionWork(new AddListenerOperation(cb, listener, mImplPriv));
+ enqueueSessionWork(new AddListenerOperation(cb, listener, this));
}
-class IndicateOperation : public SuspendableWork
+SessionInfoPtr SipSession::addListener(const SessionListenerPrx& listener)
{
-public:
- IndicateOperation(
- const AsteriskSCF::SessionCommunications::V1::AMD_Session_indicatePtr& cb,
- const AsteriskSCF::SessionCommunications::V1::IndicationPtr& indication,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv,
- const SipSessionPtr& session)
- : mCb(cb), mIndication(indication), mImplPriv(sessionPriv), mSession(session) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
- {
- lg(Debug) << "Executing indicate operation";
- AsteriskSCF::SessionCommunications::V1::ConnectIndicationPtr Connect;
- AsteriskSCF::SessionCommunications::V1::FlashIndicationPtr Flash;
- AsteriskSCF::SessionCommunications::V1::HoldIndicationPtr Hold;
- AsteriskSCF::SessionCommunications::V1::ProgressIndicationPtr Progress;
- AsteriskSCF::SessionCommunications::V1::RingIndicationPtr Ring;
- AsteriskSCF::SessionCommunications::V1::UnholdIndicationPtr Unhold;
- pjsip_tx_data *packet = NULL;
- pj_status_t status = -1;
-
- if ((Connect = AsteriskSCF::SessionCommunications::V1::ConnectIndicationPtr::dynamicCast(mIndication)))
- {
- lg(Debug) << "Processing a Connect indication";
- status = pjsip_inv_answer(mImplPriv->mInviteSession, 200, NULL, NULL, &packet);
- }
- else if ((Flash = AsteriskSCF::SessionCommunications::V1::FlashIndicationPtr::dynamicCast(mIndication)))
- {
- lg(Debug) << "Processing a Flash indication";
- }
- else if ((Hold = AsteriskSCF::SessionCommunications::V1::HoldIndicationPtr::dynamicCast(mIndication)))
- {
- // TODO: Update SDP with sendonly attribute and no IP
- // TODO: This is actually passing the hold through, we will need to support local generation
- lg(Debug) << "Processing a Hold indication";
- status = pjsip_inv_reinvite(mImplPriv->mInviteSession, NULL, NULL, &packet);
- }
- else if ((Progress = AsteriskSCF::SessionCommunications::V1::ProgressIndicationPtr::dynamicCast(mIndication)))
- {
- lg(Debug) << "Processing a Progress indication";
- status = pjsip_inv_answer(mImplPriv->mInviteSession, 183, NULL, NULL, &packet);
- }
- else if ((Ring = AsteriskSCF::SessionCommunications::V1::RingIndicationPtr::dynamicCast(mIndication)))
- {
- lg(Debug) << "Processing a Ring indication for session with endpoint " << mSession->getEndpoint()->getName();
- status = pjsip_inv_answer(mImplPriv->mInviteSession, 180, NULL, NULL, &packet);
- }
- else if ((Unhold = AsteriskSCF::SessionCommunications::V1::UnholdIndicationPtr::dynamicCast(mIndication)))
- {
- // TODO: Update SDP with sendrecv and IP
- // TODO: This is actually passing the unhold through, we will need to support local generation
- lg(Debug) << "Processing a Unhold indication";
- status = pjsip_inv_reinvite(mImplPriv->mInviteSession, NULL, NULL, &packet);
- }
- else
- {
- lg(Error) << "Unknown indication received";
- }
-
- // If the indication produced a packet send it out
- if (status == PJ_SUCCESS)
- {
- pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
- }
-
- mCb->ice_response();
- return Complete;
- }
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_indicatePtr mCb;
- AsteriskSCF::SessionCommunications::V1::IndicationPtr mIndication;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
- SipSessionPtr mSession;
-};
+ mImplPriv->addListener(listener);
+ return getInfo();
+}
/**
* An implementation of the indicate method as defined in SessionCommunications.ice
@@ -1002,28 +861,66 @@ void SipSession::indicate_async(
const Ice::Current&)
{
lg(Debug) << "Queuing an indicate operation";
- enqueueSessionWork(new IndicateOperation(cb, indication, mImplPriv, this));
+ enqueueSessionWork(new IndicateOperation(cb, indication, this));
}
-class GetEndpointOperation : public SuspendableWork
+void SipSession::indicate(const IndicationPtr& indication)
{
-public:
- GetEndpointOperation(
- const AsteriskSCF::SessionCommunications::V1::AMD_Session_getEndpointPtr& cb,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mCb(cb), mImplPriv(sessionPriv) { }
+ ConnectIndicationPtr Connect;
+ FlashIndicationPtr Flash;
+ HoldIndicationPtr Hold;
+ ProgressIndicationPtr Progress;
+ RingIndicationPtr Ring;
+ UnholdIndicationPtr Unhold;
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+ pjsip_tx_data *packet = NULL;
+ pj_status_t status = -1;
+
+ if ((Connect = ConnectIndicationPtr::dynamicCast(indication)))
{
- lg(Debug) << "Executing a getEndpoint Operation";
- mCb->ice_response(mImplPriv->mEndpoint->getEndpointProxy());
- return Complete;
+ lg(Debug) << "Processing a Connect indication";
+ status = pjsip_inv_answer(mImplPriv->mInviteSession, 200, NULL, NULL, &packet);
+ }
+ else if ((Flash = FlashIndicationPtr::dynamicCast(indication)))
+ {
+ lg(Debug) << "Processing a Flash indication";
+ }
+ else if ((Hold = HoldIndicationPtr::dynamicCast(indication)))
+ {
+ // TODO: Update SDP with sendonly attribute and no IP
+ // TODO: This is actually passing the hold through, we will need to support local generation
+ lg(Debug) << "Processing a Hold indication";
+ status = pjsip_inv_reinvite(mImplPriv->mInviteSession, NULL, NULL, &packet);
+ }
+ else if ((Progress = ProgressIndicationPtr::dynamicCast(indication)))
+ {
+ lg(Debug) << "Processing a Progress indication";
+ status = pjsip_inv_answer(mImplPriv->mInviteSession, 183, NULL, NULL, &packet);
+ }
+ else if ((Ring = RingIndicationPtr::dynamicCast(indication)))
+ {
+ lg(Debug) << "Processing a Ring indication for session with endpoint " << getEndpoint()->getName();
+ status = pjsip_inv_answer(mImplPriv->mInviteSession, 180, NULL, NULL, &packet);
+ }
+ else if ((Unhold = UnholdIndicationPtr::dynamicCast(indication)))
+ {
+ // TODO: Update SDP with sendrecv and IP
+ // TODO: This is actually passing the unhold through, we will need to support local generation
+ lg(Debug) << "Processing a Unhold indication";
+ status = pjsip_inv_reinvite(mImplPriv->mInviteSession, NULL, NULL, &packet);
+ }
+ else
+ {
+ lg(Error) << "Unknown indication received";
}
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_getEndpointPtr mCb;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
+ // If the indication produced a packet send it out
+ if (status == PJ_SUCCESS)
+ {
+ pjsip_inv_send_msg(mImplPriv->mInviteSession, packet);
+ }
+}
+
/**
* An implementation of the getEndpoint method as defined in SessionCommunications.ice
@@ -1033,32 +930,9 @@ void SipSession::getEndpoint_async(
const Ice::Current&)
{
lg(Debug) << "Queuing a getEndpoint operation";
- enqueueSessionWork(new GetEndpointOperation(cb, mImplPriv));
+ enqueueSessionWork(new GetEndpointOperation(cb, this));
}
-class GetInfoOperation : public SuspendableWork
-{
-public:
- GetInfoOperation(
- const AsteriskSCF::SessionCommunications::V1::AMD_Session_getInfoPtr& cb,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mCb(cb), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
- {
- lg(Debug) << "Executing a GetInfo operation";
- AsteriskSCF::SessionCommunications::V1::SessionInfoPtr sessionInfo =
- mImplPriv->getInfo();
-
- mCb->ice_response(sessionInfo);
- return Complete;
- }
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_getInfoPtr mCb;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
-
/**
* An implementation of the getInfo method as defined in SessionCommunications.ice
*/
@@ -1067,28 +941,44 @@ void SipSession::getInfo_async(
const Ice::Current&)
{
lg(Debug) << "queuing a getInfo operation";
- enqueueSessionWork(new GetInfoOperation(cb, mImplPriv));
+ enqueueSessionWork(new GetInfoOperation(cb, this));
}
-class GetMediaSessionOperation : public SuspendableWork
+SessionInfoPtr SipSession::getInfo()
{
-public:
- GetMediaSessionOperation(
- const AsteriskSCF::SessionCommunications::V1::AMD_Session_getMediaSessionPtr& cb,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mCb(cb), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+ AsteriskSCF::SessionCommunications::V1::SessionInfoPtr sessioninfo =
+ new AsteriskSCF::SessionCommunications::V1::SessionInfo();
+
+ if (!mImplPriv->mInviteSession || mImplPriv->mInviteSession->state == PJSIP_INV_STATE_NULL)
{
- lg(Debug) << "Executing a GetMediaSession operation";
- mCb->ice_response(mImplPriv->mMediaSessionProxy);
- return Complete;
+ sessioninfo->currentState = "ready";
}
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_getMediaSessionPtr mCb;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
+ else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_CALLING)
+ {
+ sessioninfo->currentState = "outbound";
+ }
+ else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_INCOMING)
+ {
+ sessioninfo->currentState = "inbound";
+ }
+ else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_EARLY)
+ {
+ sessioninfo->currentState = "early";
+ }
+ else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_CONNECTING)
+ {
+ sessioninfo->currentState = "connecting";
+ }
+ else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_CONFIRMED)
+ {
+ sessioninfo->currentState = "connected";
+ }
+ else if (mImplPriv->mInviteSession->state == PJSIP_INV_STATE_DISCONNECTED)
+ {
+ sessioninfo->currentState = "disconnected";
+ }
+ return sessioninfo;
+}
/**
* An implementation of the connect method as defined in SessionCommunications.ice
@@ -1098,37 +988,13 @@ void SipSession::getMediaSession_async(
const Ice::Current&)
{
lg(Debug) << "queuing a getMediaSession operation";
- enqueueSessionWork(new GetMediaSessionOperation(cb, mImplPriv));
+ enqueueSessionWork(new GetMediaSessionOperation(cb, this));
}
-class GetBridgeOperation : public SuspendableWork
+AsteriskSCF::Media::V1::SessionPrx SipSession::getMediaSession()
{
-public:
- GetBridgeOperation(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getBridgePtr& cb,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mCb(cb), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
- {
- lg(Debug) << "Executing a GetBridge operation";
- AsteriskSCF::SessionCommunications::V1::BridgePrx bridge;
- try
- {
- bridge = mImplPriv->getBridge();
- }
- catch (const AsteriskSCF::SessionCommunications::V1::NotBridged& ex)
- {
- mCb->ice_exception(ex);
- return Complete;
- }
- mCb->ice_response(bridge);
- return Complete;
- }
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_getBridgePtr mCb;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
+ return mImplPriv->mMediaSessionProxy;
+}
/**
* An implementation of the getBridge method as defined in SessionCommunications.ice
@@ -1138,27 +1004,17 @@ void SipSession::getBridge_async(
const Ice::Current&)
{
lg(Debug) << "queuing a getBridge operation";
- enqueueSessionWork(new GetBridgeOperation(cb, mImplPriv));
+ enqueueSessionWork(new GetBridgeOperation(cb, this));
}
-class GetStreamsOperation : public SuspendableWork
+BridgePrx SipSession::getBridge()
{
-public:
- GetStreamsOperation(const AsteriskSCF::SessionCommunications::V1::AMD_Session_getStreamsPtr& cb,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mCb(cb), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+ if (mImplPriv->mBridge == 0)
{
- lg(Debug) << "Executing a GetStreams operation";
- mCb->ice_response(mImplPriv->mStreams);
- return Complete;
+ throw NotBridged();
}
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_getStreamsPtr mCb;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
+ return mImplPriv->mBridge;
+}
/**
* An implementation of the getStreams method as defined in SessionCommunications.ice
@@ -1168,37 +1024,13 @@ void SipSession::getStreams_async(
const Ice::Current&)
{
lg(Debug) << "queuing a getStreams operation";
- enqueueSessionWork(new GetStreamsOperation(cb, mImplPriv));
+ enqueueSessionWork(new GetStreamsOperation(cb, this));
}
-class SetAndGetSessionControllerOperation : public SuspendableWork
+StreamInformationDict SipSession::getStreams()
{
-public:
- SetAndGetSessionControllerOperation(const AsteriskSCF::SessionCommunications::V1::AMD_Session_setAndGetSessionControllerPtr& cb,
- const AsteriskSCF::SessionCommunications::V1::SessionControllerPrx& controller,
- const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mCb(cb), mController(controller), mImplPriv(sessionPriv) { }
-
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
- {
- lg(Debug) << "Executing a SetAndGetSessionController operation";
-
- if (mImplPriv->mSessionController)
- {
- mCb->ice_exception(AsteriskSCF::SessionCommunications::V1::ControllerAlreadySet());
- return Complete;
- }
-
- mImplPriv->mSessionController = mController;
- mCb->ice_response(mImplPriv->mOurSessionControllerProxy);
- return Complete;
- }
-
-private:
- AsteriskSCF::SessionCommunications::V1::AMD_Session_setAndGetSessionControllerPtr mCb;
- AsteriskSCF::SessionCommunications::V1::SessionControllerPrx mController;
- boost::shared_ptr<SipSessionPriv> mImplPriv;
-};
+ return mImplPriv->mStreams;
+}
/**
* An implementation of the setAndGetSessionController method as defined in SessionCommunications.ice
@@ -1209,7 +1041,18 @@ void SipSession::setAndGetSessionController_async(
const Ice::Current&)
{
lg(Debug) << "queueing a setAndGetSessionController operation";
- enqueueSessionWork(new SetAndGetSessionControllerOperation(cb, controller, mImplPriv));
+ enqueueSessionWork(new SetAndGetSessionControllerOperation(cb, controller, this));
+}
+
+SessionControllerPrx SipSession::setAndGetSessionController(const SessionControllerPrx& controller)
+{
+ if (mImplPriv->mSessionController)
+ {
+ throw AsteriskSCF::SessionCommunications::V1::ControllerAlreadySet();
+ }
+
+ mImplPriv->mSessionController = controller;
+ return mImplPriv->mOurSessionControllerProxy;
}
class RemoveSessionControllerOperation : public SuspendableWork
@@ -1268,7 +1111,7 @@ public:
lg(Debug) << "Executing a SetBridge operation";
mSession->setBridge(mBridge);
mImplPriv->addListener(mListener);
- mCb->ice_response(mImplPriv->getInfo());
+ mCb->ice_response(mSession->getInfo());
return Complete;
}
@@ -1302,11 +1145,6 @@ void SipSession::setBridge(const AsteriskSCF::SessionCommunications::V1::BridgeP
mImplPriv->mBridge = bridge;
}
-AsteriskSCF::SessionCommunications::V1::BridgePrx SipSession::getBridge()
-{
- return mImplPriv->getBridge();
-}
-
class RemoveBridgeOperation : public SuspendableWork
{
public:
@@ -1728,61 +1566,45 @@ AsteriskSCF::SessionCommunications::V1::TelephonyEventSinkSeq SipSession::getSin
/**
* Internal function called to destroy an endpoint. This is controlled by signaling.
*/
-class DestroyOperation : public SuspendableWork
+void SipSession::destroy()
{
-public:
-
- DestroyOperation(const SipSessionPtr& session, const boost::shared_ptr<SipSessionPriv>& sessionPriv)
- : mSession(session), mSessionPriv(sessionPriv) { }
+ lg(Debug) << "queuing a destroy operation";
+ enqueueSessionWork(new DestroyOperation(this));
+}
- SuspendableWorkResult execute(const SuspendableWorkListenerPtr&)
+void SipSession::queuedDestroy()
+{
+ // Remove all of the different interfaces we have exposed to the world.
+ mImplPriv->mAdapter->remove(mImplPriv->mSessionProxy->ice_getIdentity());
+ mImplPriv->mAdapter->remove(mImplPriv->mMediaSessionProxy->ice_getIdentity());
+ if (mImplPriv->mEventSink)
{
- // Remove all of the different interfaces we have exposed to the world.
- mSessionPriv->mAdapter->remove(mSessionPriv->mSessionProxy->ice_getIdentity());
- mSessionPriv->mAdapter->remove(mSessionPriv->mMediaSessionProxy->ice_getIdentity());
- if (mSessionPriv->mEventSink)
- {
- mSessionPriv->mAdapter->remove(mSessionPriv->mEventSinkPrx->ice_getIdentity());
- }
- if (mSessionPriv->mEventSource)
- {
- mSessionPriv->mAdapter->remove(mSessionPriv->mEventSourcePrx->ice_getIdentity());
- }
- mSessionPriv->mMediaSession = 0;
+ mImplPriv->mAdapter->remove(mImplPriv->mEventSinkPrx->ice_getIdentity());
+ }
+ if (mImplPriv->mEventSource)
+ {
+ mImplPriv->mAdapter->remove(mImplPriv->mEventSourcePrx->ice_getIdentity());
+ }
+ mImplPriv->mMediaSession = 0;
- if (mSessionPriv->mReplicationContext->isActive() == true)
+ if (mImplPriv->mReplicationContext->isActive() == true)
+ {
+ //XXX This loop may be a candidate for making AMI-ified and returning "Suspended"
+ // Release all the RTP sessions we are using
+ for (RTPMediaSessionSeq::const_iterator i = mImplPriv->mRTPSessions.begin();
+ i != mImplPriv->mRTPSessions.end(); ++i)
{
- //XXX This loop may be a candidate for making AMI-ified and returning "Suspended"
- // Release all the RTP sessions we are using
- for (RTPMediaSessionSeq::const_iterator i = mSessionPriv->mRTPSessions.begin();
- i != mSessionPriv->mRTPSessions.end(); ++i)
+ try
{
- try
- {
- (*i)->release();
- }
- catch (const Ice::Exception& ex)
- {
- lg(Error) << "Exception caught while trying to release a media session\n" << ex.what();
- }
- }
- }
- mSessionPriv->mEndpoint->removeSession(mSession);
- return Complete;
+ (*i)->release();
+ }
+ catch (const Ice::Exception& ex)
+ {
+ lg(Error) << "Exception caught while trying to release a media session\n" << ex.what();
+ }
+ }
}
-
-private:
- SipSessionPtr mSession;
- boost::shared_ptr<SipSessionPriv> mSessionPriv;
-};
-
-/**
- * Internal function called to destroy an endpoint. This is controlled by signaling.
- */
-void SipSession::destroy()
-{
- lg(Debug) << "queuing a destroy operation";
- enqueueSessionWork(new DestroyOperation(this, mImplPriv));
+ mImplPriv->mEndpoint->removeSession(this);
}
void SipSession::addKeys(const SipEndpointMediaSRTPConfig& config, pjmedia_sdp_media* mediaSDP)
@@ -2712,14 +2534,6 @@ void SipSession::startMedia(const pjmedia_sdp_session*, const pjmedia_sdp_sessio
}
/**
- * Internal function which gets the streams on this session.
- */
-AsteriskSCF::Media::V1::StreamInformationDict& SipSession::getStreams()
-{
- return mImplPriv->mStreams;
-}
-
-/**
* Internal function which gets the endpoint associated with the session.
*/
SipEndpointPtr SipSession::getEndpoint()
diff --git a/src/Session/SipSession.h b/src/Session/SipSession.h
index 8da0248..68e2665 100644
--- a/src/Session/SipSession.h
+++ b/src/Session/SipSession.h
@@ -151,10 +151,14 @@ public:
const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&,
const Ice::Current&);
+ AsteriskSCF::SessionCommunications::V1::SessionInfoPtr addListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener);
+
void indicate_async(
const AsteriskSCF::SessionCommunications::V1::AMD_Session_indicatePtr& cb,
const AsteriskSCF::SessionCommunications::V1::IndicationPtr&, const Ice::Current&);
+ void indicate(const AsteriskSCF::SessionCommunications::V1::IndicationPtr& indication);
+
void connect(const Ice::Current&);
void flash(const Ice::Current&);
@@ -167,10 +171,14 @@ public:
const AsteriskSCF::SessionCommunications::V1::AMD_Session_getInfoPtr& cb,
const Ice::Current&);
+ AsteriskSCF::SessionCommunications::V1::SessionInfoPtr getInfo();
+
void getMediaSession_async(
const AsteriskSCF::SessionCommunications::V1::AMD_Session_getMediaSessionPtr& cb,
const Ice::Current&);
+ AsteriskSCF::Media::V1::SessionPrx getMediaSession();
+
void getBridge_async(
const AsteriskSCF::SessionCommunications::V1::AMD_Session_getBridgePtr& cb,
const Ice::Current&);
@@ -218,11 +226,15 @@ public:
const AsteriskSCF::SessionCommunications::V1::AMD_Session_getStreamsPtr&,
const Ice::Current&);
+ AsteriskSCF::Media::V1::StreamInformationDict getStreams();
+
void setAndGetSessionController_async(
const AsteriskSCF::SessionCommunications::V1::AMD_Session_setAndGetSessionControllerPtr&,
const AsteriskSCF::SessionCommunications::V1::SessionControllerPrx&,
const Ice::Current&);
+ AsteriskSCF::SessionCommunications::V1::SessionControllerPrx setAndGetSessionController(const AsteriskSCF::SessionCommunications::V1::SessionControllerPrx&);
+
void removeSessionController_async(const AsteriskSCF::SessionCommunications::V1::AMD_Session_removeSessionControllerPtr&,
const AsteriskSCF::SessionCommunications::V1::SessionControllerPrx&,
const Ice::Current&);
@@ -252,6 +264,8 @@ public:
*/
void destroy();
+ void queuedDestroy();
+
void addNATAttributes(const SipEndpointSessionConfig& config,
const AsteriskSCF::System::NAT::V1::InteractiveConnectionAgentPrx& iceAgent,
pjmedia_sdp_session* mediaSession);
@@ -293,8 +307,6 @@ public:
//
void startMedia(const pjmedia_sdp_session* local, const pjmedia_sdp_session* remote);
- AsteriskSCF::Media::V1::StreamInformationDict& getStreams();
-
SipEndpointPtr getEndpoint();
AsteriskSCF::SessionCommunications::V1::SessionPrx& getSessionProxy();
commit 9cbf5d9b0bcb2486aa6a512156329d23b73c6bee
Author: Mark Michelson <mmichelson at digium.com>
Date: Sat Aug 27 14:53:13 2011 -0500
Create subdirectories for like-minded files and get things compiling.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 58861aa..7ea63d9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,6 +6,7 @@ endif()
include_directories(${logger_dir}/include)
include_directories(${astscf-ice-util-cpp_dir}/include)
+include_directories(.)
#
# Several Sip Session Gateway files seem to want this compiler flag when
@@ -26,27 +27,27 @@ astscf_component_add_files(SipSessionManager SipEndpointFactory.cpp)
astscf_component_add_files(SipSessionManager SipEndpointFactory.h)
astscf_component_add_files(SipSessionManager SipEndpoint.cpp)
astscf_component_add_files(SipSessionManager SipEndpoint.h)
-astscf_component_add_files(SipSessionManager SipSession.cpp)
-astscf_component_add_files(SipSessionManager SipSession.h)
-astscf_component_add_files(SipSessionManager SipTelephonyEventSource.cpp)
-astscf_component_add_files(SipSessionManager SipTelephonyEventSource.h)
-astscf_component_add_files(SipSessionManager SipTelephonyEventSink.cpp)
-astscf_component_add_files(SipSessionManager SipTelephonyEventSink.h)
+astscf_component_add_files(SipSessionManager Session/SipSession.cpp)
+astscf_component_add_files(SipSessionManager Session/SipSession.h)
+astscf_component_add_files(SipSessionManager Session/SipTelephonyEventSource.cpp)
+astscf_component_add_files(SipSessionManager Session/SipTelephonyEventSource.h)
+astscf_component_add_files(SipSessionManager Session/SipTelephonyEventSink.cpp)
+astscf_component_add_files(SipSessionManager Session/SipTelephonyEventSink.h)
astscf_component_add_files(SipSessionManager PJSipManager.cpp)
astscf_component_add_files(SipSessionManager PJSipManager.h)
astscf_component_add_files(SipSessionManager PJSipModule.cpp)
astscf_component_add_files(SipSessionManager PJSipModule.h)
-astscf_component_add_files(SipSessionManager SipTransfer.cpp)
-astscf_component_add_files(SipSessionManager SipTransfer.h)
-astscf_component_add_files(SipSessionManager PJSipSessionModule.cpp)
-astscf_component_add_files(SipSessionManager PJSipSessionModuleConstruction.cpp)
-astscf_component_add_files(SipSessionManager PJSipSessionModule.h)
-astscf_component_add_files(SipSessionManager PJSipLoggingModule.cpp)
-astscf_component_add_files(SipSessionManager PJSipLoggingModuleConstruction.cpp)
-astscf_component_add_files(SipSessionManager PJSipLoggingModule.h)
-astscf_component_add_files(SipSessionManager PJSipRegistrarModule.cpp)
-astscf_component_add_files(SipSessionManager PJSipRegistrarModuleConstruction.cpp)
-astscf_component_add_files(SipSessionManager PJSipRegistrarModule.h)
+astscf_component_add_files(SipSessionManager Session/SipTransfer.cpp)
+astscf_component_add_files(SipSessionManager Session/SipTransfer.h)
+astscf_component_add_files(SipSessionManager Session/PJSipSessionModule.cpp)
+astscf_component_add_files(SipSessionManager Session/PJSipSessionModuleConstruction.cpp)
+astscf_component_add_files(SipSessionManager Session/PJSipSessionModule.h)
+astscf_component_add_files(SipSessionManager Logging/PJSipLoggingModule.cpp)
+astscf_component_add_files(SipSessionManager Logging/PJSipLoggingModuleConstruction.cpp)
+astscf_component_add_files(SipSessionManager Logging/PJSipLoggingModule.h)
+astscf_component_add_files(SipSessionManager Registrar/PJSipRegistrarModule.cpp)
+astscf_component_add_files(SipSessionManager Registrar/PJSipRegistrarModuleConstruction.cpp)
+astscf_component_add_files(SipSessionManager Registrar/PJSipRegistrarModule.h)
astscf_component_add_files(SipSessionManager AuthManager.cpp)
astscf_component_add_files(SipSessionManager AuthManager.h)
astscf_component_add_files(SipSessionManager SipConfiguration.cpp)
@@ -71,8 +72,8 @@ astscf_component_add_files(SipSessionManager STUNTransport.h)
astscf_component_add_files(SipSessionManager STUNTransportConfig.cpp)
astscf_component_add_files(SipSessionManager STUNTransportConfig.h)
astscf_component_add_files(SipSessionManager NATOptions.h)
-astscf_component_add_files(SipSessionManager SipRegistrarListener.cpp)
-astscf_component_add_files(SipSessionManager SipRegistrarListener.h)
+astscf_component_add_files(SipSessionManager Registrar/SipRegistrarListener.cpp)
+astscf_component_add_files(SipSessionManager Registrar/SipRegistrarListener.h)
astscf_component_add_slices(SipSessionManager PROJECT SipIf.ice)
astscf_component_add_slices(SipSessionManager PROJECT AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice)
astscf_component_add_slices(SipSessionManager PROJECT AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice)
diff --git a/src/Component.cpp b/src/Component.cpp
index 75bacbe..0aeab58 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -37,12 +37,12 @@
#include "SipSessionManagerEventPublisher.h"
#include "SipSessionManagerEndpointLocator.h"
#include "SipEndpointFactory.h"
-#include "PJSipSessionModule.h"
+#include "Session/PJSipSessionModule.h"
#include "PJSipManager.h"
-#include "SipSession.h"
+#include "Session/SipSession.h"
#include "SipStateReplicator.h"
#include "SipConfiguration.h"
-#include "SipRegistrarListener.h"
+#include "Registrar/SipRegistrarListener.h"
#include "SipReplicationContext.h"
using namespace std;
diff --git a/src/PJSipDummyModule.h b/src/Dummy/PJSipDummyModule.h
similarity index 100%
rename from src/PJSipDummyModule.h
rename to src/Dummy/PJSipDummyModule.h
diff --git a/src/PJSipDummyModuleConstruction.cpp b/src/Dummy/PJSipDummyModuleConstruction.cpp
similarity index 100%
rename from src/PJSipDummyModuleConstruction.cpp
rename to src/Dummy/PJSipDummyModuleConstruction.cpp
diff --git a/src/PJSipLoggingModule.cpp b/src/Logging/PJSipLoggingModule.cpp
similarity index 98%
rename from src/PJSipLoggingModule.cpp
rename to src/Logging/PJSipLoggingModule.cpp
index 214e7f2..52bda43 100644
--- a/src/PJSipLoggingModule.cpp
+++ b/src/Logging/PJSipLoggingModule.cpp
@@ -14,7 +14,7 @@
* at the top of the source tree.
*/
-#include "PJSipLoggingModule.h"
+#include "Logging/PJSipLoggingModule.h"
#include <AsteriskSCF/logger.h>
#include <AsteriskSCF/logger.h>
diff --git a/src/PJSipLoggingModule.h b/src/Logging/PJSipLoggingModule.h
similarity index 100%
rename from src/PJSipLoggingModule.h
rename to src/Logging/PJSipLoggingModule.h
diff --git a/src/PJSipLoggingModuleConstruction.cpp b/src/Logging/PJSipLoggingModuleConstruction.cpp
similarity index 98%
rename from src/PJSipLoggingModuleConstruction.cpp
rename to src/Logging/PJSipLoggingModuleConstruction.cpp
index 99960a3..a4d396b 100644
--- a/src/PJSipLoggingModuleConstruction.cpp
+++ b/src/Logging/PJSipLoggingModuleConstruction.cpp
@@ -14,7 +14,7 @@
* at the top of the source tree.
*/
-#include "PJSipLoggingModule.h"
+#include "Logging/PJSipLoggingModule.h"
namespace AsteriskSCF
{
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index fe25567..424f1a3 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -30,11 +30,11 @@
#include <AsteriskSCF/SIP/SIPExtensionPointIf.h>
#include <AsteriskSCF/System/Hook/HookIf.h>
-#include "PJSipSessionModule.h"
-#include "PJSipLoggingModule.h"
+#include "Session/PJSipSessionModule.h"
+#include "Logging/PJSipLoggingModule.h"
#include "Transports.h"
#include "SipModule.h"
-#include "PJSipRegistrarModule.h"
+#include "Registrar/PJSipRegistrarModule.h"
#include "SipReplicationContext.h"
namespace AsteriskSCF
diff --git a/src/PJSipRegistrarModule.cpp b/src/Registrar/PJSipRegistrarModule.cpp
similarity index 99%
rename from src/PJSipRegistrarModule.cpp
rename to src/Registrar/PJSipRegistrarModule.cpp
index 9dcbbb9..02990a8 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/Registrar/PJSipRegistrarModule.cpp
@@ -20,7 +20,7 @@
#include <AsteriskSCF/WorkQueue/WorkQueue.h>
#include <AsteriskSCF/WorkQueue/DefaultQueueListener.h>
-#include "PJSipRegistrarModule.h"
+#include "Registrar/PJSipRegistrarModule.h"
#include "PJSipManager.h"
#include "SipReplicationContext.h"
diff --git a/src/PJSipRegistrarModule.h b/src/Registrar/PJSipRegistrarModule.h
similarity index 100%
rename from src/PJSipRegistrarModule.h
rename to src/Registrar/PJSipRegistrarModule.h
diff --git a/src/PJSipRegistrarModuleConstruction.cpp b/src/Registrar/PJSipRegistrarModuleConstruction.cpp
similarity index 98%
rename from src/PJSipRegistrarModuleConstruction.cpp
rename to src/Registrar/PJSipRegistrarModuleConstruction.cpp
index 42aebfe..fe0d290 100644
--- a/src/PJSipRegistrarModuleConstruction.cpp
+++ b/src/Registrar/PJSipRegistrarModuleConstruction.cpp
@@ -14,7 +14,7 @@
* at the top of the source tree.
*/
-#include "PJSipRegistrarModule.h"
+#include "Registrar/PJSipRegistrarModule.h"
using namespace AsteriskSCF::SIP::Registration::V1;
diff --git a/src/SipRegistrarListener.cpp b/src/Registrar/SipRegistrarListener.cpp
similarity index 99%
rename from src/SipRegistrarListener.cpp
rename to src/Registrar/SipRegistrarListener.cpp
index 8c323c4..2341a2a 100644
--- a/src/SipRegistrarListener.cpp
+++ b/src/Registrar/SipRegistrarListener.cpp
@@ -15,7 +15,7 @@
*/
#include <AsteriskSCF/logger.h>
-#include "SipRegistrarListener.h"
+#include "Registrar/SipRegistrarListener.h"
using namespace AsteriskSCF::System::Logging;
diff --git a/src/SipRegistrarListener.h b/src/Registrar/SipRegistrarListener.h
similarity index 100%
rename from src/SipRegistrarListener.h
rename to src/Registrar/SipRegistrarListener.h
diff --git a/src/PJSipSessionModule.cpp b/src/Session/PJSipSessionModule.cpp
similarity index 99%
rename from src/PJSipSessionModule.cpp
rename to src/Session/PJSipSessionModule.cpp
index 61aada4..7183057 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/Session/PJSipSessionModule.cpp
@@ -14,14 +14,14 @@
* at the top of the source tree.
*/
-#include "PJSipSessionModule.h"
-#include "SipTransfer.h"
+#include "Session/PJSipSessionModule.h"
+#include "Session/SipTransfer.h"
#include "SipEndpoint.h"
#include "SipEndpointFactory.h"
-#include "SipSession.h"
+#include "Session/SipSession.h"
#include "PJSipManager.h"
#include "SipStateReplicator.h"
-#include "SipTelephonyEventSource.h"
+#include "Session/SipTelephonyEventSource.h"
#include "SipReplicationContext.h"
#include <IceUtil/UUID.h>
diff --git a/src/PJSipSessionModule.h b/src/Session/PJSipSessionModule.h
similarity index 99%
rename from src/PJSipSessionModule.h
rename to src/Session/PJSipSessionModule.h
index e641f28..62ecfdb 100644
--- a/src/PJSipSessionModule.h
+++ b/src/Session/PJSipSessionModule.h
@@ -29,7 +29,7 @@
#include "SipEndpointFactory.h"
#include "SipReplicationContext.h"
-#include "SipSession.h"
+#include "Session/SipSession.h"
#include "PJSipModule.h"
namespace AsteriskSCF
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/Session/PJSipSessionModuleConstruction.cpp
similarity index 99%
rename from src/PJSipSessionModuleConstruction.cpp
rename to src/Session/PJSipSessionModuleConstruction.cpp
index 3d3d5ee..8bc9eba 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/Session/PJSipSessionModuleConstruction.cpp
@@ -18,7 +18,7 @@
#include <AsteriskSCF/WorkQueue/WorkQueue.h>
#include <AsteriskSCF/ThreadPool/ThreadPool.h>
-#include "PJSipSessionModule.h"
+#include "Session/PJSipSessionModule.h"
#include "AuthManager.h"
using namespace AsteriskSCF::System::Logging;
diff --git a/src/SipSession.cpp b/src/Session/SipSession.cpp
similarity index 99%
rename from src/SipSession.cpp
rename to src/Session/SipSession.cpp
index f550ce9..41ca950 100755
--- a/src/SipSession.cpp
+++ b/src/Session/SipSession.cpp
@@ -17,9 +17,9 @@
#include "PJSipManager.h"
#include "SipEndpointFactory.h"
#include "SipEndpoint.h"
-#include "SipSession.h"
-#include "SipTelephonyEventSource.h"
-#include "SipTelephonyEventSink.h"
+#include "Session/SipSession.h"
+#include "Session/SipTelephonyEventSource.h"
+#include "Session/SipTelephonyEventSink.h"
#include <Ice/Ice.h>
#include <IceUtil/UUID.h>
diff --git a/src/SipSession.h b/src/Session/SipSession.h
similarity index 100%
rename from src/SipSession.h
rename to src/Session/SipSession.h
diff --git a/src/SipTelephonyEventSink.cpp b/src/Session/SipTelephonyEventSink.cpp
similarity index 99%
rename from src/SipTelephonyEventSink.cpp
rename to src/Session/SipTelephonyEventSink.cpp
index 0e37c6c..16ddd7a 100644
--- a/src/SipTelephonyEventSink.cpp
+++ b/src/Session/SipTelephonyEventSink.cpp
@@ -14,7 +14,7 @@
* at the top of the source tree.
*/
-#include "SipTelephonyEventSink.h"
+#include "Session/SipTelephonyEventSink.h"
namespace AsteriskSCF
{
diff --git a/src/SipTelephonyEventSink.h b/src/Session/SipTelephonyEventSink.h
similarity index 98%
rename from src/SipTelephonyEventSink.h
rename to src/Session/SipTelephonyEventSink.h
index be38512..2a2eb47 100644
--- a/src/SipTelephonyEventSink.h
+++ b/src/Session/SipTelephonyEventSink.h
@@ -14,7 +14,7 @@
* at the top of the source tree.
*/
#pragma once
-#include "SipSession.h"
+#include "Session/SipSession.h"
namespace AsteriskSCF
{
diff --git a/src/SipTelephonyEventSource.cpp b/src/Session/SipTelephonyEventSource.cpp
similarity index 98%
rename from src/SipTelephonyEventSource.cpp
rename to src/Session/SipTelephonyEventSource.cpp
index b424dfa..6ac6d57 100644
--- a/src/SipTelephonyEventSource.cpp
+++ b/src/Session/SipTelephonyEventSource.cpp
@@ -14,7 +14,7 @@
* at the top of the source tree.
*/
-#include "SipTelephonyEventSource.h"
+#include "Session/SipTelephonyEventSource.h"
#include <AsteriskSCF/System/WorkQueue/WorkQueueIf.h>
namespace AsteriskSCF
diff --git a/src/SipTelephonyEventSource.h b/src/Session/SipTelephonyEventSource.h
similarity index 98%
rename from src/SipTelephonyEventSource.h
rename to src/Session/SipTelephonyEventSource.h
index 730b4bd..d016988 100644
--- a/src/SipTelephonyEventSource.h
+++ b/src/Session/SipTelephonyEventSource.h
@@ -15,7 +15,7 @@
*/
#pragma once
-#include "SipSession.h"
+#include "Session/SipSession.h"
namespace AsteriskSCF
{
diff --git a/src/SipTransfer.cpp b/src/Session/SipTransfer.cpp
similarity index 99%
rename from src/SipTransfer.cpp
rename to src/Session/SipTransfer.cpp
index 117ea79..46c351f 100644
--- a/src/SipTransfer.cpp
+++ b/src/Session/SipTransfer.cpp
@@ -14,7 +14,7 @@
* at the top of the source tree.
*/
-#include "SipTransfer.h"
+#include "Session/SipTransfer.h"
#include <boost/algorithm/string.hpp>
#include <IceUtil/UUID.h>
diff --git a/src/SipTransfer.h b/src/Session/SipTransfer.h
similarity index 99%
rename from src/SipTransfer.h
rename to src/Session/SipTransfer.h
index dccbb34..aeb5869 100644
--- a/src/SipTransfer.h
+++ b/src/Session/SipTransfer.h
@@ -20,7 +20,7 @@
#include <AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.h>
#include <AsteriskSCF/System/Hook/HookIf.h>
-#include "PJSipSessionModule.h"
+#include "Session/PJSipSessionModule.h"
namespace AsteriskSCF
{
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index f88691b..ed33893 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -15,7 +15,7 @@
*/
#include "PJSipManager.h"
#include "SipEndpointFactory.h"
-#include "SipSession.h"
+#include "Session/SipSession.h"
#include <Ice/Ice.h>
#include <IceUtil/UUID.h>
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 80b9e2e..94bc54f 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -35,7 +35,7 @@
#include <AsteriskSCF/Media/SDP/MediaSDPIf.h>
#include <AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.h>
-#include "SipSession.h"
+#include "Session/SipSession.h"
#include "SipReplicationContext.h"
namespace AsteriskSCF
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 168b25d..58ea57a 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -18,9 +18,9 @@
#include "SipStateReplicator.h"
#include "SipEndpoint.h"
#include "SipEndpointFactory.h"
-#include "SipSession.h"
+#include "Session/SipSession.h"
#include "PJSipManager.h"
-#include "SipTransfer.h"
+#include "Session/SipTransfer.h"
#include <pjlib.h>
#include <IceUtil/UUID.h>
commit fdf2ec9681b3ac0b879dd445bba76cb9baa22745
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Aug 25 14:59:22 2011 -0500
* Adjust SipConfigurator to use proper service locator parameter type.
* Fix registrar so it does not try to replicate state if it shouldn't.
diff --git a/config/SipConfigurator.py b/config/SipConfigurator.py
index bafe933..88639a8 100755
--- a/config/SipConfigurator.py
+++ b/config/SipConfigurator.py
@@ -256,7 +256,7 @@ class SipSectionVisitors(Configurator.SectionVisitors):
self.visit_endpoint(config, section)
# In order to do service locator based lookup we need to pass in a params object
-serviceLocatorParams = AsteriskSCF.Configuration.SipSessionManager.V1.SipConfigurationParams()
+serviceLocatorParams = AsteriskSCF.Core.Discovery.V1.ServiceLocatorParams()
serviceLocatorParams.category = AsteriskSCF.Configuration.SipSessionManager.V1.ConfigurationDiscoveryCategory
serviceLocatorParams.service = 'default'
diff --git a/src/PJSipRegistrarModule.cpp b/src/PJSipRegistrarModule.cpp
index b9232a9..9dcbbb9 100644
--- a/src/PJSipRegistrarModule.cpp
+++ b/src/PJSipRegistrarModule.cpp
@@ -395,6 +395,11 @@ public:
void execute()
{
+ if (mReplicationContext->isReplicating() == false)
+ {
+ return;
+ }
+
try
{
if (!mNewBindings.empty())
@@ -403,7 +408,7 @@ public:
SipRegistrarStateItemPtr newItem(new SipRegistrarStateItem(mAOR, mAOR, newDict, true));
SipStateItemSeq items;
items.push_back(newItem);
- mReplicationContext->getReplicator()->setState(items);
+ mReplicationContext->getReplicator().tryOneWay()->setState(items);
}
if (!mExistingBindings.empty())
@@ -412,7 +417,7 @@ public:
SipRegistrarStateItemPtr existingItem(new SipRegistrarStateItem(mAOR, mAOR, existingDict, false));
SipStateItemSeq items;
items.push_back(existingItem);
- mReplicationContext->getReplicator()->setState(items);
+ mReplicationContext->getReplicator().tryOneWay()->setState(items);
}
if (!mRemovedBindings.empty())
@@ -421,7 +426,7 @@ public:
SipRegistrarStateItemPtr removedItem(new SipRegistrarStateItem(mAOR, mAOR, removedDict, false));
SipStateItemSeq items;
items.push_back(removedItem);
- mReplicationContext->getReplicator()->removeStateForItems(items);
+ mReplicationContext->getReplicator().tryOneWay()->removeStateForItems(items);
}
}
catch (const Ice::TwowayOnlyException&)
commit 9d646ac41b175c67edb7759a2ec0bc2c1d99b1a1
Author: Brent Eagles <beagles at digium.com>
Date: Thu Aug 25 12:12:21 2011 -0230
The Sip Session Gateway requires /bigobj for the Windows x64 target.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b8ca334..58861aa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,6 +7,14 @@ endif()
include_directories(${logger_dir}/include)
include_directories(${astscf-ice-util-cpp_dir}/include)
+#
+# Several Sip Session Gateway files seem to want this compiler flag when
+# building for Windows x64.
+#
+if(${CMAKE_CL_64})
+ add_definitions("/bigobj")
+endif()
+
astscf_component_init(SipSessionManager)
astscf_component_add_files(SipSessionManager Component.cpp)
astscf_component_add_files(SipSessionManager SipReplicationContext.h)
commit 50a077ec425116275dfcc9bc5032fecd1fb62bdb
Merge: 5fe54b8 ccec5ae
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Aug 18 12:34:24 2011 -0500
Merge branch 'master' of git.asterisk.org:asterisk-scf/release/sip
commit 5fe54b87788a322dd00bddc396b24500b8d13bdc
Author: Mark Michelson <mmichelson at digium.com>
Date: Thu Aug 18 12:33:23 2011 -0500
Hey, I'm merging the transfer-improvements branch.
diff --git a/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice b/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
index b6fabde..09e4af4 100644
--- a/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
+++ b/slice/AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice
@@ -139,8 +139,6 @@ module V1
bool isClient;
};
- sequence<AsteriskSCF::SessionCommunications::V1::SessionListener*> SessionListenerSeq;
-
sequence<AsteriskSCF::Media::RTP::V1::RTPSession*> RTPMediaSessionSeq;
class SipSessionStateItem extends SipStateItem
@@ -155,7 +153,7 @@ module V1
AsteriskSCF::Media::V1::StreamSinkSeq sinks;
AsteriskSCF::Media::V1::StreamInformationDict streams;
RTPMediaSessionSeq rtpMediaSessions;
- SessionListenerSeq listeners;
+ AsteriskSCF::SessionCommunications::V1::SessionListenerSeq listeners;
AsteriskSCF::SessionCommunications::V1::Bridge *bridge;
AsteriskSCF::SessionCommunications::V1::SessionCookieDict cookies;
};
@@ -187,6 +185,37 @@ module V1
bool newBindings;
};
+ /**
+ * The only real state we replicate here is the existence or
+ * nonexistence of this item. So we need to have enough
+ * information to be able to construct this item.
+ */
+ class TransferSessionCreationHookStateItem extends SipStateItem
+ {
+ int referCSeq;
+ string referredBy;
+ //We need enough information to find the REFER dialog.
+ string callId;
+ string localTag;
+ string remoteTag;
+ Ice::Identity objectId;
+ };
+
+ /**
+ * The state we replicate here is the existence or nonexistence
+ * of the item. We need enough information to be able to construct
+ * the item.
+ */
+ class TransferSessionListenerStateItem extends SipStateItem
+ {
+ int referCSeq;
+ //We need enough information to find the REFER dialog.
+ string callId;
+ string localTag;
+ string remoteTag;
+ Ice::Identity objectId;
+ };
+
}; /* module V1 */
}; /* module SipSessionManager */
diff --git a/slice/AsteriskSCF/SessionCookies/SipSessionManager/SipSessionCookiesIf.ice b/slice/AsteriskSCF/SessionCookies/SipSessionManager/SipSessionCookiesIf.ice
new file mode 100644
index 0000000..e3263e6
--- /dev/null
+++ b/slice/AsteriskSCF/SessionCookies/SipSessionManager/SipSessionCookiesIf.ice
@@ -0,0 +1,50 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2010, Digium, Inc.
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk SCF project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE.txt file
+ * at the top of the source tree.
+ */
+
+#pragma once
+
+#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.ice>
+
+module AsteriskSCF
+{
+
+module SessionCookies
+{
+
+module SipSessionManager
+{
+
+["suppress"]
+module V1
+{
+
+/**
+ * When creating an outbound session, if this cookie is present,
+ * then this value should be included in a Referred-By header
+ * on the outbound INVITE.
+ */
+unsliceable class ReferredByCookie extends AsteriskSCF::SessionCommunications::V1::SessionCookie
+{
+ /**
+ * The value of the Referred-By header from a REFER
+ */
+ string value;
+};
+
+}; //end module V1
+}; //end module SipSessionManager
+}; //end module SessionCookies
+}; //end module AsteriskSCF
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index db983f0..b8ca334 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,6 +28,8 @@ astscf_component_add_files(SipSessionManager PJSipManager.cpp)
astscf_component_add_files(SipSessionManager PJSipManager.h)
astscf_component_add_files(SipSessionManager PJSipModule.cpp)
astscf_component_add_files(SipSessionManager PJSipModule.h)
+astscf_component_add_files(SipSessionManager SipTransfer.cpp)
+astscf_component_add_files(SipSessionManager SipTransfer.h)
astscf_component_add_files(SipSessionManager PJSipSessionModule.cpp)
astscf_component_add_files(SipSessionManager PJSipSessionModuleConstruction.cpp)
astscf_component_add_files(SipSessionManager PJSipSessionModule.h)
@@ -66,6 +68,7 @@ astscf_component_add_files(SipSessionManager SipRegistrarListener.h)
astscf_component_add_slices(SipSessionManager PROJECT SipIf.ice)
astscf_component_add_slices(SipSessionManager PROJECT AsteriskSCF/Replication/SipSessionManager/SipStateReplicationIf.ice)
astscf_component_add_slices(SipSessionManager PROJECT AsteriskSCF/Configuration/SipSessionManager/SipConfigurationIf.ice)
+astscf_component_add_slices(SipSessionManager PROJECT AsteriskSCF/SessionCookies/SipSessionManager/SipSessionCookiesIf.ice)
astscf_component_add_ice_libraries(SipSessionManager IceStorm)
astscf_component_add_boost_libraries(SipSessionManager core)
astscf_component_add_slice_collection_libraries(SipSessionManager ASTSCF)
diff --git a/src/Component.cpp b/src/Component.cpp
index dea42f9..75bacbe 100644
--- a/src/Component.cpp
+++ b/src/Component.cpp
@@ -583,7 +583,11 @@ void Component::createReplicationStateListeners()
try
{
// Create and publish our state replicator listener interface.
- mReplicatorListener = new SipStateReplicatorListenerI(mEndpointFactory, mPJSipManager);
+ mReplicatorListener = new SipStateReplicatorListenerI(mEndpointFactory,
+ mPJSipManager,
+ getServiceAdapter(),
+ boost::static_pointer_cast<SipReplicationContext>(getReplicationContext()));
+
SipStateReplicatorListenerPrx replicatorListener = SipStateReplicatorListenerPrx::uncheckedCast(
getBackplaneAdapter()->addWithUUID(mReplicatorListener));
mReplicatorListenerProxy = SipStateReplicatorListenerPrx::uncheckedCast(replicatorListener->ice_oneway());
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 9f8de91..61aada4 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -15,6 +15,7 @@
*/
#include "PJSipSessionModule.h"
+#include "SipTransfer.h"
#include "SipEndpoint.h"
#include "SipEndpointFactory.h"
#include "SipSession.h"
@@ -26,8 +27,6 @@
#include <IceUtil/UUID.h>
#include <boost/lexical_cast.hpp>
-#include <boost/lexical_cast.hpp>
-
#include <AsteriskSCF/Core/Endpoint/EndpointIf.h>
#include <AsteriskSCF/Core/Routing/RoutingIf.h>
#include <AsteriskSCF/SessionCommunications/SessionCommunicationsIf.h>
@@ -483,7 +482,7 @@ protected:
SuspendableWorkListenerPtr listener = 0;
SipAMICallbackPtr cb(new SipAMICallback(listener, mSession, this, false, true));
Ice::CallbackPtr d = Ice::newCallback(cb, &SipAMICallback::callback);
- mSessionRouter->begin_routeSession(operationId, mSession->getSessionProxy(), mDestination, d);
+ mSessionRouter->begin_routeSession(operationId, mSession->getSessionProxy(), mDestination, 0, d);
}
}
catch (const Ice::CommunicatorDestroyedException &)
@@ -690,272 +689,6 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
sessionWork->enqueueWork(new SessionCreationOperation(this, caller, mSessionRouter, inv_session, tdata, replaced_dlg, destination));
}
-class HandleReferOperation : public SipQueueableOperation
-{
-public:
- HandleReferOperation(
- pjsip_inv_session *inv,
- pjsip_transaction *tsx,
- pjsip_tx_data *tdata,
- pjsip_param *replaces_param,
- pjsip_param *to_tag_param,
- pjsip_param *from_tag_param,
- const std::string& target,
- const SipSessionPtr& session,
- const AsteriskSCF::Discovery::SmartProxy<SessionRouterPrx>& sessionRouter,
- const int moduleId)
- : mInv(inv), mTsx(tsx), mTdata(tdata),
- mReplacesParam(replaces_param ? new pjsip_param(*replaces_param) : NULL),
- mToTagParam(to_tag_param ? new pjsip_param(*to_tag_param) : NULL),
- mFromTagParam(from_tag_param ? new pjsip_param(*from_tag_param) : NULL), mTarget(target),
- mSession(session), mSessionRouter(sessionRouter),
- mModuleId(moduleId), mWasWithDestination(false) {}
-
- ~HandleReferOperation()
- {
- delete mReplacesParam;
- delete mToTagParam;
- delete mFromTagParam;
- }
-
-protected:
- /**
- * This is what is initially called when the operation is queued.
- *
- * In this portion, we grab some essential data out of the target URI and use
- * it to call out to the routing service, either ConnectBridgedSessions or
- * ConnectBridgedSessionWithDestination.
- *
- * When this operation is successful, it will result in work for this session
- * being suspended until the routing service returns.
- */
- SuspendableWorkResult initial(const SuspendableWorkListenerPtr& workListener)
- {
- // Determine if this is a blind transfer or an attended transfer
-
- if (mReplacesParam)
- {
- pjsip_dialog *other_dlg = NULL;
-
- if (mToTagParam && mFromTagParam)
- {
- other_dlg = pjsip_ua_find_dialog(&mReplacesParam->value, &mToTagParam->value, &mFromTagParam->value,
- PJ_TRUE);
- }
- else
- {
- // It is possible for the to and from tag value to be present within the Replaces parameter value, so try to
- // parse it out
- std::string replaces_value_tmp = std::string(pj_strbuf(&mReplacesParam->value),
- pj_strlen(&mReplacesParam->value));
- size_t from_tag_pos = replaces_value_tmp.find(";from-tag=");
- size_t to_tag_pos = replaces_value_tmp.find(";to-tag=");
-
- if (from_tag_pos == std::string::npos || to_tag_pos == std::string::npos)
- {
- lg(Debug) << "handleRefer() sending 400 due to From or To missing. ";
- pjsip_dlg_modify_response(mInv->dlg, mTdata, 400, NULL);
- pjsip_dlg_send_response(mInv->dlg, mTsx, mTdata);
- return Complete;
- }
-
- std::string to_tag_value = replaces_value_tmp.substr(to_tag_pos + 8, from_tag_pos - to_tag_pos - 8);
- std::string from_tag_value = replaces_value_tmp.substr(from_tag_pos + 10);
- std::string replaces_value = replaces_value_tmp.substr(0, to_tag_pos);
-
- pj_str_t to_tag_str = pj_str((char*)to_tag_value.c_str());
- pj_str_t from_tag_str = pj_str((char*)from_tag_value.c_str());
- pj_str_t replaces_tag_str = pj_str((char*)replaces_value.c_str());
-
- other_dlg = pjsip_ua_find_dialog(&replaces_tag_str, &to_tag_str, &from_tag_str, PJ_TRUE);
- }
-
- if (!other_dlg)
- {
- lg(Debug) << "handleRefer() sending PJSIP_SC_CALL_TSX_DOES_NOT_EXIST due to no other_dlg. ";
- pjsip_dlg_modify_response(mInv->dlg, mTdata, PJSIP_SC_CALL_TSX_DOES_NOT_EXIST, NULL);
- pjsip_dlg_send_response(mInv->dlg, mTsx, mTdata);
- return Complete;
- }
-
- pjsip_inv_session *other_inv = pjsip_dlg_get_inv_session(other_dlg);
-
- if (!other_inv)
- {
- lg(Debug) << "handleRefer() sending PJSIP_SC_CALL_TSX_DOES_NOT_EXIST due to no other_inv. ";
- pjsip_dlg_modify_response(mInv->dlg, mTdata, PJSIP_SC_CALL_TSX_DOES_NOT_EXIST, NULL);
- pjsip_dlg_send_response(mInv->dlg, mTsx, mTdata);
- pjsip_dlg_dec_lock(other_dlg);
- return Complete;
- }
-
- if (other_inv->state >= PJSIP_INV_STATE_DISCONNECTED)
- {
- lg(Debug) << "handleRefer() sending PJSIP_SC_DECLINE due to state > PJSIP_INV_STATE_DISCONNECTED. ";
-
- pjsip_dlg_modify_response(mInv->dlg, mTdata, PJSIP_SC_DECLINE, NULL);
- pjsip_dlg_send_response(mInv->dlg, mTsx, mTdata);
- pjsip_dlg_dec_lock(other_dlg);
- return Complete;
- }
-
- if (other_inv->state <= PJSIP_INV_STATE_EARLY && other_inv->role != PJSIP_ROLE_UAC)
- {
- lg(Debug) << "handleRefer() sending PJSIP_SC_CALL_TSX_DOES_NOT_EXIST due to other_inv->state < PJSIP_INV_STATE_EARLY and role not UAC. ";
-
- pjsip_dlg_modify_response(mInv->dlg, mTdata, PJSIP_SC_CALL_TSX_DOES_NOT_EXIST, NULL);
- pjsip_dlg_send_response(mInv->dlg, mTsx, mTdata);
- pjsip_dlg_dec_lock(other_dlg);
- return Complete;
- }
-
- PJSipSessionModInfo *other_session_mod_info = (PJSipSessionModInfo*)other_inv->mod_data[mModuleId];
- SipSessionPtr other_session = other_session_mod_info->getSessionPtr();
-
- try
- {
- std::string operationId = ::IceUtil::generateUUID();
- SipAMICallbackPtr cb(new SipAMICallback(workListener, mSession, this, false, true));
- Ice::CallbackPtr d = Ice::newCallback(cb, &SipAMICallback::callback);
-
- lg(Debug) << "handleRefer() calling router connectBridgedSessions(). ";
- mSessionRouter->begin_connectBridgedSessions(operationId, mSession->getSessionProxy(), other_session->getSessionProxy(), d);
- pjsip_dlg_dec_lock(other_dlg);
- return Complete;
- }
- catch (const Ice::CommunicatorDestroyedException &)
- {
- lg(Debug) << "handleRefer() sending 503 due to communicator destruction";
- pjsip_dlg_modify_response(mInv->dlg, mTdata, 503, NULL);
- pjsip_dlg_send_response(mInv->dlg, mTsx, mTdata);
- pjsip_dlg_dec_lock(other_dlg);
- return Complete;
- }
- }
- else
- {
- // Now that we have the target user we can pass this into routing and go on our marry way
... 2570 lines suppressed ...
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list