[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Wed Aug 25 07:42:02 CDT 2010
branch "master" has been updated
via ec53acb6b8f8d52a6484dd25e04827dede7eedf9 (commit)
via efd1afc605ad2fcac455db8ab9399b0a178120a7 (commit)
from 1f8a39e7b4c53e9cf6b6662a861f480cfbc8fb21 (commit)
Summary of changes:
src/SipChannelServiceApp.cpp | 19 ++++++++++++-------
src/SipChannelServiceDataModel.h | 2 ++
src/SipEndpoint.cpp | 37 ++++++++++++++++++++++++++++++++++---
src/SipEndpoint.h | 2 ++
4 files changed, 50 insertions(+), 10 deletions(-)
- Log -----------------------------------------------------------------
commit ec53acb6b8f8d52a6484dd25e04827dede7eedf9
Author: Joshua Colp <jcolp at digium.com>
Date: Wed Aug 25 09:53:34 2010 -0300
Populate the SDP with IP address/port information from the first stream. This will need to be changed to iterate through all streams present in the future.
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 573ae8d..535cd99 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -252,24 +252,28 @@ pjmedia_sdp_session *SipEndpoint::createSDPOffer()
sdp->origin.net_type = pj_str(net_type);
char addr_type[] = "IPV4";
sdp->origin.addr_type = pj_str(addr_type);
+ sdp->origin.addr = *pj_gethostname();
sdp->name = pj_str(user);
sdp->time.start = 0;
sdp->time.stop = 0;
sdp->attr_count = 0;
+ // Right now we only support a single stream so go and get it
+ Hydra::Media::RTP::V1::StreamSourceRTPPrx stream = Hydra::Media::RTP::V1::StreamSourceRTPPrx::uncheckedCast(mSources.front());
+
// Add connection details at the session level since we currently only support one media stream.
sdp->conn = static_cast<pjmedia_sdp_conn*>(pj_pool_zalloc(mDialog->pool, sizeof(pjmedia_sdp_conn)));
sdp->conn->net_type = pj_str(net_type);
sdp->conn->addr_type = pj_str(addr_type);
- // Populate sdp->conn->addr here with the local address
+ sdp->conn->addr = pj_str((char*)stream->getLocalAddress().c_str());
// Add a single media stream
sdp->media_count = 1;
sdp->media[0] = static_cast<pjmedia_sdp_media*>(pj_pool_zalloc(mDialog->pool, sizeof(pjmedia_sdp_media)));
char desc_media[] = "audio";
sdp->media[0]->desc.media = pj_str(desc_media);
- // Populate sdp->media[0]->desc.port with the local port
- // Set sdp->media[0]->desc.port_count to 1 for one port
+ sdp->media[0]->desc.port = stream->getLocalPort();
+ sdp->media[0]->desc.port_count = 1;
char desc_transport[] = "RTP/AVP";
sdp->media[0]->desc.transport = pj_str(desc_transport);
commit efd1afc605ad2fcac455db8ab9399b0a178120a7
Author: Joshua Colp <jcolp at digium.com>
Date: Wed Aug 25 09:41:18 2010 -0300
Add the beginnings of RTP session support. This will get an RTP session when an endpoint is created, currently not based on any formats (but that will need to change).
diff --git a/src/SipChannelServiceApp.cpp b/src/SipChannelServiceApp.cpp
index 2950ba9..2a509ee 100644
--- a/src/SipChannelServiceApp.cpp
+++ b/src/SipChannelServiceApp.cpp
@@ -67,6 +67,11 @@ public: // Overrides of the SipChannelServiceDataModel singleton's public inter
return mEndpointFactory;
}
+ virtual ServiceLocatorPrx getServiceLocator() const
+ {
+ return mServiceLocator;
+ }
+
virtual bool IsPaused() const
{
return mPaused;
@@ -84,6 +89,7 @@ public: // Implementation details are visible to this file's classes.
Routing::V1::LocatorRegistryPrx mRoutingServiceLocatorRegistry;
Bridging::V1::BridgeFactoryPrx mBridgeFactory;
boost::shared_ptr<SipEndpointFactory> mEndpointFactory;
+ ServiceLocatorPrx mServiceLocator;
bool mPaused;
@@ -128,7 +134,6 @@ private:
std::string mAppName;
Ice::ObjectAdapterPtr mAdapter;
ServiceLocatorManagementPrx mServiceLocatorManagement;
- ServiceLocatorPrx mServiceLocator;
Discovery::V1::ServiceManagementPrx mComponentServiceManagement;
ComponentServicePtr mComponentService;
@@ -306,15 +311,15 @@ void SipChannelServiceApp::deregisterFromRoutingService()
*/
void SipChannelServiceApp::locateRoutingService()
{
- if (mServiceLocator == 0)
+ if (mDataModelInstance.mServiceLocator == 0)
{
- mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+ mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
}
ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
genericparams->category = Routing::V1::RoutingServiceLocatorRegistryDiscoveryCategory;
- Ice::ObjectPrx objectPrx = mServiceLocator->locate(genericparams);
+ Ice::ObjectPrx objectPrx = mDataModelInstance.mServiceLocator->locate(genericparams);
mDataModelInstance.mRoutingServiceLocatorRegistry = Routing::V1::LocatorRegistryPrx::checkedCast(objectPrx);
}
@@ -325,15 +330,15 @@ void SipChannelServiceApp::locateRoutingService()
*/
void SipChannelServiceApp::locateBridgeService()
{
- if (mServiceLocator == 0)
+ if (mDataModelInstance.mServiceLocator == 0)
{
- mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+ mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
}
ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
genericparams->category = Hydra::Core::Bridging::V1::BridgeServiceDiscoveryCategory;
- Ice::ObjectPrx objectPrx = mServiceLocator->locate(genericparams);
+ Ice::ObjectPrx objectPrx = mDataModelInstance.mServiceLocator->locate(genericparams);
mDataModelInstance.mBridgeFactory = Hydra::Core::Bridging::V1::BridgeFactoryPrx::checkedCast(objectPrx);
}
diff --git a/src/SipChannelServiceDataModel.h b/src/SipChannelServiceDataModel.h
index b408798..1d9530d 100644
--- a/src/SipChannelServiceDataModel.h
+++ b/src/SipChannelServiceDataModel.h
@@ -4,6 +4,7 @@
#include <boost/shared_ptr.hpp>
#include "RoutingIf.h"
#include "BridgeServiceIf.h"
+#include "ServiceLocatorIf.h"
namespace Hydra
{
@@ -29,6 +30,7 @@ public:
virtual Hydra::Core::Routing::V1::LocatorRegistryPrx getRoutingService() const = 0;
virtual Hydra::Core::Bridging::V1::BridgeFactoryPrx getBridgeFactory() const = 0;
virtual boost::shared_ptr<SipEndpointFactory> getEndpointFactory() const = 0;
+ virtual Hydra::Core::Discovery::V1::ServiceLocatorPrx getServiceLocator() const = 0;
virtual bool IsPaused() const = 0;
protected:
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index ba53289..573ae8d 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -2,6 +2,7 @@
#include <IceUtil/UUID.h>
#include "SipEndpoint.h"
+#include "SipChannelServiceDataModel.h"
namespace Hydra
{
@@ -206,6 +207,10 @@ SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEnd
callback = Hydra::Session::V1::SignalCallbackPrx::uncheckedCast(adapter->addWithUUID(mSignalCallbacks));
mMediaSession = new SipMediaSession(this);
mediaSession = Hydra::Media::V1::SessionPrx::uncheckedCast(adapter->addWithUUID(mMediaSession));
+
+ // Get an RTP session capable of handling the formats we are going to offer
+ Hydra::Media::V1::FormatSeq formats;
+ requestRTPSessions(formats);
}
/**
@@ -295,5 +300,27 @@ pjmedia_sdp_session *SipEndpoint::createSDPOffer()
return sdp;
}
+/**
+ * Internal function called to request needed RTP sessions.
+ */
+void SipEndpoint::requestRTPSessions(Hydra::Media::V1::FormatSeq& formats)
+{
+ // TODO: This needs to be improved for multiple streams
+ Hydra::Media::RTP::V1::RTPServiceLocatorParamsPtr params = new Hydra::Media::RTP::V1::RTPServiceLocatorParams();
+ params->category = "rtp";
+ params->formats = formats;
+
+ SipChannelServiceDataModel& mDataModelInstance(SipChannelServiceDataModel::getInstance());
+ Hydra::Media::RTP::V1::RTPMediaServicePrx factory = Hydra::Media::RTP::V1::RTPMediaServicePrx::uncheckedCast(mDataModelInstance.getServiceLocator()->locate(params));
+ Hydra::Media::RTP::V1::RTPSessionPrx session = factory->allocate(formats);
+ mRTPSessions.push_back(session);
+
+ // Create a local copy of the sources, this won't get changed by the RTP session so it's all good
+ mSources = session->getSources();
+
+ // Create a local copy of the sinks, this won't get changed by the RTP session so it's all good
+ mSinks = session->getSinks();
+}
+
}; // end SipChannelService
}; // end Hydra
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 268b60a..8168c6a 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -76,6 +76,8 @@ public:
Hydra::Media::V1::StreamSinkSeq getSinks() { return mSinks; };
private:
+ void requestRTPSessions(Hydra::Media::V1::FormatSeq& formats);
+
/**
* An instance of signal commands.
*/
-----------------------------------------------------------------------
--
asterisk-scf/integration/sip.git
More information about the asterisk-scf-commits
mailing list