[asterisk-scf-commits] asterisk-scf/integration/test_channel.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Oct 6 09:30:59 CDT 2010


branch "master" has been updated
       via  3b7128dd68b00ac105076983517f45d383777bec (commit)
       via  e237a08a72c0aa0272cbc414e17ec03c2fa79468 (commit)
      from  f32ea798b60fff56d0f125912413dd7066ed313d (commit)

Summary of changes:
 CMakeLists.txt                   |    4 +-
 cmake                            |    2 +-
 config/test_channel.config       |    8 ----
 include/Commands.h               |   85 --------------------------------------
 include/Config.h                 |   16 -------
 local_slice/CMakeLists.txt       |    1 +
 local_slice/CommandsIf.ice       |   65 +++++++++++++++++++++++++++++
 src/CMakeLists.txt               |   35 ++++------------
 src/ConsoleDriver.cpp            |    2 +-
 {include => src}/ConsoleDriver.h |   11 ++---
 src/ListenerManager.h            |   16 ++++++-
 src/Service.cpp                  |   69 ++++++++++---------------------
 src/TestEndpoint.cpp             |   68 ++++++++++++++++++++++++++----
 {include => src}/TestEndpoint.h  |    6 +--
 src/main.cpp                     |   55 ++++++++++++++++++++++++
 15 files changed, 233 insertions(+), 210 deletions(-)
 delete mode 100644 config/test_channel.config
 delete mode 100755 include/Commands.h
 delete mode 100644 include/Config.h
 create mode 100644 local_slice/CMakeLists.txt
 create mode 100644 local_slice/CommandsIf.ice
 rename {include => src}/ConsoleDriver.h (65%)
 mode change 100755 => 100644
 rename {include => src}/TestEndpoint.h (78%)
 mode change 100755 => 100644
 create mode 100644 src/main.cpp


- Log -----------------------------------------------------------------
commit 3b7128dd68b00ac105076983517f45d383777bec
Author: Brent Eagles <beagles at digium.com>
Date:   Wed Oct 6 11:59:04 2010 -0230

    Fix bug in initialization that hid a member variable resulting in a NullHandleException on "stop"

diff --git a/src/Service.cpp b/src/Service.cpp
index abaa479..9fe103e 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -43,7 +43,7 @@ void TestChannelDriver::start(const std::string& name, const Ice::CommunicatorPt
         AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx::checkedCast(mAdapter->add(servant, communicator->stringToIdentity("TestChannel")));
 
     AsteriskSCF::Core::Discovery::V1::ServiceLocatorManagementPrx management = AsteriskSCF::Core::Discovery::V1::ServiceLocatorManagementPrx::checkedCast(communicator->propertyToProxy("ServiceLocatorManagementProxy"));
-    AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx mServiceManagement = AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(management->addService(endpointLocatorPrx, "TestChannel"));
+    mServiceManagement = AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(management->addService(endpointLocatorPrx, "TestChannel"));
     AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr params = new AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams();
     params->category = "TestChannel";
     mServiceManagement->addLocatorParams(params, "");

commit e237a08a72c0aa0272cbc414e17ec03c2fa79468
Author: Brent Eagles <beagles at digium.com>
Date:   Tue Oct 5 21:56:03 2010 -0230

    Rewrote the command interface in slice.
    Recast the test channel as an IceBox service.
    Moved files out of include (no longer necessary)
    Made a separate application for the console driver

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c7be7c..81b6be8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@
 cmake_minimum_required(VERSION 2.6)
 
 # Include common Hydra build infrastructure
-include(cmake/Hydra_v4.cmake)
+include(cmake/AsteriskSCF.cmake)
 
 # This project is C++ based and requires a minimum of 3.4
 hydra_project("Test Channel" 3.4 CXX)
@@ -12,6 +12,6 @@ hydra_project("Test Channel" 3.4 CXX)
 # Take care of slice definitions
 add_subdirectory(slice EXCLUDE_FROM_ALL)
 
-# Take care of the source code for this project
+add_subdirectory(local_slice)
 add_subdirectory(src)
 
diff --git a/cmake b/cmake
index 2359fc7..e9cf9f2 160000
--- a/cmake
+++ b/cmake
@@ -1 +1 @@
-Subproject commit 2359fc71589a0d868be966de0011f2fe242d504d
+Subproject commit e9cf9f2e6dd03fe7bc39c363d72812aceed28367
diff --git a/config/test_channel.config b/config/test_channel.config
deleted file mode 100644
index 65d48a2..0000000
--- a/config/test_channel.config
+++ /dev/null
@@ -1,8 +0,0 @@
-# Endpoints for the test channel service
-AsteriskSCF.TestChannelService.Endpoints=default
-
-# Where to find the Service Locator manager. We need the Service Locator in order to be able to plug in to the Asterisk SCF system Discovery mechanisms.
-ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 4422
-
-# Endpoints for Icestorm events
-TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10000
diff --git a/include/Commands.h b/include/Commands.h
deleted file mode 100755
index 5d48dd4..0000000
--- a/include/Commands.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-* Asterisk Scalable Communications Framework
-*
-* Copyright (C) 2010 -- Digium, Inc.
-*
-* All rights reserved.
-*/
-
-#pragma once
-
-//
-// Interface for the console driver (or other UIs) to interact
-// with the session endpoint.
-//
-
-#include <string>
-#include <vector>
-#include <IceUtil/Shared.h>
-#include <IceUtil/Handle.h>
-#include "Config.h"
-
-//
-// TODO: Add more commands.
-//
-class TEST_CHANNEL_EXPORT Commands : public virtual IceUtil::Shared
-{
-public:
-    virtual ~Commands() {}
-
-    //
-    // Echo any cached media frames.
-    //
-    virtual void echo(const std::string& id) = 0;
-    
-    //
-    // Turn on automatic (immediate) echo of media frames.
-    //
-    virtual void echoOn(const std::string& id) = 0;
-
-    //
-    // Turn off automatic echo of media frames.
-    //
-    virtual void echoOff(const std::string& id) = 0;
-
-    //
-    // Answer an invite.
-    //
-    virtual void answer(const std::string& id) = 0;
-
-    //
-    // Hangup!
-    // 
-    virtual void hangup(const std::string& id) = 0;
-
-    //
-    // Die horribly.
-    //
-    virtual void die(const std::string& id) = 0;
-
-    //
-    // Dump log
-    //
-    virtual void getlog(const std::string& id, std::vector<std::string>& log) = 0;
-
-    //
-    // Clear log
-    //
-    virtual void clearlog(const std::string& id) = 0;
-};
-
-typedef IceUtil::Handle<Commands> CommandsPtr;
-
-//
-// Abstract base class for command "drivers". Basically implementations
-// of things that implement the commands or intelligence for the 
-// test channel driver.
-//
-class CommandDriver : virtual public IceUtil::Shared
-{
-public:
-    virtual ~CommandDriver() {}
-    virtual void setHandler(const CommandsPtr& handler) = 0;
-};
-
-typedef IceUtil::Handle<CommandDriver> CommandDriverPtr;
diff --git a/include/Config.h b/include/Config.h
deleted file mode 100644
index 9c9c1cf..0000000
--- a/include/Config.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-* Asterisk Scalable Communications Framework
-*
-* Copyright (C) 2010 -- Digium, Inc.
-*
-* All rights reserved.
-*/
-#pragma once
-
-#include <IceUtil/Config.h>
-
-#ifdef test_channel_lib_EXPORTS
-#   define TEST_CHANNEL_EXPORT ICE_DECLSPEC_EXPORT
-#else
-#   define TEST_CHANNEL_EXPORT ICE_DECLSPEC_EXPORT
-#endif
diff --git a/local_slice/CMakeLists.txt b/local_slice/CMakeLists.txt
new file mode 100644
index 0000000..ba8b52c
--- /dev/null
+++ b/local_slice/CMakeLists.txt
@@ -0,0 +1 @@
+hydra_compile_slice(CommandsIf.ice lib "Test Channel Command API" TestChannel)
diff --git a/local_slice/CommandsIf.ice b/local_slice/CommandsIf.ice
new file mode 100644
index 0000000..598bf90
--- /dev/null
+++ b/local_slice/CommandsIf.ice
@@ -0,0 +1,65 @@
+/*
+ * Asterisk Scalable Communications Framework
+ *
+ * Copyright (C) 2010 -- Digium, Inc.
+ *
+ * All rights reserved.
+ */
+
+#pragma once
+
+#include <Ice/BuiltinSequences.ice>
+
+module AsteriskSCF
+{
+module TestChannel
+{
+["suppress"]
+module V1
+{
+    interface Commands
+    {
+        /**
+         * Echo the current cached media (only valid if echo is turned off)
+         */
+        void echo(string id);
+
+        /**
+         * Turn on immediate echoing of media
+         */
+        void echoOn(string id);
+
+        /**
+         * Turn off immediate echoing of media.
+         */
+        void echoOff(string id);
+
+        /**
+         * Emulate answering.
+         */
+        void answer(string id);
+
+        /**
+         * Emulate hanging up.
+         */
+        void hangup(string id);
+
+        /**
+         * Kill the specified session in an abrupt way.
+         */
+        void die(string id);
+
+        /**
+         * Get the log for the specified session.
+         */
+        void getlog(string id, out Ice::StringSeq log);
+
+        /**
+         * Clear the log that has been cached on behalf of session labelled with "id".
+         */
+        void clearlog(string id);
+    };
+}; /* End of V1 */
+}; /* End of TestChannel */
+}; /* End of AsteriskSCF */
+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 99a7e26..55fabc9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,40 +1,23 @@
 hydra_component_init(test_channel CXX)
-include_directories("../include")
 hydra_component_add_slice(test_channel EndpointIf)
 hydra_component_add_slice(test_channel ComponentServiceIf)
 hydra_component_add_slice(test_channel SessionCommunicationsIf)
 hydra_component_add_slice(test_channel RoutingIf)
+hydra_component_add_slice(test_channel CommandsIf)
 hydra_component_add_file(test_channel Service.cpp)
 hydra_component_add_file(test_channel MediaEchoThread.cpp)
 hydra_component_add_file(test_channel MediaSession.cpp)
-hydra_component_add_file(test_channel ConsoleDriver.cpp)
 hydra_component_add_file(test_channel TestEndpoint.cpp)
-hydra_component_add_file(test_channel ../include/TestEndpoint.h)
-hydra_component_add_file(test_channel ../include/Commands.h)
-hydra_component_add_file(test_channel ../include/ConsoleDriver.h)
+hydra_component_add_file(test_channel TestEndpoint.h)
 hydra_component_add_ice_libraries(test_channel IceStorm)
 hydra_component_add_boost_libraries(test_channel thread)
 hydra_component_add_boost_libraries(test_channel date_time)
-hydra_component_build_standalone(test_channel)
+hydra_component_build_icebox(test_channel)
 
-hydra_component_init(test_channel_lib CXX)
-include_directories("../include")
-hydra_component_add_slice(test_channel_lib EndpointIf)
-hydra_component_add_slice(test_channel_lib ComponentServiceIf)
-hydra_component_add_slice(test_channel_lib SessionCommunicationsIf)
-hydra_component_add_slice(test_channel_lib RoutingIf)
-hydra_component_add_file(test_channel_lib Service.cpp)
-hydra_component_add_file(test_channel_lib MediaEchoThread.cpp)
-hydra_component_add_file(test_channel_lib MediaSession.cpp)
-hydra_component_add_file(test_channel_lib ConsoleDriver.cpp)
-hydra_component_add_file(test_channel_lib TestEndpoint.cpp)
-hydra_component_add_file(test_channel_lib ../include/TestEndpoint.h)
-hydra_component_add_file(test_channel_lib ../include/Commands.h)
-hydra_component_add_file(test_channel_lib ../include/ConsoleDriver.h)
-hydra_component_add_ice_libraries(test_channel_lib IceStorm)
-hydra_component_add_boost_libraries(test_channel_lib thread)
-hydra_component_add_boost_libraries(test_channel_lib date_time)
+hydra_component_init(console_driver CXX)
+hydra_component_add_slice(console_driver CommandsIf)
+hydra_component_add_file(console_driver ConsoleDriver.cpp)
+hydra_component_add_file(console_driver ConsoleDriver.h)
+hydra_component_add_file(console_driver main.cpp)
+hydra_component_build_standalone(console_driver)
 
-hydra_component_build_library(test_channel_lib)
-
-hydra_component_install(test_channel RUNTIME bin "Test Channel Emulator." Core)
diff --git a/src/ConsoleDriver.cpp b/src/ConsoleDriver.cpp
index 3a4102e..a2ca5da 100644
--- a/src/ConsoleDriver.cpp
+++ b/src/ConsoleDriver.cpp
@@ -32,7 +32,7 @@ ConsoleDriver::ConsoleDriver() :
 {
 }
 
-void ConsoleDriver::setHandler(const CommandsPtr& handler)
+void ConsoleDriver::setHandler(const AsteriskSCF::TestChannel::V1::CommandsPrx& handler)
 {
     IceUtil::Monitor<IceUtil::Mutex>::Lock lock(mMonitor);
     mCommandHandler = handler;
diff --git a/include/ConsoleDriver.h b/src/ConsoleDriver.h
old mode 100755
new mode 100644
similarity index 65%
rename from include/ConsoleDriver.h
rename to src/ConsoleDriver.h
index 2f0bf2e..9746b71
--- a/include/ConsoleDriver.h
+++ b/src/ConsoleDriver.h
@@ -10,24 +10,21 @@
 #include <IceUtil/Monitor.h>
 #include <IceUtil/Thread.h>
 #include <string>
-#include <Commands.h>
+#include <CommandsIf.h>
 
-#include "Config.h"
-
-class TEST_CHANNEL_EXPORT ConsoleDriver : virtual public CommandDriver,
-    virtual public IceUtil::Thread
+class ConsoleDriver : virtual public IceUtil::Thread
 {
 public:
     ConsoleDriver();
     
     void run();
-    void setHandler(const CommandsPtr& handler);
+    void setHandler(const AsteriskSCF::TestChannel::V1::CommandsPrx& handler);
     void write(const std::string& msg);
     void destroy();
 private:
     IceUtil::Monitor<IceUtil::Mutex> mMonitor;
     bool mDone;
-    CommandsPtr mCommandHandler;
+    AsteriskSCF::TestChannel::V1::CommandsPrx mCommandHandler;
 };
 
 typedef IceUtil::Handle<ConsoleDriver> ConsoleDriverPtr;
diff --git a/src/ListenerManager.h b/src/ListenerManager.h
index 35be190..1be7165 100644
--- a/src/ListenerManager.h
+++ b/src/ListenerManager.h
@@ -88,9 +88,19 @@ namespace TestUtil
 
         virtual ~ListenerManagerT()
         {
-            //
-            // TODO: Destroy topic.
-            //
+            if(mTopic)
+            {
+                try
+                {
+                    mTopic->destroy();
+                }
+                catch(...)
+                {
+                    //
+                    // Destructors are no-throw!
+                    //
+                }
+            }
         }
 
         //
diff --git a/src/Service.cpp b/src/Service.cpp
index 22f5b4c..abaa479 100644
--- a/src/Service.cpp
+++ b/src/Service.cpp
@@ -6,83 +6,58 @@
 * All rights reserved.
 */
 #include <Ice/Ice.h>
-#include <IceStorm/IceStorm.h>
+#include <IceBox/IceBox.h>
 
 #include <Core/Discovery/ServiceLocatorIf.h>
 #include <Core/Routing/RoutingIf.h>
 #include "Logger.h"
 #include "TestEndpoint.h"
-#include "ConsoleDriver.h"
 
-class TestChannelDriver : public Ice::Application
+class TestChannelDriver : public IceBox::Service
 {
 public:
     TestChannelDriver();
 
 protected:
-    int run(int, char*[]);
-    void interruptCallback(int);
+    void start(const std::string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args);
+    void stop();
 
 private:
     AsteriskSCF::TestUtil::Logger mLogger;
-    ConsoleDriverPtr mConsoleDriver;
+    Ice::ObjectAdapterPtr mAdapter;
+    AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx mServiceManagement;
 };
 
 TestChannelDriver::TestChannelDriver()
 {
 }
 
-int TestChannelDriver::run(int, char*[])
+void TestChannelDriver::start(const std::string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args)
 {
-    callbackOnInterrupt();
     mLogger.getTraceStream() << "Launching AsteriskSCF Session-Oriented Test Channel Service." << std::endl;
-    mConsoleDriver = new ConsoleDriver;
-    mConsoleDriver->start();
-    IceStorm::TopicManagerPrx topicManager;
-    try
-    {
-        std::string prop = communicator()->getProperties()->getProperty("TopicManager.Proxy");
-        if(prop.size() != 0)
-        {
-            topicManager = IceStorm::TopicManagerPrx::checkedCast(communicator()->stringToProxy(prop));
-        }
-    }
-    catch(const Ice::Exception& ex)
-    {
-        mLogger.getInfoStream() << "Attempt to get topic manager failed with: " << ex << std::endl;
-    }
-    IceStorm::TopicPrx topic;
-    if(!topicManager)
-    {
-        mLogger.getInfoStream() << "No topic manager, service events will not be published." << std::endl;
-    }
-    Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("AsteriskSCF.TestChannelService");
-    adapter->activate();
+    mAdapter = communicator->createObjectAdapter("AsteriskSCF.TestChannelService");
+    mAdapter->activate();
 
-    AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr servant = AsteriskSCF::TestUtil::TestEndpoint::create(mConsoleDriver, adapter, "TestChannel.Locator");
+    AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr servant = AsteriskSCF::TestUtil::TestEndpoint::create(mAdapter, "TestChannel.Locator");
     AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx endpointLocatorPrx = 
-        AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx::checkedCast(adapter->add(servant, communicator()->stringToIdentity("TestChannel")));
+        AsteriskSCF::Core::Routing::V1::EndpointLocatorPrx::checkedCast(mAdapter->add(servant, communicator->stringToIdentity("TestChannel")));
 
-    AsteriskSCF::Core::Discovery::V1::ServiceLocatorManagementPrx management = AsteriskSCF::Core::Discovery::V1::ServiceLocatorManagementPrx::checkedCast(communicator()->propertyToProxy("ServiceLocatorManagementProxy"));
-    AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx service_management = AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(management->addService(endpointLocatorPrx, "TestChannel"));
+    AsteriskSCF::Core::Discovery::V1::ServiceLocatorManagementPrx management = AsteriskSCF::Core::Discovery::V1::ServiceLocatorManagementPrx::checkedCast(communicator->propertyToProxy("ServiceLocatorManagementProxy"));
+    AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx mServiceManagement = AsteriskSCF::Core::Discovery::V1::ServiceManagementPrx::uncheckedCast(management->addService(endpointLocatorPrx, "TestChannel"));
     AsteriskSCF::Core::Discovery::V1::ServiceLocatorParamsPtr params = new AsteriskSCF::Core::Discovery::V1::ServiceLocatorParams();
     params->category = "TestChannel";
-    service_management->addLocatorParams(params, "");
-
-    communicator()->waitForShutdown();
-
-    service_management->unregister();
-    return EXIT_SUCCESS;
+    mServiceManagement->addLocatorParams(params, "");
 }
 
-void TestChannelDriver::interruptCallback(int)
+void TestChannelDriver::stop()
 {
-    mConsoleDriver->destroy();
-    communicator()->shutdown();
+    mServiceManagement->unregister();
+    mAdapter->deactivate();
 }
 
-int main(int argc, char* argv[])
-{
-    TestChannelDriver app;
-    return app.main(argc, argv);
+extern "C" {
+    HYDRA_ICEBOX_EXPORT ::IceBox::Service* create(Ice::CommunicatorPtr communicator)
+    {
+        return new TestChannelDriver;
+    }
 }
diff --git a/src/TestEndpoint.cpp b/src/TestEndpoint.cpp
index 921238e..b49bf05 100644
--- a/src/TestEndpoint.cpp
+++ b/src/TestEndpoint.cpp
@@ -20,7 +20,7 @@
 
 #include "Logger.h"
 #include "MediaSession.h"
-#include "Commands.h"
+#include "CommandsIf.h"
 
 
 //
@@ -252,10 +252,10 @@ typedef IceUtil::Handle<SessionI> SessionIPtr;
 class EndpointManager :
     virtual public IceUtil::Shared,
     virtual public InternalManagerIf,
-    virtual public AsteriskSCF::SessionCommunications::V1::SessionEndpoint,
-    virtual public Commands
+    virtual public AsteriskSCF::SessionCommunications::V1::SessionEndpoint
 {
 public:
+
     EndpointManager(const Ice::ObjectAdapterPtr& adapter, const std::string& id) :
         mAdapter(adapter),
         mId(id)
@@ -418,7 +418,58 @@ private:
     AsteriskSCF::TestUtil::Logger mLogger;
     Ice::ObjectAdapterPtr mAdapter;
     std::string mId;
+};
+
+class CommandImpl : public AsteriskSCF::TestChannel::V1::Commands
+{
+public:
+    CommandImpl(const EndpointManagerPtr& mgr) :
+        mMgr(mgr)
+    {
+    }
+
+    void echo(const std::string& id, const Ice::Current&)
+    {
+        mMgr->echo(id);
+    }
+    
+    void echoOn(const std::string& id, const Ice::Current&)
+    {
+        mMgr->echoOn(id);
+    }
 
+    void echoOff(const std::string& id, const Ice::Current&)
+    {
+        mMgr->echoOff(id);
+    }
+
+    void answer(const std::string& id, const Ice::Current&)
+    {
+        mMgr->answer(id);
+    }
+    
+    void hangup(const std::string& id, const Ice::Current&)
+    {
+        mMgr->hangup(id);
+    }
+
+    void die(const std::string& id, const Ice::Current&)
+    {
+        mMgr->die(id);
+    }
+    
+    void getlog(const std::string& id, std::vector<std::string>& log, const Ice::Current&)
+    {
+        mMgr->getlog(id, log);
+    }
+
+    void clearlog(const std::string& id, const Ice::Current&)
+    {
+        mMgr->clearlog(id);
+    }
+
+private:
+    EndpointManagerPtr mMgr;
 };
 
 namespace AsteriskSCF
@@ -436,6 +487,8 @@ public:
     {
         mEndpointProxy =
             AsteriskSCF::Core::Endpoint::V1::BaseEndpointPrx::checkedCast(adapter->add(mManager, adapter->getCommunicator()->stringToIdentity(mManagerId + ".Endpoint")));
+        mCommands = new CommandImpl(mManager);
+        adapter->add(mCommands, adapter->getCommunicator()->stringToIdentity(mManagerId + ".Commands"));
     }
 
     AsteriskSCF::Core::Endpoint::V1::EndpointSeq lookup(const std::string& destination, const Ice::Current&)
@@ -445,26 +498,21 @@ public:
         return result;
     }
 
-    CommandsPtr getCommandInterface()
-    {
-        return CommandsPtr::dynamicCast(mManager);
-    }
-
 private:
 
     Ice::ObjectAdapterPtr mAdapter;
     std::string mManagerId;
     EndpointManagerPtr mManager;
+    AsteriskSCF::TestChannel::V1::CommandsPtr mCommands;
     AsteriskSCF::Core::Endpoint::V1::BaseEndpointPrx mEndpointProxy;
 };
 
 typedef IceUtil::Handle<EndpointLocatorI> EndpointLocatorIPtr;
 
-AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr TestEndpoint::create(const CommandDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id)
+AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr TestEndpoint::create(const Ice::ObjectAdapterPtr& adapter, const std::string& id)
 {
     
     EndpointLocatorIPtr impl(new EndpointLocatorI(adapter, id));
-    driver->setHandler(CommandsPtr::dynamicCast(impl->getCommandInterface()));
     return  AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr::dynamicCast(impl);
 }
 
diff --git a/include/TestEndpoint.h b/src/TestEndpoint.h
old mode 100755
new mode 100644
similarity index 78%
rename from include/TestEndpoint.h
rename to src/TestEndpoint.h
index 19fb508..f59680a
--- a/include/TestEndpoint.h
+++ b/src/TestEndpoint.h
@@ -11,8 +11,6 @@
 #include <Core/Routing/RoutingIf.h>
 
 #include <boost/thread/shared_mutex.hpp>
-#include <Commands.h>
-#include "Config.h"
 
 namespace AsteriskSCF
 {
@@ -20,7 +18,7 @@ namespace TestUtil
 {
     //
     // For the moment basically a factory that creates 
-    class TEST_CHANNEL_EXPORT TestEndpoint
+    class TestEndpoint
     {
         //
         // TestEndpoint currently doesn't support any instance specific
@@ -28,7 +26,7 @@ namespace TestUtil
         //
         TestEndpoint() {}
     public:
-        static AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr create(const CommandDriverPtr& driver, const Ice::ObjectAdapterPtr& adapter, const std::string& id);
+        static AsteriskSCF::Core::Routing::V1::EndpointLocatorPtr create(const Ice::ObjectAdapterPtr& adapter, const std::string& id);
     };
 }
 } // End of namespace AsteriskSCF
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..1228126
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,55 @@
+/*
+* Asterisk Scalable Communications Framework
+*
+* Copyright (C) 2010 -- Digium, Inc.
+*
+* All rights reserved.
+*/
+#include <Ice/Ice.h>
+
+#include "ConsoleDriver.h"
+#include <iostream>
+
+class ConsoleApp : public Ice::Application
+{
+public:
+    ConsoleApp() 
+    {
+    }
+
+protected:
+    int run(int argc, char* argv[]);
+    void interruptCallback(int);
+
+    ConsoleDriverPtr mConsoleDriver;
+};
+
+
+int ConsoleApp::run(int, char**)
+{
+    callbackOnInterrupt();
+
+    AsteriskSCF::TestChannel::V1::CommandsPrx commandIf =  
+        AsteriskSCF::TestChannel::V1::CommandsPrx::checkedCast(communicator()->propertyToProxy("TestCommands.Proxy"));
+    if(!commandIf)
+    {
+        std::cerr << "Unable to access command interface, check configuration and if the service is running." << std::endl;
+        return EXIT_FAILURE;
+    }
+    mConsoleDriver = new ConsoleDriver;
+    mConsoleDriver->setHandler(commandIf);
+    mConsoleDriver->start();
+    return EXIT_SUCCESS;
+}
+
+void ConsoleApp::interruptCallback(int)
+{
+    mConsoleDriver->destroy();
+    communicator()->shutdown();
+}
+
+int main(int argc, char** argv)
+{
+    ConsoleApp app;
+    return app.main(argc, argv);
+}

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


-- 
asterisk-scf/integration/test_channel.git



More information about the asterisk-scf-commits mailing list