[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "ipv6" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Sun May 8 09:57:28 CDT 2011
branch "ipv6" has been created
at 70881290a7b89316f8fb51b6d74f2860082f0341 (commit)
- Log -----------------------------------------------------------------
commit 70881290a7b89316f8fb51b6d74f2860082f0341
Author: Joshua Colp <jcolp at digium.com>
Date: Sun May 8 11:56:18 2011 -0300
I went a little obsessive... so here is IPv6 support with unit tests and replication.
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index 254b50e..90a534a 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -74,6 +74,7 @@ module V1
class RtpGeneralStateItem extends RtpStateItem
{
AsteriskSCF::Core::Discovery::V1::ServiceManagement *mServiceManagement;
+ string mComparatorId;
};
class RtpSessionStateItem extends RtpStateItem
@@ -84,6 +85,7 @@ module V1
Ice::Identity mSourceIdentity;
AsteriskSCF::Media::V1::FormatSeq mFormats;
PayloadMap mPayloadstoFormats;
+ bool mIPv6;
};
class RtpStreamSinkStateItem extends RtpStateItem
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 3c1343e..03b9fb5 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -52,6 +52,7 @@ Logger lg = getLoggerFactory().getLogger("AsteriskSCF.MediaRTP");
static const string ReplicaServiceId("MediaRtpReplica");
static const string MediaServiceId("RTPMediaService");
+static const string MediaComparatorServiceId("RTPMediaServiceComparator");
/**
* Implementation of the RTPMediaService interface as defined in MediaRTPIf.ice
@@ -61,7 +62,7 @@ class RTPMediaServiceImpl : public RTPMediaService
public:
RTPMediaServiceImpl(const Ice::ObjectAdapterPtr&, const ReplicaPtr&,
const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>&);
- RTPSessionPrx allocate(const FormatSeq&, const Ice::Current&);
+ RTPSessionPrx allocate(const RTPServiceLocatorParamsPtr&, const Ice::Current&);
pj_pool_factory *getPoolFactory() { return &mCachingPool.factory; };
private:
/**
@@ -161,6 +162,37 @@ private:
};
/**
+ * Implementation of the ServiceLocatorParamsCompare class
+ */
+class RTPMediaServiceCompareServiceImpl : public ServiceLocatorParamsCompare
+{
+public:
+ bool isSupported(const ServiceLocatorParamsPtr& locatorParams, const Ice::Current&)
+ {
+ RTPServiceLocatorParamsPtr params;
+
+ if (!(params = RTPServiceLocatorParamsPtr::dynamicCast(locatorParams)))
+ {
+ return false;
+ }
+
+ bool result = true;
+
+ // This is done on purpose for additional checks in the future
+ if (params->ipv6 == true)
+ {
+#ifdef PJ_HAS_IPV6
+ result = true;
+#else
+ result = false;
+#endif
+ }
+
+ return result;
+ };
+};
+
+/**
* Implementation of the IceBox::Service class
*/
class MediaRTPpjmediaApp : public IceBox::Service
@@ -341,10 +373,10 @@ RTPMediaServiceImpl::RTPMediaServiceImpl(const Ice::ObjectAdapterPtr& adapter, c
/**
* Implementation of the allocate method as defined in MediaRTPIf.ice
*/
-RTPSessionPrx RTPMediaServiceImpl::allocate(const FormatSeq& formats, const Ice::Current&)
+RTPSessionPrx RTPMediaServiceImpl::allocate(const RTPServiceLocatorParamsPtr& params, const Ice::Current&)
{
RTPSessionImplPtr session =
- new RTPSessionImpl(mAdapter, formats, &mCachingPool.factory, mReplicaService, mStateReplicator);
+ new RTPSessionImpl(mAdapter, params, &mCachingPool.factory, mReplicaService, mStateReplicator);
return session->getProxy();
}
@@ -440,20 +472,33 @@ void MediaRTPpjmediaApp::start(const std::string&, const Ice::CommunicatorPtr& c
}
}
+ ServiceLocatorParamsComparePtr rtpmediacomparatorservice = new RTPMediaServiceCompareServiceImpl();
+ ServiceLocatorParamsComparePrx RTPMediaComparatorServiceProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
+ mGlobalAdapter->add(rtpmediacomparatorservice, mCommunicator->stringToIdentity(MediaComparatorServiceId)));
+
+ if (mReplicaService->isActive() == true)
+ {
+ mGeneralState->mComparatorId = IceUtil::generateUUID();
+ management->addCompare(mGeneralState->mComparatorId, RTPMediaComparatorServiceProxy);
+ }
+
+
RTPMediaServicePrx RTPMediaServiceProxy = RTPMediaServicePrx::uncheckedCast(mGlobalAdapter->add(rtpmediaservice,
mCommunicator->stringToIdentity(MediaServiceId)));
- ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
+ RTPServiceLocatorParamsPtr rtpparams = new RTPServiceLocatorParams();
if (mReplicaService->isActive() == true)
{
mGeneralState->mServiceManagement = ServiceManagementPrx::uncheckedCast(
management->addService(RTPMediaServiceProxy, "media_rtp_pjmedia"));
/* Now we can add some parameters to help find us. */
- genericparams->category = "rtp";
- mGeneralState->mServiceManagement->addLocatorParams(genericparams, "");
+ rtpparams->category = "rtp";
+ mGeneralState->mServiceManagement->addLocatorParams(rtpparams, mGeneralState->mComparatorId);
}
+ ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
+
/* One must provide a component service to manage us, if someone wants to */
ComponentServicePtr ComponentService = new ComponentServicepjmediaImpl(*this, mGeneralState);
ComponentServicePrx ComponentServiceProxy =
@@ -483,7 +528,10 @@ void MediaRTPpjmediaApp::stop()
mComponentServiceManagement->unregister();
if (mReplicaService->isActive() == true)
{
- mGeneralState-> mServiceManagement->unregister();
+ mGeneralState->mServiceManagement->unregister();
+ ServiceLocatorManagementPrx management =
+ ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("ServiceLocatorManagementProxy"));
+ management->removeCompare(mGeneralState->mComparatorId);
}
mCommunicator->destroy();
}
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 2ab6074..7fa8000 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -131,10 +131,10 @@ public:
/**
* Constructor for the RTPSessionImpl class (used by Ice).
*/
-RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const FormatSeq& formats,
+RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const RTPServiceLocatorParamsPtr& params,
pj_pool_factory* factory, const ReplicaPtr& replicaService,
const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
- mImpl(new RTPSessionImplPriv(adapter, formats, replicaService, stateReplicator))
+ mImpl(new RTPSessionImplPriv(adapter, params->formats, replicaService, stateReplicator))
{
/* Add ourselves to the ICE ASM so we can be used. */
mImpl->mProxy = RTPSessionPrx::uncheckedCast(adapter->addWithUUID(this));
@@ -147,10 +147,12 @@ RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const Forma
/* TODO: This is bad... we can't go on! */
}
+ int af = (params->ipv6 == true) ? pj_AF_INET6() : pj_AF_INET();
+
/* Now create some transport we can use to actually send or receive the media. */
for (int port = DEFAULT_RTP_PORT_MINIMUM; port < DEFAULT_RTP_PORT_MAXIMUM; port += 2)
{
- if ((status = pjmedia_transport_udp_create2(mImpl->mEndpoint, "RTP", NULL, port, 0, &mImpl->mTransport)) ==
+ if ((status = pjmedia_transport_udp_create3(mImpl->mEndpoint, af, "RTP", NULL, port, 0, &mImpl->mTransport)) ==
PJ_SUCCESS)
{
mImpl->mSessionStateItem->mPort = port;
@@ -161,7 +163,8 @@ RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const Forma
// Initialize our session state item enough so that the state items for the source and sink can also be initialized.
mImpl->mSessionStateItem->key = mImpl->mSessionStateItem->mSessionId = IceUtil::generateUUID();
mImpl->mSessionStateItem->mSessionIdentity = mImpl->mProxy->ice_getIdentity();
- mImpl->mSessionStateItem->mFormats = formats;
+ mImpl->mSessionStateItem->mFormats = params->formats;
+ mImpl->mSessionStateItem->mIPv6 = params->ipv6;
/* First up for our own stuff is... a source! Media needs to come from somewhere, you know. */
mImpl->mStreamSource = new StreamSourceRTPImpl(this, mImpl->mSessionStateItem->key);
@@ -182,7 +185,7 @@ RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const Forma
*/
RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, pj_pool_factory* factory,
const Ice::Identity& sessionIdentity, const Ice::Identity& sinkIdentity, const Ice::Identity& sourceIdentity,
- Ice::Int port, const FormatSeq& formats) :
+ Ice::Int port, const FormatSeq& formats, bool ipv6) :
mImpl(new RTPSessionImplPriv(adapter, formats, 0, *(new AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>)))
{
mImpl->mProxy = RTPSessionPrx::uncheckedCast(adapter->add(this, sessionIdentity));
@@ -194,7 +197,9 @@ RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, pj_pool_fac
/* TODO: This is bad... we can't go on! */
}
- if ((status = pjmedia_transport_udp_create2(mImpl->mEndpoint, "RTP", NULL, port, 0, &mImpl->mTransport))
+ int af = (ipv6 == true) ? pj_AF_INET6() : pj_AF_INET();
+
+ if ((status = pjmedia_transport_udp_create3(mImpl->mEndpoint, af, "RTP", NULL, port, 0, &mImpl->mTransport))
!= PJ_SUCCESS)
{
// TODO: This is also bad, something is using the port */
diff --git a/src/RTPSession.h b/src/RTPSession.h
index a8e4b7a..be3473c 100644
--- a/src/RTPSession.h
+++ b/src/RTPSession.h
@@ -41,11 +41,11 @@ typedef IceUtil::Handle<StreamSourceRTPImpl> StreamSourceRTPImplPtr;
class RTPSessionImpl : public AsteriskSCF::Media::RTP::V1::RTPSession
{
public:
- RTPSessionImpl(const Ice::ObjectAdapterPtr&, const AsteriskSCF::Media::V1::FormatSeq&,
- pj_pool_factory*, const AsteriskSCF::System::Component::V1::ReplicaPtr&,
- const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>&);
+ RTPSessionImpl(const Ice::ObjectAdapterPtr&, const AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParamsPtr&,
+ pj_pool_factory*, const AsteriskSCF::System::Component::V1::ReplicaPtr&,
+ const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>&);
RTPSessionImpl(const Ice::ObjectAdapterPtr&, pj_pool_factory*, const Ice::Identity&, const Ice::Identity&,
- const Ice::Identity&, Ice::Int, const AsteriskSCF::Media::V1::FormatSeq&);
+ const Ice::Identity&, Ice::Int, const AsteriskSCF::Media::V1::FormatSeq&, bool);
AsteriskSCF::Media::V1::StreamSourceSeq getSources(const Ice::Current&);
AsteriskSCF::Media::V1::StreamSinkSeq getSinks(const Ice::Current&);
std::string getId(const Ice::Current&);
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index fb612cb..babec1e 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -209,8 +209,14 @@ std::string StreamSinkRTPImpl::getRemoteAddress(const Ice::Current&)
pjmedia_transport_info_init(&transportInfo);
pjmedia_transport_get_info(mImpl->mSession->getTransport(), &transportInfo);
- string address = pj_inet_ntoa(transportInfo.src_rtp_name.ipv4.sin_addr);
- return (address != "0.0.0.0") ? address : mImpl->mSinkStateItem->mRemoteAddress;
+ if (transportInfo.src_rtp_name.addr.sa_family != PJ_AF_INET &&
+ transportInfo.src_rtp_name.addr.sa_family != PJ_AF_INET6)
+ {
+ return mImpl->mSinkStateItem->mRemoteAddress;
+ }
+
+ char tmp_addr[PJ_INET6_ADDRSTRLEN];
+ return pj_sockaddr_print(&transportInfo.src_rtp_name, tmp_addr, sizeof(tmp_addr), 0);
}
/**
@@ -223,8 +229,13 @@ Ice::Int StreamSinkRTPImpl::getRemotePort(const Ice::Current&)
pjmedia_transport_info_init(&transportInfo);
pjmedia_transport_get_info(mImpl->mSession->getTransport(), &transportInfo);
- int port = pj_ntohs(transportInfo.src_rtp_name.ipv4.sin_port);
- return (port != 0) ? port : mImpl->mSinkStateItem->mRemotePort;
+ if (transportInfo.src_rtp_name.addr.sa_family != PJ_AF_INET &&
+ transportInfo.src_rtp_name.addr.sa_family != PJ_AF_INET6)
+ {
+ return mImpl->mSinkStateItem->mRemotePort;
+ }
+
+ return pj_sockaddr_get_port(&transportInfo.src_rtp_name);
}
/**
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 3c0539a..e426c4f 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -142,7 +142,8 @@ std::string StreamSourceRTPImpl::getLocalAddress(const Ice::Current&)
pjmedia_transport_info_init(&transportInfo);
pjmedia_transport_get_info(mImpl->mSession->getTransport(), &transportInfo);
- return pj_inet_ntoa(transportInfo.sock_info.rtp_addr_name.ipv4.sin_addr);
+ char tmp_addr[PJ_INET6_ADDRSTRLEN];
+ return pj_sockaddr_print(&transportInfo.sock_info.rtp_addr_name, tmp_addr, sizeof(tmp_addr), 0);
}
/**
@@ -155,7 +156,7 @@ Ice::Int StreamSourceRTPImpl::getLocalPort(const Ice::Current&)
pjmedia_transport_info_init(&transportInfo);
pjmedia_transport_get_info(mImpl->mSession->getTransport(), &transportInfo);
- return pj_ntohs(transportInfo.sock_info.rtp_addr_name.ipv4.sin_port);
+ return pj_sockaddr_get_port(&transportInfo.sock_info.rtp_addr_name);
}
/**
@@ -234,24 +235,42 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
*/
void StreamSourceRTPImpl::setRemoteDetails(const string& address, Ice::Int port)
{
- pj_sockaddr_in sin;
+ pj_sockaddr addr;
/* This feels so dirty but convert from our std::string to a pj_str, since their API requires it. */
pj_str_t tmpAddress;
pj_strset(&tmpAddress, (char*)address.c_str(), address.size());
- /* Now for the next trick - convert into a pj_sockaddr_in so we can pass it to pjmedia_transport_attach */
- pj_sockaddr_in_init(&sin, &tmpAddress, (pj_uint16_t) port);
+ /* Now for the next trick - convert into a pj_sockaddr so we can pass it to pjmedia_transport_attach */
+ pj_status_t status = pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &tmpAddress, &addr);
+
+ if (status != PJ_SUCCESS)
+ {
+ throw InvalidAddress();
+ }
+
+ // Confirm that the address family of the address matches that of this RTP session
+ pjmedia_transport_info transportInfo;
+
+ pjmedia_transport_info_init(&transportInfo);
+ pjmedia_transport_get_info(mImpl->mSession->getTransport(), &transportInfo);
+
+ if (transportInfo.sock_info.rtp_addr_name.addr.sa_family != addr.addr.sa_family)
+ {
+ throw InvalidAddress();
+ }
+
+ pj_sockaddr_set_port(&addr, static_cast<pj_uint16_t>(port));
/* In case we were already attached go ahead and detach */
pjmedia_transport_detach(mImpl->mSession->getTransport(), this);
/* All ready... actually do it! */
- pj_status_t status = pjmedia_transport_attach(mImpl->mSession->getTransport(), this, &sin, NULL, sizeof(pj_sockaddr_in), &receiveRTP, NULL);
+ status = pjmedia_transport_attach(mImpl->mSession->getTransport(), this, &addr, NULL, sizeof(pj_sockaddr), &receiveRTP, NULL);
if (status != PJ_SUCCESS)
{
- /* TODO: Decide what to do if this occurs, do we need an exception? */
+ throw InvalidAddress();
}
}
diff --git a/src/RtpStateReplicatorListener.cpp b/src/RtpStateReplicatorListener.cpp
index a42c7b5..16789d0 100644
--- a/src/RtpStateReplicatorListener.cpp
+++ b/src/RtpStateReplicatorListener.cpp
@@ -83,6 +83,7 @@ public:
void visitRtpGeneralStateItem(const RtpGeneralStateItemPtr &item)
{
mImpl->mGeneralState->mServiceManagement = item->mServiceManagement;
+ mImpl->mGeneralState->mComparatorId = item->mComparatorId;
}
void visitRtpSessionStateItem(const RtpSessionStateItemPtr &item)
@@ -98,7 +99,7 @@ public:
RTPSessionImplPtr localSession =
new RTPSessionImpl(mImpl->mAdapter, mImpl->mPoolFactory, item->mSessionIdentity,
- item->mSinkIdentity, item->mSourceIdentity, item->mPort, item->mFormats);
+ item->mSinkIdentity, item->mSourceIdentity, item->mPort, item->mFormats, item->mIPv6);
localitem->setSession(localSession);
}
else
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c82fb29..f65d5b2 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -9,7 +9,16 @@ asterisk_scf_component_add_boost_libraries(media_rtp_pjmedia_test unit_test_fram
asterisk_scf_component_build_icebox(media_rtp_pjmedia_test)
target_link_libraries(media_rtp_pjmedia_test asterisk-scf-api)
+add_definitions(-DIPV6_TEST)
+asterisk_scf_component_init(media_rtp_pjmedia_test_v6)
+asterisk_scf_component_add_file(media_rtp_pjmedia_test_v6 TestRTPpjmedia.cpp)
+asterisk_scf_component_add_slice(media_rtp_pjmedia_test_v6 ../local-slice/RtpStateReplicationIf.ice)
+asterisk_scf_component_add_boost_libraries(media_rtp_pjmedia_test_v6 unit_test_framework thread date_time)
+asterisk_scf_component_build_icebox(media_rtp_pjmedia_test_v6)
+target_link_libraries(media_rtp_pjmedia_test_v6 asterisk-scf-api)
+
# integration test
if(integrated_build STREQUAL "true")
asterisk_scf_test_icebox(media_rtp_pjmedia_test config/test_component.config)
+ asterisk_scf_test_icebox(media_rtp_pjmedia_test_v6 config/test_component.config)
endif()
diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index a13f157..9d5ce18 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -13,7 +13,11 @@
* the GNU General Public License Version 2. See the LICENSE.txt file
* at the top of the source tree.
*/
+#ifdef IPV6_TEST
+#define BOOST_TEST_MODULE RTPpjmediaTestSuitev6
+#else
#define BOOST_TEST_MODULE RTPpjmediaTestSuite
+#endif
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>
@@ -313,7 +317,7 @@ BOOST_AUTO_TEST_CASE(ServiceFoundUsingName)
bool found = false;
try {
- ServiceLocatorParamsPtr params = new ServiceLocatorParams();
+ RTPServiceLocatorParamsPtr params = new RTPServiceLocatorParams();
params->category = "rtp";
Testbed.locator->locate(params);
@@ -396,6 +400,8 @@ BOOST_AUTO_TEST_CASE(CheckReplicatedGeneralStateItem)
}
BOOST_CHECK(Testbed.mListener->mGeneral);
+ BOOST_CHECK(Testbed.mListener->mGeneral->mServiceManagement);
+ BOOST_CHECK(Testbed.mListener->mGeneral->mComparatorId.size());
}
/**
@@ -407,8 +413,11 @@ BOOST_AUTO_TEST_CASE(AllocateRTPSession)
try
{
- ServiceLocatorParamsPtr params = new ServiceLocatorParams();
+ RTPServiceLocatorParamsPtr params = new RTPServiceLocatorParams();
params->category = "rtp";
+#ifdef IPV6_TEST
+ params->ipv6 = true;
+#endif
RTPMediaServicePrx service = RTPMediaServicePrx::uncheckedCast(Testbed.locator->locate(params));
@@ -422,7 +431,7 @@ BOOST_AUTO_TEST_CASE(AllocateRTPSession)
// You might think "geez, this should deadlock due to state replication" but no, we use one ways for that
boost::mutex::scoped_lock lock(Testbed.mLock);
- Testbed.session = service->allocate(formats);
+ Testbed.session = service->allocate(params);
// Give the RTP component time to replicate this session
Testbed.mCondition.wait(lock);
@@ -449,6 +458,12 @@ BOOST_AUTO_TEST_CASE(ConfirmInitialReplicatedRTPSession)
BOOST_CHECK(Testbed.mListener->mSession);
BOOST_CHECK(Testbed.mListener->mSession->mSessionIdentity == Testbed.session->ice_getIdentity());
+#ifdef IPV6_TEST
+ BOOST_CHECK(Testbed.mListener->mSession->mIPv6 == true);
+#else
+ BOOST_CHECK(Testbed.mListener->mSession->mIPv6 == false);
+#endif
+
StreamSinkSeq sinks = Testbed.session->getSinks();
StreamSinkRTPPrx sink = StreamSinkRTPPrx::uncheckedCast(sinks.front());
BOOST_CHECK(Testbed.mListener->mSession->mSinkIdentity == sink->ice_getIdentity());
@@ -669,9 +684,14 @@ BOOST_AUTO_TEST_CASE(ConfirmRemoteAddressSetting)
{
StreamSinkRTPPrx sink = StreamSinkRTPPrx::checkedCast((*i));
- sink->setRemoteDetails("127.0.0.1", 10000);
+#ifdef IPV6_TEST
+ std::string address = "::1";
+#else
+ std::string address = "127.0.0.1";
+#endif
+ sink->setRemoteDetails(address, 10000);
- if (sink->getRemoteAddress() == "127.0.0.1" && sink->getRemotePort() == 10000)
+ if (sink->getRemoteAddress() == address && sink->getRemotePort() == 10000)
{
set = true;
}
@@ -952,8 +972,11 @@ BOOST_AUTO_TEST_CASE(ReceiveUnknownRTPPacket)
try
{
- ServiceLocatorParamsPtr params = new ServiceLocatorParams();
+ RTPServiceLocatorParamsPtr params = new RTPServiceLocatorParams();
params->category = "rtp";
+#ifdef IPV6_TEST
+ params->ipv6 = true;
+#endif
RTPMediaServicePrx service = RTPMediaServicePrx::uncheckedCast(Testbed.locator->locate(params));
@@ -964,7 +987,7 @@ BOOST_AUTO_TEST_CASE(ReceiveUnknownRTPPacket)
FormatSeq formats;
formats.push_back(format);
- RTPSessionPrx session = service->allocate(formats);
+ RTPSessionPrx session = service->allocate(params);
PayloadMap mapping;
mapping.insert(make_pair(13, format));
@@ -1017,6 +1040,45 @@ BOOST_AUTO_TEST_CASE(ReceiveUnknownRTPPacket)
}
/**
+ * Attempt to set a valid but address family invalid address on an RTP sink
+ */
+BOOST_AUTO_TEST_CASE(SetInvalidAddressFamilyAddress)
+{
+ bool set = false;
+
+ try
+ {
+ StreamSinkSeq sinks = Testbed.session->getSinks();
+
+ for (StreamSinkSeq::const_iterator i = sinks.begin(); i != sinks.end(); ++i)
+ {
+ StreamSinkRTPPrx sink = StreamSinkRTPPrx::checkedCast((*i));
+
+ /* No, these are not accidentally reversed. We want to try to set an IPv4 address
+ * on an IPv6 sink and vice versa to make sure that an exception does get thrown.
+ */
+#ifdef IPV6_TEST
+ sink->setRemoteDetails("127.0.0.1", 10000);
+#else
+ sink->setRemoteDetails("::1", 10000);
+#endif
+
+ set = true;
+ }
+ }
+ catch (const Ice::Exception &e)
+ {
+ BOOST_TEST_MESSAGE(e.ice_name());
+ BOOST_TEST_MESSAGE(e.what());
+ }
+ catch (...)
+ {
+ }
+
+ BOOST_CHECK(!set);
+}
+
+/**
* Attempt to release our RTP session
*/
BOOST_AUTO_TEST_CASE(ReleaseRTPSession)
-----------------------------------------------------------------------
--
asterisk-scf/integration/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list