[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "replication-new" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Jan 21 10:50:14 CST 2011
branch "replication-new" has been created
at aa7bb69a4f986fa9eb7fb5ec59e4da12d1d33a67 (commit)
- Log -----------------------------------------------------------------
commit aa7bb69a4f986fa9eb7fb5ec59e4da12d1d33a67
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Fri Jan 21 10:49:34 2011 -0600
Make changes that the rebase operation missed for some reason.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 28d5c43..a60eae4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,7 +38,6 @@ if(NOT integrated_build STREQUAL "true")
set(integrated_build false)
endif()
-add_subdirectory(local-slice)
add_subdirectory(src)
add_subdirectory(config)
add_subdirectory(test)
diff --git a/local-slice/CMakeLists.txt b/local-slice/CMakeLists.txt
deleted file mode 100644
index bc354ab..0000000
--- a/local-slice/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-asterisk_scf_slice_include_directories("${CMAKE_SOURCE_DIR}/slice")
-asterisk_scf_compile_slice(RtpStateReplicationIf.ice lib "RTP State Replicator" media_rtp_pjmedia)
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index d7a52c5..fe56ad6 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -18,9 +18,9 @@
#include <Ice/BuiltinSequences.ice>
#include <Ice/Identity.ice>
-#include "Media/MediaIf.ice"
-#include "Media/RTP/MediaRTPIf.ice"
-#include "Core/Discovery/ServiceLocatorIf.ice"
+#include <AsteriskSCF/Media/MediaIf.ice>
+#include <AsteriskSCF/Media/RTP/MediaRTPIf.ice>
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice>
module AsteriskSCF
{
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ed3fe2d..911e885 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,14 +1,21 @@
#
# Asterisk Scalable Communications Framework
#
-# Copyright (C) 2010 -- Digium, Inc.
+# Copyright (C) 2010-2011 -- Digium, Inc.
#
# All rights reserved.
#
+asterisk_scf_slice_include_directories(${API_SLICE_DIR})
+include_directories(${API_INCLUDE_DIR})
+
+if(NOT logger_dir)
+ message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
+endif()
-include_directories(${utils_dir}/StateReplicator/src)
-include_directories(${utils_dir}/SmartProxy/src)
+include_directories(${logger_dir}/include)
+include_directories(${utils_dir}/StateReplicator/include)
+include_directories(${utils_dir}/SmartProxy/include)
asterisk_scf_component_init(media_rtp_pjmedia CXX)
asterisk_scf_component_add_file(media_rtp_pjmedia MediaRTPpjmedia.cpp)
@@ -20,14 +27,8 @@ asterisk_scf_component_add_file(media_rtp_pjmedia RTPSource.h)
asterisk_scf_component_add_file(media_rtp_pjmedia RTPSink.h)
asterisk_scf_component_add_file(media_rtp_pjmedia RtpStateReplicatorListener.cpp)
asterisk_scf_component_add_file(media_rtp_pjmedia RtpStateReplicator.h)
+asterisk_scf_component_add_slice(media_rtp_pjmedia ../local-slice/RtpStateReplicationIf.ice)
asterisk_scf_component_add_boost_libraries(media_rtp_pjmedia core thread)
-
-if(NOT logger_dir)
- message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
-endif()
-include_directories(${logger_dir}/include)
-include_directories(${API_INCLUDE_DIR})
-
asterisk_scf_component_build_icebox(media_rtp_pjmedia)
target_link_libraries(media_rtp_pjmedia logging-client)
target_link_libraries(media_rtp_pjmedia asterisk-scf-api)
@@ -35,23 +36,13 @@ pjproject_link(media_rtp_pjmedia pjlib)
pjproject_link(media_rtp_pjmedia pjlib-util)
pjproject_link(media_rtp_pjmedia pjmedia)
pjproject_link(media_rtp_pjmedia pjnath)
-
asterisk_scf_component_install(media_rtp_pjmedia)
asterisk_scf_component_init(RtpStateReplicator CXX)
-
-asterisk_scf_component_add_slice(RtpStateReplicator ServiceLocatorIf)
-asterisk_scf_component_add_slice(RtpStateReplicator ComponentServiceIf)
-asterisk_scf_component_add_slice(RtpStateReplicator RtpStateReplicationIf)
-asterisk_scf_component_add_slice(RtpStateReplicator RoutingIf)
-asterisk_scf_component_add_slice(RtpStateReplicator MediaRTPIf)
-
asterisk_scf_component_add_file(RtpStateReplicator RtpStateReplicatorApp.cpp)
asterisk_scf_component_add_file(RtpStateReplicator RtpStateReplicator.h)
-
+asterisk_scf_component_add_slice(RtpStateReplicator ../local-slice/RtpStateReplicationIf.ice)
asterisk_scf_component_add_ice_libraries(RtpStateReplicator IceStorm)
-
asterisk_scf_component_add_boost_libraries(RtpStateReplicator thread date_time)
-
asterisk_scf_component_build_icebox(RtpStateReplicator)
target_link_libraries(RtpStateReplicator logging-client)
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 6405c98..4a1d0ee 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -27,12 +27,12 @@
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
#include <AsteriskSCF/Logger/IceLogger.h>
#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicationIf.h"
-#include "ReplicaIf.h"
-#include "SmartProxy.h"
#include "RTPSession.h"
#include "RtpStateReplicator.h"
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 234781d..5e7f33e 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -22,10 +22,10 @@
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
+#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicationIf.h"
-#include "ReplicaIf.h"
-#include "SmartProxy.h"
#include "RTPSession.h"
#include "RTPSource.h"
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index 580f62a..e20f86d 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -22,10 +22,10 @@
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
+#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicationIf.h"
-#include "ReplicaIf.h"
-#include "SmartProxy.h"
#include "RTPSession.h"
#include "RTPSink.h"
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 1c1c608..3b5d1ba 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -22,11 +22,12 @@
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
+#include <AsteriskSCF/Logger/IceLogger.h>
#include <AsteriskSCF/logger.h>
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
+#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicationIf.h"
-#include "ReplicaIf.h"
-#include "SmartProxy.h"
#include "RTPSession.h"
#include "RTPSource.h"
diff --git a/src/RtpStateReplicator.h b/src/RtpStateReplicator.h
index d3bc6c9..34dc017 100644
--- a/src/RtpStateReplicator.h
+++ b/src/RtpStateReplicator.h
@@ -17,8 +17,10 @@
#pragma once
#include <Ice/Ice.h>
+
+#include <AsteriskSCF/StateReplicator.h>
+
#include "RtpStateReplicationIf.h"
-#include "StateReplicator.h"
using namespace AsteriskSCF::Media::RTP::V1;
diff --git a/src/RtpStateReplicatorApp.cpp b/src/RtpStateReplicatorApp.cpp
index 2b49c1b..6fa76d9 100644
--- a/src/RtpStateReplicatorApp.cpp
+++ b/src/RtpStateReplicatorApp.cpp
@@ -21,11 +21,12 @@
#include <pjlib.h>
-#include "ServiceLocatorIf.h"
-#include "ComponentServiceIf.h"
+#include <AsteriskSCF/Core/Discovery/ServiceLocatorIf.h>
+#include <AsteriskSCF/System/Component/ComponentServiceIf.h>
+#include <AsteriskSCF/Logger/IceLogger.h>
+#include <AsteriskSCF/logger.h>
+
#include "RtpStateReplicator.h"
-#include "IceLogger.h"
-#include "logger.h"
using namespace std;
using namespace AsteriskSCF::Core;
diff --git a/src/RtpStateReplicatorListener.cpp b/src/RtpStateReplicatorListener.cpp
index f11b9d7..58da256 100644
--- a/src/RtpStateReplicatorListener.cpp
+++ b/src/RtpStateReplicatorListener.cpp
@@ -22,8 +22,8 @@
#include <pjlib.h>
#include <pjmedia.h>
-#include "ReplicaIf.h"
-#include "SmartProxy.h"
+#include <AsteriskSCF/System/Component/ReplicaIf.h>
+#include <AsteriskSCF/SmartProxy.h>
#include "RtpStateReplicator.h"
#include "RTPSession.h"
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 6876f33..48a9ec5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -6,10 +6,13 @@
# All rights reserved.
#
+asterisk_scf_slice_include_directories(${API_SLICE_DIR})
+include_directories(${API_INCLUDE_DIR})
+
asterisk_scf_component_init(media_rtp_pjmedia_test CXX)
asterisk_scf_component_add_file(media_rtp_pjmedia_test TestRTPpjmedia.cpp)
+asterisk_scf_component_add_slice(media_rtp_pjmedia_test ../local-slice/RtpStateReplicationIf.ice)
asterisk_scf_component_add_boost_libraries(media_rtp_pjmedia_test unit_test_framework thread date_time)
-include_directories(${API_INCLUDE_DIR})
asterisk_scf_component_build_icebox(media_rtp_pjmedia_test)
target_link_libraries(media_rtp_pjmedia_test asterisk-scf-api)
commit 8a4656cdef37099e4750923ab9fc9e0264093418
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Tue Jan 4 15:56:25 2011 -0600
Update to be compatible with recent logger changes.
diff --git a/src/RtpStateReplicatorApp.cpp b/src/RtpStateReplicatorApp.cpp
index 8fffef6..2b49c1b 100644
--- a/src/RtpStateReplicatorApp.cpp
+++ b/src/RtpStateReplicatorApp.cpp
@@ -36,7 +36,7 @@ using namespace AsteriskSCF::Media::RTP::V1;
namespace
{
-Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.MediaRTP");
+Logger lg = getLoggerFactory().getLogger("AsteriskSCF.MediaRTP");
}
class RtpStateReplicatorService : public IceBox::Service
commit 3ca3d37f177f5b871dc057efbf3ce363b6aa6793
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Tue Jan 4 09:09:25 2011 -0600
Avoid MCPP bug by using C-style comments.
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index 2dbbeed..d7a52c5 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -96,10 +96,10 @@ module V1
{
AsteriskSCF::Media::V1::StreamSink *mSink;
};
-}; // module V1
+}; /* module V1 */
-}; // module RTP
+}; /* module RTP */
-}; // module Media
+}; /* module Media */
-}; // module Asterisk SCF
+}; /* module Asterisk SCF */
commit bbaf845c0d8b57f4fcf282281bd0c5919f5564a2
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Thu Dec 30 16:47:34 2010 -0600
Use new translator support for visitors
diff --git a/local-slice/CMakeLists.txt b/local-slice/CMakeLists.txt
index 4f25cf4..bc354ab 100644
--- a/local-slice/CMakeLists.txt
+++ b/local-slice/CMakeLists.txt
@@ -1,2 +1,2 @@
asterisk_scf_slice_include_directories("${CMAKE_SOURCE_DIR}/slice")
-asterisk_scf_compile_slice(RtpStateReplicationIf lib "RTP State Replicator" media_rtp_pjmedia SOURCES RtpStateReplicationIf.ice RtpStateItemHelpers.ice RtpStateItemHelpersImpl.h RtpStateItemHelpersImpl.cpp)
+asterisk_scf_compile_slice(RtpStateReplicationIf.ice lib "RTP State Replicator" media_rtp_pjmedia)
diff --git a/local-slice/RtpStateItemHelpers.ice b/local-slice/RtpStateItemHelpers.ice
deleted file mode 100644
index 455869c..0000000
--- a/local-slice/RtpStateItemHelpers.ice
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 "RtpStateReplicationIf.ice"
-
-[["cpp:include:RtpStateItemHelpersImpl.h"]]
-
-module AsteriskSCF
-{
-
-module Media
-{
-
-module RTP
-{
-
-["suppress"]
-module V1
-{
-
-module StateItemHelpers
-{
- // This module is intentionally left empty, as its contents
- // cannot be defined in the Slice language. However, its
- // contents should be provided to all users of the RTPStateItem
- // mechanism, written in each language that is supported. Those
- // implementations will be available in companion files in the
- // same directory as this one. For C++, the helpers will be
- // automatically brought into the program by the inclusion
- // of the RtpStateItemHelpers.h file above.
-}; // module StateItemHelpers
-
-}; // module V1
-
-}; // module RTP
-
-}; // module Media
-
-}; // module Asterisk SCF
diff --git a/local-slice/RtpStateItemHelpersImpl.cpp b/local-slice/RtpStateItemHelpersImpl.cpp
deleted file mode 100644
index 5acc233..0000000
--- a/local-slice/RtpStateItemHelpersImpl.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-
-#include <Ice/Ice.h>
-
-#include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
-
-using namespace AsteriskSCF::Media::RTP::V1;
-
-namespace AsteriskSCF
-{
-
-namespace Media
-{
-
-namespace RTP
-{
-
-namespace V1
-{
-
-namespace StateItemHelpers
-{
-
-template <typename T>
-class factory : public Ice::ObjectFactory
-{
-public:
- virtual Ice::ObjectPtr create(const std::string &)
- {
- return new T();
- }
-
- virtual void destroy()
- {
- }
-};
-
-void registerObjectFactory(const Ice::CommunicatorPtr &communicator)
-{
- communicator->addObjectFactory(new factory<RtpStateItemImpl>(), RtpStateItem::ice_staticId());
- communicator->addObjectFactory(new factory<RtpGeneralStateItemImpl>(), RtpGeneralStateItem::ice_staticId());
- communicator->addObjectFactory(new factory<RtpSessionStateItemImpl>(), RtpSessionStateItem::ice_staticId());
- communicator->addObjectFactory(new factory<RtpStreamSourceStateItemImpl>(), RtpStreamSourceStateItem::ice_staticId());
- communicator->addObjectFactory(new factory<RtpStreamSinkStateItemImpl>(), RtpStreamSinkStateItem::ice_staticId());
-}
-
-void RtpStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
-}
-
-RtpStateItemPtr newRtpStateItem(void)
-{
- return new RtpStateItemImpl();
-}
-
-void RtpGeneralStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
- visitor->visitGeneral(this);
-}
-
-RtpGeneralStateItemPtr newRtpGeneralStateItem(void)
-{
- return new RtpGeneralStateItemImpl();
-}
-
-void RtpSessionStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
- visitor->visitSession(this);
-}
-
-RtpSessionStateItemPtr newRtpSessionStateItem(void)
-{
- return new RtpSessionStateItemImpl();
-}
-
-void RtpStreamSourceStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
- visitor->visitStreamSource(this);
-}
-
-RtpStreamSourceStateItemPtr newRtpStreamSourceStateItem(void)
-{
- return new RtpStreamSourceStateItemImpl();
-}
-
-void RtpStreamSinkStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
-{
- visitor->visitStreamSink(this);
-}
-
-RtpStreamSinkStateItemPtr newRtpStreamSinkStateItem(void)
-{
- return new RtpStreamSinkStateItemImpl();
-}
-
-} // namespace StateItemHelpers
-
-} // namespace V1
-
-} // namespace RTP
-
-} // namespace Media
-
-} // namespace AsteriskSCF
diff --git a/local-slice/RtpStateItemHelpersImpl.h b/local-slice/RtpStateItemHelpersImpl.h
deleted file mode 100644
index 5621760..0000000
--- a/local-slice/RtpStateItemHelpersImpl.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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
-
-namespace AsteriskSCF
-{
-
-namespace Media
-{
-
-namespace RTP
-{
-
-namespace V1
-{
-
-namespace StateItemHelpers
-{
-
-void registerObjectFactory(const Ice::CommunicatorPtr &communicator);
-
-class RtpStateItemImpl : public RtpStateItem
-{
-public:
- void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpStateItemPtr newRtpStateItem(void);
-
-class RtpGeneralStateItemImpl : public RtpGeneralStateItem
-{
-public:
- void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpGeneralStateItemPtr newRtpGeneralStateItem(void);
-
-class RtpSessionStateItemImpl : public RtpSessionStateItem
-{
-public:
- void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpSessionStateItemPtr newRtpSessionStateItem(void);
-
-class RtpStreamSourceStateItemImpl : public RtpStreamSourceStateItem
-{
-public:
- void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpStreamSourceStateItemPtr newRtpStreamSourceStateItem(void);
-
-class RtpStreamSinkStateItemImpl : public RtpStreamSinkStateItem
-{
-public:
- void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
-};
-
-RtpStreamSinkStateItemPtr newRtpStreamSinkStateItem(void);
-
-} // namespace StateItemHelpers
-
-} // namespace V1
-
-} // namespace RTP
-
-} // namespace Media
-
-} // namespace AsteriskSCF
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index 49d2dc5..2dbbeed 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -34,75 +34,68 @@ module RTP
["suppress"]
module V1
{
- const string StateReplicatorComponentCategory = "RtpStateReplicatorComponent";
- const string StateReplicatorDiscoveryCategory = "RtpStateReplicator";
-
- class RtpStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
- {
- string mName;
- };
-
- interface RtpStateItemVisitor;
-
- class RtpStateItem
- {
- string key;
- string mSessionId;
- void visit(RtpStateItemVisitor visitor);
- };
-
- sequence<RtpStateItem> RtpStateItemSeq;
-
- interface RtpStateReplicatorListener
- {
- void stateRemoved(Ice::StringSeq itemKeys);
- void stateSet(RtpStateItemSeq items);
- };
-
- interface RtpStateReplicator
- {
- void addListener(RtpStateReplicatorListener *listener);
- void removeListener(RtpStateReplicatorListener *listener);
- void setState (RtpStateItemSeq items);
- void removeState(Ice::StringSeq items);
- idempotent RtpStateItemSeq getState(Ice::StringSeq itemKeys);
- idempotent RtpStateItemSeq getAllState();
- };
-
- class RtpGeneralStateItem extends RtpStateItem
- {
- AsteriskSCF::Core::Discovery::V1::ServiceManagement *mServiceManagement;
- };
-
- class RtpSessionStateItem extends RtpStateItem
- {
- Ice::Identity mSessionIdentity;
- int mPort;
- Ice::Identity mSinkIdentity;
- Ice::Identity mSourceIdentity;
- AsteriskSCF::Media::V1::FormatSeq mFormats;
- PayloadMap mPayloadstoFormats;
- };
-
- class RtpStreamSinkStateItem extends RtpStateItem
- {
- AsteriskSCF::Media::V1::StreamSource *mSource;
- string mRemoteAddress;
- int mRemotePort;
- };
-
- class RtpStreamSourceStateItem extends RtpStateItem
- {
- AsteriskSCF::Media::V1::StreamSink *mSink;
- };
-
- interface RtpStateItemVisitor
- {
- void visitGeneral(RtpGeneralStateItem item);
- void visitSession(RtpSessionStateItem item);
- void visitStreamSink(RtpStreamSinkStateItem item);
- void visitStreamSource(RtpStreamSourceStateItem item);
- };
+ const string StateReplicatorComponentCategory = "RtpStateReplicatorComponent";
+ const string StateReplicatorDiscoveryCategory = "RtpStateReplicator";
+
+ class RtpStateReplicatorParams extends AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams
+ {
+ string mName;
+ };
+
+ ["visitor"] local class RtpStateItemVisitor
+ {
+ };
+
+ ["visitor:::AsteriskSCF::Media::RTP::V1::RtpStateItemVisitor"] class RtpStateItem
+ {
+ string key;
+ string mSessionId;
+ };
+
+ sequence<RtpStateItem> RtpStateItemSeq;
+
+ interface RtpStateReplicatorListener
+ {
+ void stateRemoved(Ice::StringSeq itemKeys);
+ void stateSet(RtpStateItemSeq items);
+ };
+
+ interface RtpStateReplicator
+ {
+ void addListener(RtpStateReplicatorListener *listener);
+ void removeListener(RtpStateReplicatorListener *listener);
+ void setState (RtpStateItemSeq items);
+ void removeState(Ice::StringSeq items);
+ idempotent RtpStateItemSeq getState(Ice::StringSeq itemKeys);
+ idempotent RtpStateItemSeq getAllState();
+ };
+
+ class RtpGeneralStateItem extends RtpStateItem
+ {
+ AsteriskSCF::Core::Discovery::V1::ServiceManagement *mServiceManagement;
+ };
+
+ class RtpSessionStateItem extends RtpStateItem
+ {
+ Ice::Identity mSessionIdentity;
+ int mPort;
+ Ice::Identity mSinkIdentity;
+ Ice::Identity mSourceIdentity;
+ AsteriskSCF::Media::V1::FormatSeq mFormats;
+ PayloadMap mPayloadstoFormats;
+ };
+
+ class RtpStreamSinkStateItem extends RtpStateItem
+ {
+ AsteriskSCF::Media::V1::StreamSource *mSource;
+ string mRemoteAddress;
+ int mRemotePort;
+ };
+
+ class RtpStreamSourceStateItem extends RtpStateItem
+ {
+ AsteriskSCF::Media::V1::StreamSink *mSink;
+ };
}; // module V1
}; // module RTP
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 6a86ee0..6405c98 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -31,7 +31,6 @@
#include <AsteriskSCF/logger.h>
#include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
#include "ReplicaIf.h"
#include "SmartProxy.h"
@@ -162,7 +161,7 @@ private:
class MediaRTPpjmediaApp : public IceBox::Service
{
public:
- MediaRTPpjmediaApp() : mGeneralState(StateItemHelpers::newRtpGeneralStateItem()) { mGeneralState->key = IceUtil::generateUUID(); };
+ MediaRTPpjmediaApp() : mGeneralState(new RtpGeneralStateItem()) { mGeneralState->key = IceUtil::generateUUID(); };
void start(const std::string&, const Ice::CommunicatorPtr&, const Ice::StringSeq&);
void stop();
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index f34ae8b..234781d 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -24,7 +24,6 @@
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
#include "ReplicaIf.h"
#include "SmartProxy.h"
@@ -56,7 +55,7 @@ class RTPSessionImplPriv
{
public:
RTPSessionImplPriv(Ice::ObjectAdapterPtr adapter, const FormatSeq& formats, ReplicaPtr replicaService, AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> stateReplicator) :
- mAdapter(adapter), mFormats(formats), mSessionStateItem(StateItemHelpers::newRtpSessionStateItem()), mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
+ mAdapter(adapter), mFormats(formats), mSessionStateItem(new RtpSessionStateItem()), mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
~RTPSessionImplPriv();
/**
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index 42cab45..580f62a 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -24,7 +24,6 @@
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
#include "ReplicaIf.h"
#include "SmartProxy.h"
@@ -66,7 +65,7 @@ public:
/**
* Constructor for the StreamSinkRTPImplPriv class.
*/
-StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSinkStateItem(StateItemHelpers::newRtpStreamSinkStateItem())
+StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSinkStateItem(new RtpStreamSinkStateItem())
{
pjmedia_rtp_session_init(&mOutgoingSession, 0, pj_rand());
mSinkStateItem->mSessionId = sessionId;
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index d062f39..1c1c608 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -25,7 +25,6 @@
#include <AsteriskSCF/logger.h>
#include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
#include "ReplicaIf.h"
#include "SmartProxy.h"
@@ -73,7 +72,7 @@ public:
/**
* Constructor for the StreamSourceRTPImplPriv class.
*/
-StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSourceStateItem(StateItemHelpers::newRtpStreamSourceStateItem())
+StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSourceStateItem(new RtpStreamSourceStateItem())
{
pjmedia_rtp_session_init(&mIncomingSession, 0, 0);
mSourceStateItem->mSessionId = sessionId;
diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index 035c43b..2d87f8c 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -28,7 +28,6 @@
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include "RtpStateReplicationIf.h"
-#include "RtpStateItemHelpers.h"
using namespace std;
using namespace AsteriskSCF::Core::Discovery::V1;
commit 70949ceea1d0b1d8816446d0b3c76e6a7c980b67
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Wed Dec 29 18:34:52 2010 -0600
Not quite finished, but functional.
This version of the Visitor pattern for RTPStateItem objects contains a
number of improvements over the previous one, primarily that it no longer
requires any Slice translator modifications. In addition, it now includes
the 'boilerplate' stuff, that all users would have to write, in the library
produced by compiling the Slice definitions.
There are still a few rough edges that need some polishing... but it's
almost there.
diff --git a/local-slice/CMakeLists.txt b/local-slice/CMakeLists.txt
index b348049..4f25cf4 100644
--- a/local-slice/CMakeLists.txt
+++ b/local-slice/CMakeLists.txt
@@ -1,3 +1,2 @@
asterisk_scf_slice_include_directories("${CMAKE_SOURCE_DIR}/slice")
-asterisk_scf_compile_slice(RtpStateReplicationIf.ice lib "RTP State Replicator" media_rtp_pjmedia)
-
+asterisk_scf_compile_slice(RtpStateReplicationIf lib "RTP State Replicator" media_rtp_pjmedia SOURCES RtpStateReplicationIf.ice RtpStateItemHelpers.ice RtpStateItemHelpersImpl.h RtpStateItemHelpersImpl.cpp)
diff --git a/local-slice/RtpStateItemHelpers.ice b/local-slice/RtpStateItemHelpers.ice
new file mode 100644
index 0000000..455869c
--- /dev/null
+++ b/local-slice/RtpStateItemHelpers.ice
@@ -0,0 +1,54 @@
+/*
+ * 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 "RtpStateReplicationIf.ice"
+
+[["cpp:include:RtpStateItemHelpersImpl.h"]]
+
+module AsteriskSCF
+{
+
+module Media
+{
+
+module RTP
+{
+
+["suppress"]
+module V1
+{
+
+module StateItemHelpers
+{
+ // This module is intentionally left empty, as its contents
+ // cannot be defined in the Slice language. However, its
+ // contents should be provided to all users of the RTPStateItem
+ // mechanism, written in each language that is supported. Those
+ // implementations will be available in companion files in the
+ // same directory as this one. For C++, the helpers will be
+ // automatically brought into the program by the inclusion
+ // of the RtpStateItemHelpers.h file above.
+}; // module StateItemHelpers
+
+}; // module V1
+
+}; // module RTP
+
+}; // module Media
+
+}; // module Asterisk SCF
diff --git a/local-slice/RtpStateItemHelpersImpl.cpp b/local-slice/RtpStateItemHelpersImpl.cpp
new file mode 100644
index 0000000..5acc233
--- /dev/null
+++ b/local-slice/RtpStateItemHelpersImpl.cpp
@@ -0,0 +1,119 @@
+/*
+ * 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.
+ */
+
+#include <Ice/Ice.h>
+
+#include "RtpStateReplicationIf.h"
+#include "RtpStateItemHelpers.h"
+
+using namespace AsteriskSCF::Media::RTP::V1;
+
+namespace AsteriskSCF
+{
+
+namespace Media
+{
+
+namespace RTP
+{
+
+namespace V1
+{
+
+namespace StateItemHelpers
+{
+
+template <typename T>
+class factory : public Ice::ObjectFactory
+{
+public:
+ virtual Ice::ObjectPtr create(const std::string &)
+ {
+ return new T();
+ }
+
+ virtual void destroy()
+ {
+ }
+};
+
+void registerObjectFactory(const Ice::CommunicatorPtr &communicator)
+{
+ communicator->addObjectFactory(new factory<RtpStateItemImpl>(), RtpStateItem::ice_staticId());
+ communicator->addObjectFactory(new factory<RtpGeneralStateItemImpl>(), RtpGeneralStateItem::ice_staticId());
+ communicator->addObjectFactory(new factory<RtpSessionStateItemImpl>(), RtpSessionStateItem::ice_staticId());
+ communicator->addObjectFactory(new factory<RtpStreamSourceStateItemImpl>(), RtpStreamSourceStateItem::ice_staticId());
+ communicator->addObjectFactory(new factory<RtpStreamSinkStateItemImpl>(), RtpStreamSinkStateItem::ice_staticId());
+}
+
+void RtpStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
+{
+}
+
+RtpStateItemPtr newRtpStateItem(void)
+{
+ return new RtpStateItemImpl();
+}
+
+void RtpGeneralStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
+{
+ visitor->visitGeneral(this);
+}
+
+RtpGeneralStateItemPtr newRtpGeneralStateItem(void)
+{
+ return new RtpGeneralStateItemImpl();
+}
+
+void RtpSessionStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
+{
+ visitor->visitSession(this);
+}
+
+RtpSessionStateItemPtr newRtpSessionStateItem(void)
+{
+ return new RtpSessionStateItemImpl();
+}
+
+void RtpStreamSourceStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
+{
+ visitor->visitStreamSource(this);
+}
+
+RtpStreamSourceStateItemPtr newRtpStreamSourceStateItem(void)
+{
+ return new RtpStreamSourceStateItemImpl();
+}
+
+void RtpStreamSinkStateItemImpl::visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &)
+{
+ visitor->visitStreamSink(this);
+}
+
+RtpStreamSinkStateItemPtr newRtpStreamSinkStateItem(void)
+{
+ return new RtpStreamSinkStateItemImpl();
+}
+
+} // namespace StateItemHelpers
+
+} // namespace V1
+
+} // namespace RTP
+
+} // namespace Media
+
+} // namespace AsteriskSCF
diff --git a/local-slice/RtpStateItemHelpersImpl.h b/local-slice/RtpStateItemHelpersImpl.h
new file mode 100644
index 0000000..5621760
--- /dev/null
+++ b/local-slice/RtpStateItemHelpersImpl.h
@@ -0,0 +1,84 @@
+/*
+ * 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
+
+namespace AsteriskSCF
+{
+
+namespace Media
+{
+
+namespace RTP
+{
+
+namespace V1
+{
+
+namespace StateItemHelpers
+{
+
+void registerObjectFactory(const Ice::CommunicatorPtr &communicator);
+
+class RtpStateItemImpl : public RtpStateItem
+{
+public:
+ void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
+};
+
+RtpStateItemPtr newRtpStateItem(void);
+
+class RtpGeneralStateItemImpl : public RtpGeneralStateItem
+{
+public:
+ void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
+};
+
+RtpGeneralStateItemPtr newRtpGeneralStateItem(void);
+
+class RtpSessionStateItemImpl : public RtpSessionStateItem
+{
+public:
+ void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
+};
+
+RtpSessionStateItemPtr newRtpSessionStateItem(void);
+
+class RtpStreamSourceStateItemImpl : public RtpStreamSourceStateItem
+{
+public:
+ void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
+};
+
+RtpStreamSourceStateItemPtr newRtpStreamSourceStateItem(void);
+
+class RtpStreamSinkStateItemImpl : public RtpStreamSinkStateItem
+{
+public:
+ void visit(const RtpStateItemVisitorPtr &visitor, const Ice::Current &);
+};
+
+RtpStreamSinkStateItemPtr newRtpStreamSinkStateItem(void);
+
+} // namespace StateItemHelpers
+
+} // namespace V1
+
+} // namespace RTP
+
+} // namespace Media
+
+} // namespace AsteriskSCF
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index aed5cf4..49d2dc5 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -42,13 +42,13 @@ module V1
string mName;
};
- local interface RtpStateItemVisitor;
+ interface RtpStateItemVisitor;
class RtpStateItem
{
string key;
string mSessionId;
- /* local void visit(RtpStateItemVisitor *visitor) ;*/
+ void visit(RtpStateItemVisitor visitor);
};
sequence<RtpStateItem> RtpStateItemSeq;
@@ -96,24 +96,17 @@ module V1
AsteriskSCF::Media::V1::StreamSink *mSink;
};
-/*
- Cannot use this method yet because the member function
- signatures are written to accept proxy pointers to the
- concrete class objects, not local object pointers
-
- local interface RtpStateItemVisitor
+ interface RtpStateItemVisitor
{
- void visitGeneral(RtpGeneralStateItem *item);
- void visitSession(RtpSessionStateItem *item);
- void visitStreamSink(RtpStreamSinkStateItem *item);
- void visitStreamSource(RtpStreamSourceStateItem *item);
+ void visitGeneral(RtpGeneralStateItem item);
+ void visitSession(RtpSessionStateItem item);
+ void visitStreamSink(RtpStreamSinkStateItem item);
+ void visitStreamSource(RtpStreamSourceStateItem item);
};
-*/
-
-}; //module V1
+}; // module V1
-}; //module RTP
+}; // module RTP
-}; //module Media
+}; // module Media
-}; //module Asterisk SCF
+}; // module Asterisk SCF
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 6405c98..6a86ee0 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -31,6 +31,7 @@
#include <AsteriskSCF/logger.h>
#include "RtpStateReplicationIf.h"
+#include "RtpStateItemHelpers.h"
#include "ReplicaIf.h"
#include "SmartProxy.h"
@@ -161,7 +162,7 @@ private:
class MediaRTPpjmediaApp : public IceBox::Service
{
public:
- MediaRTPpjmediaApp() : mGeneralState(new RtpGeneralStateItem()) { mGeneralState->key = IceUtil::generateUUID(); };
+ MediaRTPpjmediaApp() : mGeneralState(StateItemHelpers::newRtpGeneralStateItem()) { mGeneralState->key = IceUtil::generateUUID(); };
void start(const std::string&, const Ice::CommunicatorPtr&, const Ice::StringSeq&);
void stop();
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 234781d..f34ae8b 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -24,6 +24,7 @@
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include "RtpStateReplicationIf.h"
+#include "RtpStateItemHelpers.h"
#include "ReplicaIf.h"
#include "SmartProxy.h"
@@ -55,7 +56,7 @@ class RTPSessionImplPriv
{
public:
RTPSessionImplPriv(Ice::ObjectAdapterPtr adapter, const FormatSeq& formats, ReplicaPtr replicaService, AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> stateReplicator) :
- mAdapter(adapter), mFormats(formats), mSessionStateItem(new RtpSessionStateItem()), mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
+ mAdapter(adapter), mFormats(formats), mSessionStateItem(StateItemHelpers::newRtpSessionStateItem()), mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
~RTPSessionImplPriv();
/**
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index 580f62a..42cab45 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -24,6 +24,7 @@
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include "RtpStateReplicationIf.h"
+#include "RtpStateItemHelpers.h"
#include "ReplicaIf.h"
#include "SmartProxy.h"
@@ -65,7 +66,7 @@ public:
/**
* Constructor for the StreamSinkRTPImplPriv class.
*/
-StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSinkStateItem(new RtpStreamSinkStateItem())
+StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSinkStateItem(StateItemHelpers::newRtpStreamSinkStateItem())
{
pjmedia_rtp_session_init(&mOutgoingSession, 0, pj_rand());
mSinkStateItem->mSessionId = sessionId;
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 1c1c608..d062f39 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -25,6 +25,7 @@
#include <AsteriskSCF/logger.h>
#include "RtpStateReplicationIf.h"
+#include "RtpStateItemHelpers.h"
#include "ReplicaIf.h"
#include "SmartProxy.h"
@@ -72,7 +73,7 @@ public:
/**
* Constructor for the StreamSourceRTPImplPriv class.
*/
-StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSourceStateItem(new RtpStreamSourceStateItem())
+StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSourceStateItem(StateItemHelpers::newRtpStreamSourceStateItem())
{
pjmedia_rtp_session_init(&mIncomingSession, 0, 0);
mSourceStateItem->mSessionId = sessionId;
diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index 1c200c3..035c43b 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -28,6 +28,7 @@
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
#include "RtpStateReplicationIf.h"
+#include "RtpStateItemHelpers.h"
using namespace std;
using namespace AsteriskSCF::Core::Discovery::V1;
@@ -73,44 +74,6 @@ void TestRtpReplicatorListener::stateRemoved(const Ice::StringSeq& items, const
{
}
-// this interface should be written by the Slice translator,
-// but can't be currently
-struct AsteriskSCF::Media::RTP::V1::RtpStateItemVisitor
-{
-public:
- virtual void visitGeneral(RtpGeneralStateItemPtr item) = 0;
- virtual void visitSession(RtpSessionStateItemPtr item) = 0;
- virtual void visitStreamSink(RtpStreamSinkStateItemPtr item) = 0;
- virtual void visitStreamSource(RtpStreamSourceStateItemPtr item) = 0;
-};
-
-// these visitor functions are also common to all users of the
-// interface above, but the translator can't write them
-void AsteriskSCF::Media::RTP::V1::RtpStateItem::visit(RtpStateItemVisitorPtr visitor)
-{
-// nothing to do for unsupported state items
-}
-
-void AsteriskSCF::Media::RTP::V1::RtpGeneralStateItem::visit(RtpStateItemVisitorPtr visitor)
-{
- visitor->visitGeneral(this);
-}
-
-void AsteriskSCF::Media::RTP::V1::RtpSessionStateItem::visit(RtpStateItemVisitorPtr visitor)
-{
- visitor->visitSession(this);
-}
-
-void AsteriskSCF::Media::RTP::V1::RtpStreamSinkStateItem::visit(RtpStateItemVisitorPtr visitor)
-{
- visitor->visitStreamSink(this);
-}
-
-void AsteriskSCF::Media::RTP::V1::RtpStreamSourceStateItem::visit(RtpStateItemVisitorPtr visitor)
-{
- visitor->visitStreamSource(this);
-}
-
void TestRtpReplicatorListener::stateSet(const RtpStateItemSeq& items, const Ice::Current&)
{
class visitor : public AsteriskSCF::Media::RTP::V1::RtpStateItemVisitor
@@ -123,22 +86,22 @@ void TestRtpReplicatorListener::stateSet(const RtpStateItemSeq& items, const Ice
private:
TestRtpReplicatorListener *listener;
- void visitGeneral(RtpGeneralStateItemPtr item)
+ void visitGeneral(const RtpGeneralStateItemPtr &item, const Ice::Current &)
{
listener->mGeneral = item;
}
- void visitSession(RtpSessionStateItemPtr item)
+ void visitSession(const RtpSessionStateItemPtr &item, const Ice::Current &)
{
listener->mSession = item;
}
- void visitStreamSink(RtpStreamSinkStateItemPtr item)
+ void visitStreamSink(const RtpStreamSinkStateItemPtr &item, const Ice::Current &)
{
listener->mSink = item;
}
- void visitStreamSource(RtpStreamSourceStateItemPtr item)
+ void visitStreamSource(const RtpStreamSourceStateItemPtr &item, const Ice::Current &)
{
listener->mSource = item;
}
commit 04b9b50ebf9467a8833fb0025e1f719aced91397
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Sun Dec 26 13:02:02 2010 -0600
Example of using Visitor pattern to process RTPStateItem objects.
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
index b449ee5..aed5cf4 100644
--- a/local-slice/RtpStateReplicationIf.ice
+++ b/local-slice/RtpStateReplicationIf.ice
@@ -42,10 +42,13 @@ module V1
string mName;
};
+ local interface RtpStateItemVisitor;
+
class RtpStateItem
{
string key;
string mSessionId;
+ /* local void visit(RtpStateItemVisitor *visitor) ;*/
};
sequence<RtpStateItem> RtpStateItemSeq;
@@ -93,6 +96,20 @@ module V1
AsteriskSCF::Media::V1::StreamSink *mSink;
};
+/*
+ Cannot use this method yet because the member function
+ signatures are written to accept proxy pointers to the
+ concrete class objects, not local object pointers
+
+ local interface RtpStateItemVisitor
+ {
+ void visitGeneral(RtpGeneralStateItem *item);
+ void visitSession(RtpSessionStateItem *item);
+ void visitStreamSink(RtpStreamSinkStateItem *item);
+ void visitStreamSource(RtpStreamSourceStateItem *item);
+ };
+*/
+
}; //module V1
}; //module RTP
diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index a21b3c0..1c200c3 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -73,31 +73,80 @@ void TestRtpReplicatorListener::stateRemoved(const Ice::StringSeq& items, const
{
}
+// this interface should be written by the Slice translator,
+// but can't be currently
+struct AsteriskSCF::Media::RTP::V1::RtpStateItemVisitor
+{
+public:
+ virtual void visitGeneral(RtpGeneralStateItemPtr item) = 0;
+ virtual void visitSession(RtpSessionStateItemPtr item) = 0;
+ virtual void visitStreamSink(RtpStreamSinkStateItemPtr item) = 0;
+ virtual void visitStreamSource(RtpStreamSourceStateItemPtr item) = 0;
+};
+
+// these visitor functions are also common to all users of the
+// interface above, but the translator can't write them
+void AsteriskSCF::Media::RTP::V1::RtpStateItem::visit(RtpStateItemVisitorPtr visitor)
+{
+// nothing to do for unsupported state items
+}
+
+void AsteriskSCF::Media::RTP::V1::RtpGeneralStateItem::visit(RtpStateItemVisitorPtr visitor)
+{
+ visitor->visitGeneral(this);
+}
+
+void AsteriskSCF::Media::RTP::V1::RtpSessionStateItem::visit(RtpStateItemVisitorPtr visitor)
+{
+ visitor->visitSession(this);
+}
+
+void AsteriskSCF::Media::RTP::V1::RtpStreamSinkStateItem::visit(RtpStateItemVisitorPtr visitor)
+{
+ visitor->visitStreamSink(this);
+}
+
+void AsteriskSCF::Media::RTP::V1::RtpStreamSourceStateItem::visit(RtpStateItemVisitorPtr visitor)
+{
+ visitor->visitStreamSource(this);
+}
+
void TestRtpReplicatorListener::stateSet(const RtpStateItemSeq& items, const Ice::Current&)
{
- for (RtpStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
+ class visitor : public AsteriskSCF::Media::RTP::V1::RtpStateItemVisitor
{
- RtpGeneralStateItemPtr general;
- RtpSessionStateItemPtr session;
- RtpStreamSinkStateItemPtr sink;
- RtpStreamSourceStateItemPtr source;
+ public:
+ visitor(TestRtpReplicatorListener *listener) : listener(listener)
+ {
+ }
- if ((general = RtpGeneralStateItemPtr::dynamicCast((*item))))
- {
- mGeneral = general;
- }
- else if ((session = RtpSessionStateItemPtr::dynamicCast((*item))))
+ private:
+ TestRtpReplicatorListener *listener;
+
+ void visitGeneral(RtpGeneralStateItemPtr item)
{
- mSession = session;
+ listener->mGeneral = item;
}
- else if ((sink = RtpStreamSinkStateItemPtr::dynamicCast((*item))))
+
+ void visitSession(RtpSessionStateItemPtr item)
+ {
+ listener->mSession = item;
+ }
+
+ void visitStreamSink(RtpStreamSinkStateItemPtr item)
{
- mSink = sink;
+ listener->mSink = item;
}
- else if ((source = RtpStreamSourceStateItemPtr::dynamicCast((*item))))
+
+ void visitStreamSource(RtpStreamSourceStateItemPtr item)
{
- mSource = source;
+ listener->mSource = item;
}
+ } v(this);
+
+ for (RtpStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
+ {
+ (*item)->visit(&v);
}
}
commit 175409d0b234ca84d23211659b16fa5ebeaca66b
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Sun Dec 26 11:48:04 2010 -0600
Eliminate stray reference to SipIf (probably leftover from copy-and-paste).
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ffc9a34..ed3fe2d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -42,7 +42,6 @@ asterisk_scf_component_init(RtpStateReplicator CXX)
asterisk_scf_component_add_slice(RtpStateReplicator ServiceLocatorIf)
asterisk_scf_component_add_slice(RtpStateReplicator ComponentServiceIf)
-asterisk_scf_component_add_slice(RtpStateReplicator SipIf)
asterisk_scf_component_add_slice(RtpStateReplicator RtpStateReplicationIf)
asterisk_scf_component_add_slice(RtpStateReplicator RoutingIf)
asterisk_scf_component_add_slice(RtpStateReplicator MediaRTPIf)
commit 8972cdf6fc6329ffda8533e1c5b090baf29cc193
Author: Joshua Colp <jcolp at digium.com>
Date: Fri Dec 10 10:43:44 2010 -0400
Add tests for confirming that state items are sent out with the proper contents.
diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index e71ffc6..a21b3c0 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -27,6 +27,8 @@
#include <AsteriskSCF/Media/MediaIf.h>
#include <AsteriskSCF/Media/RTP/MediaRTPIf.h>
+#include "RtpStateReplicationIf.h"
+
using namespace std;
using namespace AsteriskSCF::Core::Discovery::V1;
using namespace AsteriskSCF::Media::V1;
@@ -53,6 +55,52 @@ public:
};
static ArgCacheType mCachedArgs;
+class TestRtpReplicatorListener : public RtpStateReplicatorListener
+{
+public:
+ void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
+ void stateSet(const RtpStateItemSeq&, const Ice::Current&);
+
+ RtpGeneralStateItemPtr mGeneral;
+ RtpSessionStateItemPtr mSession;
+ RtpStreamSinkStateItemPtr mSink;
+ RtpStreamSourceStateItemPtr mSource;
+};
+
+typedef IceUtil::Handle<TestRtpReplicatorListener> TestRtpReplicatorListenerPtr;
+
+void TestRtpReplicatorListener::stateRemoved(const Ice::StringSeq& items, const Ice::Current&)
+{
+}
+
+void TestRtpReplicatorListener::stateSet(const RtpStateItemSeq& items, const Ice::Current&)
+{
+ for (RtpStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
+ {
+ RtpGeneralStateItemPtr general;
+ RtpSessionStateItemPtr session;
+ RtpStreamSinkStateItemPtr sink;
+ RtpStreamSourceStateItemPtr source;
+
+ if ((general = RtpGeneralStateItemPtr::dynamicCast((*item))))
+ {
+ mGeneral = general;
+ }
+ else if ((session = RtpSessionStateItemPtr::dynamicCast((*item))))
+ {
+ mSession = session;
+ }
+ else if ((sink = RtpStreamSinkStateItemPtr::dynamicCast((*item))))
+ {
+ mSink = sink;
+ }
+ else if ((source = RtpStreamSourceStateItemPtr::dynamicCast((*item))))
+ {
+ mSource = source;
+ }
+ }
+}
+
/**
* It seems odd that boost doesn't provide an easy way to access the GLOBAL_FIXTURE members.
* But it doesn't seem to, so I'm sharing global setup stuff here.
@@ -71,6 +119,21 @@ public:
ServiceLocatorPrx locator;
/**
+ * A proxy to the state replicator.
+ */
+ RtpStateReplicatorPrx mStateReplicator;
+
+ /**
+ * Instance of our test replicator listener.
+ */
+ TestRtpReplicatorListenerPtr mListener;
+
+ /**
+ * A proxy to our state replicator listener.
+ */
+ RtpStateReplicatorListenerPrx mListenerProxy;
+
+ /**
* A proxy to the RTP session that we requested.
*/
RTPSessionPrx session;
@@ -160,12 +223,16 @@ struct GlobalIceFixture
{
Testbed.communicator = Ice::initialize(mCachedArgs.argc, mCachedArgs.argv);
- Testbed.adapter = Testbed.communicator->createObjectAdapterWithEndpoints("SinkAdapter", "default");
+ Testbed.adapter = Testbed.communicator->createObjectAdapterWithEndpoints("Adapter", "default");
StreamSinkPtr sink = new TestStreamSink();
Testbed.sink = StreamSinkPrx::uncheckedCast(Testbed.adapter->addWithUUID(sink));
+ Testbed.mListener = new TestRtpReplicatorListener();
+
+ Testbed.mListenerProxy = RtpStateReplicatorListenerPrx::uncheckedCast(Testbed.adapter->addWithUUID(Testbed.mListener));
+
Testbed.adapter->activate();
Testbed.locator = ServiceLocatorPrx::checkedCast(Testbed.communicator->stringToProxy("LocatorService:tcp -p 4411"));
@@ -210,8 +277,8 @@ BOOST_AUTO_TEST_CASE(ServiceFoundUsingName)
bool found = false;
try {
- ServiceLocatorParamsPtr params = new ServiceLocatorParams();
- params->category = "rtp";
+ ServiceLocatorParamsPtr params = new ServiceLocatorParams();
+ params->category = "rtp";
Testbed.locator->locate(params);
@@ -226,6 +293,71 @@ BOOST_AUTO_TEST_CASE(ServiceFoundUsingName)
}
/**
+ * Confirm that we find the state replicator
+ */
+BOOST_AUTO_TEST_CASE(ReplicatorFound)
+{
+ bool found = false;
+
+ try
+ {
+ RtpStateReplicatorParamsPtr params = new RtpStateReplicatorParams();
+ params->category = StateReplicatorDiscoveryCategory;
+ params->mName = "default";
+
+ Testbed.mStateReplicator = RtpStateReplicatorPrx::uncheckedCast(Testbed.locator->locate(params));
+
+ found = true;
+ }
+ catch (const Ice::Exception &e)
+ {
+ BOOST_TEST_MESSAGE(e.ice_name());
+ BOOST_TEST_MESSAGE(e.what());
+ }
+ catch (...)
+ {
+ }
+
+ BOOST_CHECK(found);
+}
+
+/**
+ * Confirm that we can add ourselves as a listener to the state replicator.
+ */
+BOOST_AUTO_TEST_CASE(AddListenertoStateReplicator)
+{
+ bool added = false;
+
+ try
+ {
+ Testbed.mStateReplicator->addListener(Testbed.mListenerProxy);
+
+ added = true;
+ }
+ catch (const Ice::Exception &e)
+ {
+ BOOST_TEST_MESSAGE(e.ice_name());
+ BOOST_TEST_MESSAGE(e.what());
+ }
+ catch (...)
+ {
+ }
+
+ BOOST_CHECK(added);
+}
+
+/**
+ * Confirm that we received the general state replication item.
+ */
+BOOST_AUTO_TEST_CASE(CheckReplicatedGeneralStateItem)
+{
+ // Since the RTP component is using a oneway invocation we wait here to ensure that the packet has been sent and processed
+ boost::this_thread::sleep(boost::posix_time::seconds(1));
+
+ BOOST_CHECK(Testbed.mListener->mGeneral);
+}
+
+/**
* Attempt to allocate an RTP session using a fake format
*/
BOOST_AUTO_TEST_CASE(AllocateRTPSession)
@@ -248,6 +380,9 @@ BOOST_AUTO_TEST_CASE(AllocateRTPSession)
Testbed.session = service->allocate(formats);
+ // Give the RTP component time to replicate this session
+ boost::this_thread::sleep(boost::posix_time::seconds(1));
+
allocated = true;
}
catch (const Ice::Exception &e)
@@ -263,6 +398,44 @@ BOOST_AUTO_TEST_CASE(AllocateRTPSession)
}
/**
+ * Confirm that we received the inital session replicated item (with proper contents) for the RTP session.
+ */
+BOOST_AUTO_TEST_CASE(ConfirmInitialReplicatedRTPSession)
+{
+ BOOST_CHECK(Testbed.mListener->mSession);
+ BOOST_CHECK(Testbed.mListener->mSession->mSessionIdentity == Testbed.session->ice_getIdentity());
+
+ StreamSinkSeq sinks = Testbed.session->getSinks();
+ StreamSinkRTPPrx sink = StreamSinkRTPPrx::uncheckedCast(sinks.front());
+ BOOST_CHECK(Testbed.mListener->mSession->mSinkIdentity == sink->ice_getIdentity());
+
+ StreamSourceSeq sources = Testbed.session->getSources();
+ StreamSourceRTPPrx source = StreamSourceRTPPrx::uncheckedCast(sources.front());
+ BOOST_CHECK(Testbed.mListener->mSession->mSourceIdentity == source->ice_getIdentity());
+ BOOST_CHECK(Testbed.mListener->mSession->mPort == source->getLocalPort());
+}
+
+/**
+ * Confirm that we received the initial sink replicated item (with proper contents) for the RTP session.
+ */
+BOOST_AUTO_TEST_CASE(ConfirmInitialReplicatedRTPSink)
+{
+ BOOST_CHECK(Testbed.mListener->mSink);
+ BOOST_CHECK(!Testbed.mListener->mSink->mSource);
+ BOOST_CHECK(!Testbed.mListener->mSink->mRemoteAddress.size());
+ BOOST_CHECK(!Testbed.mListener->mSink->mRemotePort);
+}
+
+/**
+ * Confirm that we received the initial source replicated item (with proper contents) for the RTP session.
+ */
+BOOST_AUTO_TEST_CASE(ConfirmInitialReplicatedRTPSource)
+{
+ BOOST_CHECK(Testbed.mListener->mSource);
+ BOOST_CHECK(!Testbed.mListener->mSource->mSink);
+}
+
+/**
* Check that the RTP session has at least one source
*/
BOOST_AUTO_TEST_CASE(CheckForSource)
@@ -568,6 +741,8 @@ BOOST_AUTO_TEST_CASE(SetupLoopback)
sink->setRemoteDetails(address, port);
looped = true;
+
+ boost::this_thread::sleep(boost::posix_time::seconds(1));
}
catch (const Ice::Exception &e)
{
@@ -582,6 +757,26 @@ BOOST_AUTO_TEST_CASE(SetupLoopback)
}
/**
+ * Confirm that we received the populated sink replicated item (with proper contents) for the RTP session.
+ */
+BOOST_AUTO_TEST_CASE(ConfirmPopulatedReplicatedRTPSink)
+{
+ StreamSourceSeq sources = Testbed.session->getSources();
+ StreamSourceRTPPrx source = StreamSourceRTPPrx::uncheckedCast(sources.front());
+
+ BOOST_CHECK(Testbed.mListener->mSink->mRemoteAddress == source->getLocalAddress());
+ BOOST_CHECK(Testbed.mListener->mSink->mRemotePort == source->getLocalPort());
+}
+
+/**
+ * Confirm that we received the populated source replicated item (with proper contents) for the RTP session.
+ */
+BOOST_AUTO_TEST_CASE(ConfirmPopulatedReplicatedRTPSource)
+{
+ BOOST_CHECK(Testbed.mListener->mSource->mSink == Testbed.sink);
+}
+
+/**
* Actually write a frame out, have it get transmitted via RTP, received via RTP,
* and then transmogrified back into a frame and written to our sink.
*/
commit 4e92f74cb39fdcecdd160a795a73ebfb9e916f94
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Dec 9 16:18:31 2010 -0400
Add state replicator to the test. Not yet tested, but getting there.
diff --git a/config/test_component.config.in b/config/test_component.config.in
index dad52ba..f4c470d 100644
--- a/config/test_component.config.in
+++ b/config/test_component.config.in
@@ -5,7 +5,19 @@
#
IceBox.InheritProperties=1
-IceBox.LoadOrder=ServiceDiscovery,MediaRTPpjmedia,MediaRTPpjmediaTest
+IceBox.LoadOrder=ServiceDiscovery,RtpStateReplicator,MediaRTPpjmedia,MediaRTPpjmediaTest
+
+# RtpStateReplicator Configuration
+IceBox.Service.RtpStateReplicator=../src at RtpStateReplicator:create
+
+# Adapter parameters for this component
+RtpStateReplicator.Endpoints=tcp:udp
+
+# A proxy to the service locator management service
+LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422
+
+# A proxy to the service locator service
+LocatorService.Proxy=LocatorService:tcp -p 4411
#
# media_rtp_pjmedia Configuration
commit 514af12e73772f1a9f84e5c84bc0bf59ae36a8ac
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Dec 9 16:18:13 2010 -0400
Fix a namespace collision in a slightly foul manner.
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 1be853c..6405c98 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -220,13 +220,13 @@ private:
/**
* Implementation of the ComponentService interface as defined in ComponentServiceIf.ice
*/
-class ComponentServiceImpl : public ComponentService
+class ComponentServicepjmediaImpl : public ComponentService
{
public:
/**
* A constructor for this implementation which just sets a few variables, nothing extreme.
*/
- ComponentServiceImpl(MediaRTPpjmediaApp& app, RtpGeneralStateItemPtr generalState) : mApplication(app), mGeneralState(generalState) { };
+ ComponentServicepjmediaImpl(MediaRTPpjmediaApp& app, RtpGeneralStateItemPtr generalState) : mApplication(app), mGeneralState(generalState) { };
/**
* An implementation of the suspend method which actually suspends ourselves
@@ -441,7 +441,7 @@ void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorP
}
/* One must provide a component service to manage us, if someone wants to */
- ComponentServicePtr ComponentService = new ComponentServiceImpl(*this, mGeneralState);
+ ComponentServicePtr ComponentService = new ComponentServicepjmediaImpl(*this, mGeneralState);
ComponentServicePrx ComponentServiceProxy = ComponentServicePrx::uncheckedCast(mLocalAdapter->addWithUUID(ComponentService));
/* Let's add the component service to the service locator first */
commit 8c584eebcd8f071dd2471d1e9762d48536993958
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Dec 9 15:47:31 2010 -0400
Update test configuration file.
diff --git a/config/test_component.config.in b/config/test_component.config.in
index cf051a4..dad52ba 100644
--- a/config/test_component.config.in
+++ b/config/test_component.config.in
@@ -15,8 +15,8 @@ IceBox.Service.MediaRTPpjmedia=../src at media_rtp_pjmedia:create
# Adapter parameters for this component
MediaRTPpjmediaAdapter.Endpoints=default
-
MediaRTPpjmediaAdapterLocal.Endpoints=default
+MediaRTPpjmediaAdapterLogger.Endpoints=default
# A proxy to the service locator management service
ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 4422
@@ -28,7 +28,7 @@ ServiceLocatorProxy=LocatorService:tcp -p 4411
# media_rtp_pjmedia_test Configuration
#
-IceBox.Service.MediaRTPpjmediaTest=media_rtp_pjmedia_test:create --report_sink=${CMAKE_BINARY_DIR}/media_rtp_pjmedia_test-result.xml --report_format=XML --report_level=detailed
+IceBox.Service.MediaRTPpjmediaTest=../test at media_rtp_pjmedia_test:create --report_sink=${CMAKE_BINARY_DIR}/media_rtp_pjmedia_test-result.xml --report_format=XML --report_level=detailed
#
# Service Locator Configuration
commit 6d73804aa2cf9b2cfbe1e96b84960b7197138333
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Dec 9 15:40:02 2010 -0400
Use a predefined name for the RTP media service, and don't register with the service locator unless active.
diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index e979058..1be853c 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -51,6 +51,7 @@ Logger lg = getLoggerFactory().getLogger("AsteriskSCF.MediaRTP");
}
static const string ReplicaServiceId("MediaRtpReplica");
+static const string MediaServiceId("RTPMediaService");
/**
* Implementation of the RTPMediaService interface as defined in MediaRTPIf.ice
@@ -225,7 +226,7 @@ public:
/**
* A constructor for this implementation which just sets a few variables, nothing extreme.
*/
- ComponentServiceImpl(MediaRTPpjmediaApp& app, ServiceManagementPrx& management) : mApplication(app), mManagement(management) { };
+ ComponentServiceImpl(MediaRTPpjmediaApp& app, RtpGeneralStateItemPtr generalState) : mApplication(app), mGeneralState(generalState) { };
/**
* An implementation of the suspend method which actually suspends ourselves
@@ -233,7 +234,7 @@ public:
*/
virtual void suspend(const ::Ice::Current&)
{
- mManagement->suspend();
+ mGeneralState->mServiceManagement->suspend();
}
/**
@@ -242,7 +243,7 @@ public:
*/
virtual void resume(const ::Ice::Current&)
{
- mManagement->unsuspend();
+ mGeneralState->mServiceManagement->unsuspend();
}
/**
@@ -261,10 +262,9 @@ private:
MediaRTPpjmediaApp& mApplication;
/**
- * Our service locator management proxy, we'll use it to suspend and
- * unsuspend ourselves.
+ * Pointer to general state information.
*/
- ServiceManagementPrx& mManagement;
+ RtpGeneralStateItemPtr mGeneralState;
};
/**
@@ -427,17 +427,21 @@ void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorP
}
}
- RTPMediaServicePrx RTPMediaServiceProxy = RTPMediaServicePrx::uncheckedCast(mGlobalAdapter->addWithUUID(rtpmediaservice));
+ RTPMediaServicePrx RTPMediaServiceProxy = RTPMediaServicePrx::uncheckedCast(mGlobalAdapter->add(rtpmediaservice,
+ mCommunicator->stringToIdentity(MediaServiceId)));
ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
- 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, "");
+ 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, "");
+ }
/* One must provide a component service to manage us, if someone wants to */
- ComponentServicePtr ComponentService = new ComponentServiceImpl(*this, mGeneralState->mServiceManagement);
+ ComponentServicePtr ComponentService = new ComponentServiceImpl(*this, mGeneralState);
ComponentServicePrx ComponentServiceProxy = ComponentServicePrx::uncheckedCast(mLocalAdapter->addWithUUID(ComponentService));
/* Let's add the component service to the service locator first */
commit 33cea6ad800dcbfa01ddec5c8a227f051ada2fb0
Author: Joshua Colp <jcolp at digium.com>
Date: Thu Dec 9 15:29:07 2010 -0400
Add a general state item which is currently used to replicate the service locator proxy for the service.
diff --git a/local-slice/RtpStateReplicationIf.ice b/local-slice/RtpStateReplicationIf.ice
... 2392 lines suppressed ...
--
asterisk-scf/integration/media_rtp_pjmedia.git
More information about the asterisk-scf-commits
mailing list