[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "configuration" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon May 2 12:47:45 CDT 2011


branch "configuration" has been created
        at  1467fd724497c5b072d3fafdc03b9d52bb9cb731 (commit)

- Log -----------------------------------------------------------------
commit 1467fd724497c5b072d3fafdc03b9d52bb9cb731
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon May 2 14:47:29 2011 -0300

    Add configuration items for RTP and also component to push the configuration.

diff --git a/config/Rtp.config b/config/Rtp.config
new file mode 100644
index 0000000..d8da13e
--- /dev/null
+++ b/config/Rtp.config
@@ -0,0 +1,12 @@
+# General Configuation Options
+
+[general]
+
+# Start port for RTP and RTCP ports
+startport=10000
+
+# End port for RTP and RTCP ports
+endport=20000
+
+# Number of worker threads for incoming media
+workerthreadcount=4
diff --git a/config/RtpConfigurator.py b/config/RtpConfigurator.py
new file mode 100755
index 0000000..983144d
--- /dev/null
+++ b/config/RtpConfigurator.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+#
+# Asterisk SCF -- An open-source communications framework.
+#
+# Copyright (C) 2011, 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.
+#
+
+# Rtp configurator
+
+# Bring in the common configuration infrastructure
+import Ice, Configurator, sys
+
+# Load our component specific configuration definitions
+Ice.loadSlice('-I. -I/opt/Ice-3.4.1/slice -I../../slice --all ../local-slice/RtpConfigurationIf.ice')
+import AsteriskSCF.Media.RTP.V1
+
+# Add our own visitor implementations for the sections we support
+class RtpSectionVisitors(Configurator.SectionVisitors):
+    def visit_general(self, config, section):
+        group = AsteriskSCF.Media.RTP.V1.RtpGeneralGroup()
+        group.configurationItems = { }
+
+        mapper = Configurator.OptionMapper()
+
+        portsItem = AsteriskSCF.Media.RTP.V1.PortRangesItem()
+        mapper.map('startport', portsItem, 'startPort', 'ports', config.getint, 10000)
+        mapper.map('endport', portsItem, 'endPort', 'ports', config.getint, 20000)
+
+        workerItem = AsteriskSCF.Media.RTP.V1.WorkerThreadCountItem()
+        mapper.map('workerthreadcount', workerItem, 'count', 'workerThreadCount', config.getint, 4)
+
+        for option in config.options(section):
+            mapper.execute(group, section, option)
+
+        mapper.finish(group)
+
+        self.groups.append(group)
+
+# Make a configurator application and let it run
+app = Configurator.ConfiguratorApp('Rtp.config', RtpSectionVisitors())
+sys.exit(app.main(sys.argv))
diff --git a/local-slice/RtpConfigurationIf.ice b/local-slice/RtpConfigurationIf.ice
new file mode 100644
index 0000000..62d3f12
--- /dev/null
+++ b/local-slice/RtpConfigurationIf.ice
@@ -0,0 +1,110 @@
+/*
+ * Asterisk SCF -- An open-source communications framework.
+ *
+ * Copyright (C) 2011, 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 <Ice/BuiltinSequences.ice>
+#include <AsteriskSCF/System/Component/ConfigurationIf.ice>
+
+module AsteriskSCF
+{
+
+module Media
+{
+
+module RTP
+{
+
+["suppress"]
+module V1
+{
+   /**
+    * Local visitor class for visiting RTP configuration groups
+    */
+   local class RtpConfigurationGroupVisitor extends AsteriskSCF::System::Configuration::V1::ConfigurationGroupVisitor
+   {
+   };
+
+   /**
+    * Generic RTP configuration group
+    */
+   ["visitor:RtpConfigurationGroupVisitor"] class RtpConfigurationGroup extends AsteriskSCF::System::Configuration::V1::ConfigurationGroup
+   {
+   };
+
+   /**
+    * General RTP configuration group that contains general items related to the RTP component as a whole
+    */
+   class RtpGeneralGroup extends RtpConfigurationGroup
+   {
+   };
+
+   /**
+    * Local visitor class for visiting RTP configuration items
+    */
+   local class RtpConfigurationItemVisitor extends AsteriskSCF::System::Configuration::V1::ConfigurationItemVisitor
+   {
+   };
+
+   /**
+    * Generic RTP configuration item
+    */
+   ["visitor:RtpConfigurationItemVisitor"] class RtpConfigurationItem extends AsteriskSCF::System::Configuration::V1::ConfigurationItem
+   {
+   };
+
+   /**
+    * Port ranges configuartion item
+    */
+   class PortRangesItem extends RtpConfigurationItem
+   {
+       /**
+	* Start port for RTP and RTCP sockets.
+	*
+	* Default value is 10000.
+	*
+	*/
+       int startPort = 10000;
+
+       /**
+	* End port for RTP and RTCP sockets.
+	*
+	* Default value is 20000.
+	*
+	*/
+       int endPort = 20000;
+   };
+
+   /**
+    * Worker thread count for incoming media configuration item
+    */
+   class WorkerThreadCountItem extends RtpConfigurationItem
+   {
+       /**
+	* Number of threads that should handle incoming media.
+	*
+	* Default value is 4.
+	*/
+       int count = 4;
+   };
+
+}; /* module V1 */
+
+}; /* module RTP */
+
+}; /* module Media */
+
+}; /* module Asterisk SCF */
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 259dcdb..75a557e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -19,6 +19,7 @@ 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_slice(media_rtp_pjmedia ../local-slice/RtpConfigurationIf.ice)
 asterisk_scf_component_add_boost_libraries(media_rtp_pjmedia core thread)
 asterisk_scf_component_build_icebox(media_rtp_pjmedia)
 target_link_libraries(media_rtp_pjmedia logging-client)

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list