[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "nat-traversal" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri May 13 15:33:31 CDT 2011


branch "nat-traversal" has been updated
       via  5f043c5c94c23df52f967d8f5a68b898cd8610bd (commit)
       via  e8b2cf2c740beb7227dd97e6123ba168dbd06fb9 (commit)
       via  3f83eaaeae44fb9716be7e0932fb52b67dbfb759 (commit)
       via  a2e2aeeb76490683de851af22bd09063a387c7be (commit)
       via  f268b4a8686fa136d4b6a4894d7232a439cf0b6f (commit)
       via  2e7eef7d9b5b1f8a1a829f6d626084f49021abe7 (commit)
       via  5077625e83930a58b416ecac15e4a5a4faddf206 (commit)
       via  c7e5b4344e2f6745eeae14f1d77b6606a32475f7 (commit)
       via  2e4c74f5339433707eec29646d525d90be864ecc (commit)
       via  fd891bdc0b102fa187af0d4f44c24b1ded09c590 (commit)
       via  de1c49f45105d4a62b9572f8bf4efbf8c718933c (commit)
       via  0791f44ddb97bced3ded5da19580ba16966e9f63 (commit)
       via  2d535b3c8813521ba060c544c80baabc2b452f76 (commit)
       via  4c8c74c547955dd93c9e15d2f5c188918517aeeb (commit)
       via  ca95f560a6c8ccf5b3ffd2bff26249b982ecedea (commit)
       via  307e2b902ca3b1466aff00951914feb31bdedfec (commit)
       via  0fafee70d034c4406eb11b37817b12a70b50304e (commit)
       via  1f886e1225940e228bec9a983cf4a7b844e69cb4 (commit)
       via  24244fa6392253ffe2ff6c60757435be1b26da20 (commit)
       via  2b68a207e8b733c5d32f7f3baa63ab743a4a4f82 (commit)
       via  872dc33703f403a63e896a8b778a1e43fa7bad09 (commit)
       via  929982dac23f77950f2b7ff18ec85b51a42de558 (commit)
       via  95c838e77ca99e63a13721981e2aa07867c4bea1 (commit)
       via  d7418a0d23a8a23431e859442c782501abfc0553 (commit)
       via  7a25b8073e1e0d2bb2391a3feafb61b6bdacb380 (commit)
       via  6ced932f19f094541afd5c7ef8b069ea83f26438 (commit)
       via  238e6bb3ddcb4d697e3ac5189c73e0683132ad5e (commit)
       via  04e2c162bc7f6cd6b9bceb74089d1a9a29148b59 (commit)
       via  0c1ba29dc6631ac5ce38a3d2629fe17afcd39627 (commit)
       via  df6502431fb6d495c88eb9a223820f063432bd7e (commit)
       via  6fa0d1a69f5290d1154951965017380dc4e61825 (commit)
       via  06ba07d7d56ed8447eeb188eb4bb5770a9c41adc (commit)
       via  a2ce7d678f3574f6f63691dacead5e2574ded080 (commit)
       via  413bb6369fb40c99a952305fa924dc087da7792c (commit)
       via  626ae7f220d8b0ad44820a5110eeceb61248d032 (commit)
       via  ab478a5684fed6d71a1169104ff9067a240b1e81 (commit)
       via  dd6f1be516148b8f328adf3f174c43fe949a1b61 (commit)
       via  0024d93bcf841b13eec471b2d3f726cdbe686978 (commit)
       via  db6b6404ec286000fcb921edfe080fc6c2cc1c9d (commit)
       via  148efc74ad128c054300d461fb29ae8e31392bed (commit)
       via  dc0dbb97620670914e030aab47cf1e0f90915ef1 (commit)
       via  c5ed0db396867362132166c17aac2a74274bb48d (commit)
       via  891cedd06767489bf8e00b9c1b98318d9c09d3ef (commit)
       via  0f17de699ae1b4e8f7abdb69053405a30b4b7952 (commit)
       via  4c5178bacdf897e9717c93187b2bcb657f2e1871 (commit)
       via  d17c5711691e51a7a46e787da409c568e8dc6cfd (commit)
       via  e37d9494e7db63a6f9e0798020dc3de62533da91 (commit)
       via  72138cabee93955fb3d648ac78c1faea422e2733 (commit)
       via  01940e42606ff1b41b53778a2b5148021be8d80b (commit)
       via  053aefa444ff4d34070d67d6f45809005c9c7c57 (commit)
       via  8b96c2315423a29b508d1d32622b5fd28b386653 (commit)
       via  116744bd3cb957d26797c50bcc63e4c673ec49ad (commit)
       via  7560c60db1c62ab3b846eba93098d9e81f1be09d (commit)
       via  db9137c28c816f89efc2f9d69accd5e60cc7ec95 (commit)
       via  1cc1ec91224cb05370e8e996433ecb7b5f8201fe (commit)
       via  49098782accde3746af4857574c15ceac1ea7916 (commit)
       via  475da6c6e49647d883663e3b93e443c57f415169 (commit)
       via  0adc89a842ccb2893a472539fe89ffb2e032f41a (commit)
       via  f9be80d1e56708c2673f952d14a0a42b35cb891e (commit)
       via  c004843947a6e1724a08225c7791cb46eee01304 (commit)
      from  e8979048bb3679d1332b9abfd7e59a89f345efa4 (commit)

Summary of changes:
 CMakeLists.txt                              |   39 +-
 config/Configurator.py                      |  179 ++++
 config/Sip.config                           |   77 ++
 config/SipConfigurator.py                   |  166 +++
 local-slice/SipConfigurationIf.ice          |  535 +++++++---
 src/CMakeLists.txt                          |   68 +-
 src/PJSipLoggingModule.cpp                  |    4 +-
 src/PJSipManager.cpp                        |  560 ++---------
 src/PJSipManager.h                          |   41 +-
 src/PJSipModule.h                           |    2 +-
 src/PJSipSessionModule.cpp                  |  215 +++-
 src/PJSipSessionModule.h                    |    1 +
 src/PJSipSessionModuleConstruction.cpp      |    3 +-
 src/{DebugUtil.h => PJUtil.h}               |   18 +-
 src/STUNModule.cpp                          |  156 +++
 src/STUNModule.h                            |   95 ++
 src/{PJSipManager.cpp => STUNTransport.cpp} |  297 +-----
 src/{DebugUtil.h => STUNTransport.h}        |   26 +-
 src/SipConfiguration.cpp                    | 1494 +++++++++++++++++++++++++++
 src/SipConfiguration.h                      |   48 +
 src/SipEndpoint.cpp                         |   33 +
 src/SipEndpoint.h                           |   12 +
 src/SipEndpointFactory.cpp                  |   17 +-
 src/SipEndpointFactory.h                    |   10 +-
 src/SipModule.h                             |   68 ++
 src/SipSession.cpp                          |  140 ++--
 src/SipSession.h                            |    1 +
 src/SipSessionManagerApp.cpp                |   26 +-
 src/SipSessionManagerEndpointLocator.cpp    |   16 +-
 src/SipSessionManagerEndpointLocator.h      |    3 +-
 src/SipStateReplicatorApp.cpp               |    4 +-
 src/SipStateReplicatorListener.cpp          |    4 +-
 src/TCPTransport.cpp                        |   95 ++
 src/{DebugUtil.h => TCPTransport.h}         |   26 +-
 src/TLSTransport.cpp                        |   70 ++
 src/{DebugUtil.h => TLSTransport.h}         |   30 +-
 src/Transports.cpp                          |   54 +
 src/Transports.h                            |   75 ++
 src/UDPTransport.cpp                        |  100 ++
 src/{DebugUtil.h => UDPTransport.h}         |   24 +-
 40 files changed, 3579 insertions(+), 1253 deletions(-)
 create mode 100755 config/Configurator.py
 create mode 100644 config/Sip.config
 create mode 100755 config/SipConfigurator.py
 copy src/{DebugUtil.h => PJUtil.h} (66%)
 create mode 100644 src/STUNModule.cpp
 create mode 100644 src/STUNModule.h
 copy src/{PJSipManager.cpp => STUNTransport.cpp} (58%)
 copy src/{DebugUtil.h => STUNTransport.h} (59%)
 create mode 100644 src/SipConfiguration.cpp
 create mode 100644 src/SipConfiguration.h
 create mode 100644 src/SipModule.h
 create mode 100644 src/TCPTransport.cpp
 copy src/{DebugUtil.h => TCPTransport.h} (62%)
 create mode 100644 src/TLSTransport.cpp
 copy src/{DebugUtil.h => TLSTransport.h} (57%)
 create mode 100644 src/Transports.cpp
 create mode 100644 src/Transports.h
 create mode 100644 src/UDPTransport.cpp
 copy src/{DebugUtil.h => UDPTransport.h} (63%)


- Log -----------------------------------------------------------------
commit 5f043c5c94c23df52f967d8f5a68b898cd8610bd
Author: Brent Eagles <beagles at digium.com>
Date:   Fri May 13 18:01:01 2011 -0230

    Restructured the different transport factory methods.

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 528f165..5873ee2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -22,6 +22,21 @@ asterisk_scf_component_add_file(SipSessionManager SipSession.cpp)
 asterisk_scf_component_add_file(SipSessionManager SipSession.h)
 asterisk_scf_component_add_file(SipSessionManager PJSipManager.cpp)
 asterisk_scf_component_add_file(SipSessionManager PJSipManager.h)
+asterisk_scf_component_add_file(SipSessionManager Transports.cpp)
+asterisk_scf_component_add_file(SipSessionManager Transports.h)
+asterisk_scf_component_add_file(SipSessionManager UDPTransport.cpp)
+asterisk_scf_component_add_file(SipSessionManager UDPTransport.h)
+asterisk_scf_component_add_file(SipSessionManager TCPTransport.cpp)
+asterisk_scf_component_add_file(SipSessionManager TCPTransport.h)
+asterisk_scf_component_add_file(SipSessionManager TLSTransport.cpp)
+asterisk_scf_component_add_file(SipSessionManager TLSTransport.h)
+asterisk_scf_component_add_file(SipSessionManager PJUtil.h)
+asterisk_scf_component_add_file(SipSessionManager DebugUtil.h)
+asterisk_scf_component_add_file(SipSessionManager SipModule.h)
+asterisk_scf_component_add_file(SipSessionManager STUNModule.cpp)
+asterisk_scf_component_add_file(SipSessionManager STUNModule.h)
+asterisk_scf_component_add_file(SipSessionManager STUNTransport.cpp)
+asterisk_scf_component_add_file(SipSessionManager STUNTransport.h)
 asterisk_scf_component_add_file(SipSessionManager PJSipModule.cpp)
 asterisk_scf_component_add_file(SipSessionManager PJSipModule.h)
 asterisk_scf_component_add_file(SipSessionManager PJSipSessionModule.cpp)
@@ -38,7 +53,7 @@ asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipIf.ice)
 asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipStateReplicationIf.ice)
 asterisk_scf_component_add_slice(SipSessionManager ../local-slice/SipConfigurationIf.ice)
 asterisk_scf_component_add_ice_libraries(SipSessionManager IceStorm)
-asterisk_scf_component_add_boost_libraries(SipSessionManager core)
+asterisk_scf_component_add_boost_libraries(SipSessionManager core system)
 asterisk_scf_component_build_icebox(SipSessionManager)
 target_link_libraries(SipSessionManager logging-client)
 pjproject_link(SipSessionManager pjsip)
diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index f299aac..304ccdc 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -18,17 +18,16 @@
 #include <AsteriskSCF/logger.h>
 #include <AsteriskSCF/System/ExceptionsIf.h>
 
-#include <boost/lexical_cast.hpp>
 #include "PJSipManager.h"
 
-#include "DebugUtil.h"
-
 #include <boost/shared_ptr.hpp>
 #include <boost/thread/locks.hpp>
 #include <vector>
 
-#include <pjnath/stun_sock.h>
-#include <pjnath/stun_session.h>
+#include "PJUtil.h"
+#include "STUNModule.h"
+#include "UDPTransport.h"
+#include <boost/lexical_cast.hpp>
 
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::System::V1;
@@ -46,484 +45,11 @@ namespace AsteriskSCF
 namespace SipSessionManager
 {
 
-static bool success(pj_status_t r)
-{
-    return r == PJ_SUCCESS;
-}
-
-static bool fail(pj_status_t r)
-{
-    return !success(r);
-}
-
-class STUNModule
-{
-public:
-    //
-    // TODO: More configuration details!
-    //
-    STUNModule(pj_pool_t* pool, pj_caching_pool& cachingPool, const Ice::PropertiesPtr& props) :
-        mPool(pool)
-    {
-        logger(Debug) << FUNLOG << " : initializing STUN module";
-        pj_status_t status = pjnath_init();
-        if (fail(status))
-        {
-            const char* message = "Unable to initialize PJNATH library.";
-            logger(Error) << message;
-            throw InternalInitializationException(message);
-        }
-        //
-        // We set the pool, queue, etc. to 0 because they are initialized later on.
-        // TODO: We may be able to use the main SIP ioqueue and timer heap. If so
-        // we can remove the poll method on this object.
-        //
-        pj_stun_config_init(&mConfig, &cachingPool.factory, 0, 0, 0);
-        status = pj_timer_heap_create(mPool, 
-            props->getPropertyAsIntWithDefault("Sip.PJSip.TimerHeap.Size", 1000), 
-            &mConfig.timer_heap);
-        if (fail(status))
-        {
-            const char* message = "Unable to initialize timer heap.";
-            logger(Error) << message;
-            throw InternalInitializationException(message);
-        }
-        status = pj_ioqueue_create(mPool, props->getPropertyAsIntWithDefault("Sip.PJSip.IOQueue.MaxSize", 16), 
-            &mConfig.ioqueue);
-        if (fail(status))
-        {
-            const char* message = "Unable to initialize IO queue.";
-            logger(Error) << message;
-            throw InternalInitializationException(message);
-        }
-    }
-
-    void poll()
-    {
-        const pj_time_val delay = {0, 10};
-        pj_ioqueue_poll(mConfig.ioqueue, &delay);
-        pj_timer_heap_poll(mConfig.timer_heap, 0);
-    }
-
-    ~STUNModule()
-    {
-        pj_ioqueue_destroy(mConfig.ioqueue);
-        mConfig.ioqueue = 0;
-        pj_timer_heap_destroy(mConfig.timer_heap);
-        mConfig.timer_heap = 0;
-    }
-
-    /**
-     * This is "sketchy". There is no mutex protection, etc. While the shared pointer would prevent
-     * accessing memory that no longer exists (if it is *used*), this accessor is really only for
-     * use during initialization when there shouldn't be much going on.
-     **/
-    pj_stun_config* getConfig()
-    {
-        return &mConfig;
-    }
-
-    pj_pool_t* getPool()
-    {
-        return mPool;
-    }
-
-    //
-    // TODO: I think PJNATH takes care of all of the required cleanups via the pools, so there is nothing for a
-    // destructor to do. This code could just as easily be put inline, but I figured the PJSipManager might
-    // have to have other stuff added in later on, so compartamentalizing this code seemed good for organization.
-    // The presence of non-0 value in the member pointer also serves double duty as a flag that that STUN
-    // has been configured.
-    //
-
-private:
-    pj_stun_config mConfig;
-    pj_pool_t* mPool;
-};
-typedef boost::shared_ptr<STUNModule> STUNModulePtr;
-
 //
 // TODO: The Transport/TransportFactory classes could be extended to allow multiple transports to
 // be configured on this endpoint. 
 // 
 
-class UDPTransport : public Transport
-{
-public:
-    UDPTransport(pjsip_endpoint* endpoint, const Ice::PropertiesPtr& props)
-    {
-        logger(Debug) << FUNLOG << " : initializing UDP transport";
-         //
-        // TODO: const table for property names?
-        //
-        string bindAddr = props->getPropertyWithDefault("Sip.Transport.UdpBindAddr", "0.0.0.0:5060");
-
-        //
-        // UNSPEC family means "you figure out the address family, pjlib!"
-        //
-        pj_sockaddr udpAddr;
-        pj_str_t pjAddrStr;
-        pj_sockaddr_parse(pj_AF_UNSPEC(), 0, pj_cstr(&pjAddrStr, bindAddr.c_str()), &udpAddr);
-        
-        if (udpAddr.addr.sa_family == pj_AF_INET())
-        {
-            //
-            // XXX The fourth parameter should probably be controlled through
-            // configuration. PJSIP reference says it should be the number of
-            // processors on the machine.
-            //
-             pj_status_t status = pjsip_udp_transport_start(endpoint, &udpAddr.ipv4, NULL, 2, &mSocket);
-             if (fail(status))
-             {
-                 const char* msg = "Failed to create IPv4 UDP transport.";
-                 logger(Error) << msg;
-                 throw InternalInitializationException(msg);
-             }
-        }
-        else if (udpAddr.addr.sa_family == pj_AF_INET6())
-        {
-            pj_status_t status = pjsip_udp_transport_start6(endpoint, &udpAddr.ipv6, NULL, 2, &mSocket);
-            if (fail(status))
-            {
-                const char* msg = "Failed to create IPv6 UDP transport.";
-                logger(Error) << msg;
-                throw InternalInitializationException(msg);
-            }
-        }
-    };
-    
-    ~UDPTransport()
-    {
-        //
-        // We don't have to worry about cleaning up. PJSIP takes care of that.
-        //
-        mSocket = 0;
-    };
-
-private:
-    pjsip_transport* mSocket;
-};
-
-class STUNTransport : public Transport
-{
-private:
-    /**
-     * Callback methods for the STUN socket callback data structure.
-     **/
-    static pj_bool_t onRxData(pj_stun_sock* stunSock, void* packet, unsigned packetLength, 
-        const pj_sockaddr_t* sourceAddress, unsigned addressLength)
-    {
-        STUNTransport* t = reinterpret_cast<STUNTransport*>(pj_stun_sock_get_user_data(stunSock));
-        t->dataReceived(packet, packetLength, sourceAddress, addressLength);
-        return PJ_TRUE;
-    }
-
-    static pj_bool_t onDataSent(pj_stun_sock* stunSock, pj_ioqueue_op_key_t* sendKey, pj_ssize_t sent)
-    {
-        //
-        // TODO. We could rig this up to allow asynchronous replies to the 
-        // PJSIP transport manager.
-        //
-        return PJ_TRUE;
-    }
-
-    static pj_bool_t onStatus(pj_stun_sock* stunSock, pj_stun_sock_op operation, pj_status_t status)
-    {
-        //
-        // Respond to binding update.
-        // TODO: We should allow this to change over time, so we need to have some thread
-        // safety around initTransport.
-        //
-        if (operation == PJ_STUN_SOCK_BINDING_OP)
-        {
-            //
-            // NOTE: If you watch the PJNATH tracing, you will see binding requests occurring periodically, but 
-            // it doesn't seem to enter here for each request. I suspect PJNATH checks to see if the mapped
-            // address has changed or not before firing a PJ_STUN_SOCK_BINDING_OP notification.
-            //
-            STUNTransport* t = reinterpret_cast<STUNTransport*>(pj_stun_sock_get_user_data(stunSock));
-            if (t)
-            {
-                t->updateBinding();
-            }
-        }
-        return PJ_TRUE;
-    }
-
-    //
-    // Integration methods for STUN transport.
-    //
-    static pj_status_t sendMsgImpl(pjsip_transport* transport, pjsip_tx_data* data, const pj_sockaddr_t* remoteAddress,
-        int remoteAddressLength, void* token, pjsip_transport_callback callback)
-    {
-        STUNTransport* t = reinterpret_cast<STUNTransport*>(transport->data);
-        return t->sendData(data, remoteAddress, remoteAddressLength, token, callback);
-    }
-
-    static pj_status_t shutdownImpl(pjsip_transport* transport)
-    {
-        //
-        // The STUN transport doesn't have a distinct shutdown.
-        //
-        return PJ_SUCCESS;
-    }
-
-    static pj_status_t destroyImpl(pjsip_transport* transport)
-    {
-        STUNTransport* t = reinterpret_cast<STUNTransport*>(transport->data);
-        t->destroy();
-        return PJ_SUCCESS;
-    }
-
-public:
-    STUNTransport(pjsip_endpoint* endpoint, const Ice::PropertiesPtr& props, const STUNModulePtr& stun) :
-      mDestroyed(false),
-      mEndpoint(endpoint),
-      mModule(stun),
-      mSocket(0)
-    {
-        assert(stun);
-        logger(Debug) << FUNLOG << " : initializing STUN transport";
-
-        //
-        // Get default configuration from library.
-        //
-        pj_stun_sock_cfg socketConfig;
-        pj_stun_sock_cfg_default(&socketConfig);
-
-        //
-        // Setup the callback structure. PJNATH will call these functions when the relevant events occur
-        // on the STUN socket. These are hooked up as basically NO-OPs for the moment. If it turns out
-        // that they are not necessary, the callbacks should be removed to reduce that slight bit of 
-        // overhead.
-        //
-        pj_stun_sock_cb stunSockCB;
-        memset(&stunSockCB, 0, sizeof stunSockCB);
-        stunSockCB.on_status = &onStatus;
-        stunSockCB.on_rx_data = &onRxData;
-        stunSockCB.on_data_sent = &onDataSent;
-
-        //
-        // TODO: const table for property names, and allow for different bind addr for STUN enabled
-        // transports.
-        //
-        string bindAddr = props->getPropertyWithDefault("Sip.Transport.UdpBindAddr", "0.0.0.0:5060");
-        pj_sockaddr udpAddr;
-        pj_str_t pjAddrStr;
-        pj_sockaddr_parse(pj_AF_UNSPEC(), 0, pj_cstr(&pjAddrStr, bindAddr.c_str()), &udpAddr);
-
-        pj_status_t result = pj_stun_sock_create(mModule->getConfig(), 0, udpAddr.addr.sa_family, &stunSockCB, 
-            &socketConfig, this, &mSocket);
-        if (fail(result))
-        {
-            const char* message = "Failed to initalize STUN socket.";
-            logger(Error) << message;
-            throw InternalInitializationException(message);
-            //
-            // TODO: Throw!
-            //
-        }
-
-        string stunServerProperty = props->getProperty("Sip.Transport.STUN.Server");
-        auto_ptr<pj_str_t> stunServer;
-        if (!stunServerProperty.empty())
-        {
-            stunServer = auto_ptr<pj_str_t>(new pj_str_t);
-            pj_cstr(stunServer.get(), stunServerProperty.c_str());
-            logger(Debug) << FUNLOG << " proceeding with STUN server " << stunServerProperty;
-        }
-
-        pj_uint16_t port = props->getPropertyAsIntWithDefault("Sip.Transport.STUN.Port", PJ_STUN_PORT);
-        logger(Debug) << FUNLOG << " proceeding with STUN server " << stunServerProperty;
-
-        //
-        // TODO: More config! We may want to initialize and configure a resolver object.
-        //
-        result = pj_stun_sock_start(mSocket, stunServer.get(), port, 0);
-        if (fail(result))
-        {
-            const char* message = "Failed to start STUN socket."; 
-            logger(Error) << message;
-            throw InternalInitializationException(message);
-        }
-        pj_stun_sock_info socketInfo;
-        result = pj_stun_sock_get_info(mSocket, &socketInfo);
-        if (fail(result))
-        {
-            throw InternalInitializationException("get_info on STUN socket failed");
-        }
-        if (pj_sockaddr_has_addr(&socketInfo.mapped_addr))
-        {
-            updateBinding();
-        }
-    };
-
-    ~STUNTransport()
-    {
-        if (mSocket)
-        {
-            pj_stun_sock_destroy(mSocket);
-        }
-    };
-
-private:
-    boost::shared_mutex mLock;
-    bool mDestroyed;
-
-    pjsip_endpoint* mEndpoint;
-    STUNModulePtr mModule;
-    pj_stun_sock* mSocket;
-    boost::shared_ptr<pjsip_transport> mTransport;
-
-    void destroy()
-    {
-        bool doDestroy = false;
-        {
-            boost::unique_lock<boost::shared_mutex> lock(mLock);
-            if (mSocket && !mDestroyed)
-            {
-                doDestroy = true;
-                mDestroyed = true;
-            }
-        }
-        if (doDestroy)
-        {
-            pj_status_t result = pj_stun_sock_destroy(mSocket);
-            if (fail(result))
-            {
-                logger(Error) << "unable to destroy STUN socket";
-            }
-        }
-    }
-
-    bool isRegistered()
-    {
-        boost::shared_lock<boost::shared_mutex> lock(mLock);
-        return mTransport != 0;
-    }
-
-    boost::shared_ptr<pjsip_transport> getCurrentTransport()
-    {
-        boost::shared_lock<boost::shared_mutex> lock(mLock);
-        return mTransport;
-    }
-
-    boost::shared_ptr<pjsip_transport> resetCurrentTransport(const boost::shared_ptr<pjsip_transport>& transport)
-    {
-        boost::unique_lock<boost::shared_mutex> lock(mLock);
-        boost::shared_ptr<pjsip_transport> current = mTransport;
-        mTransport = transport;
-        return current;
-    }
-
-    void updateBinding()
-    {
-        boost::shared_ptr<pjsip_transport> newTransport(new pjsip_transport);
-        initTransport(newTransport);
-        pj_status_t result = pjsip_transport_register(newTransport->tpmgr, newTransport.get());
-        if (fail(result))
-        {
-            logger(Error) << "Unable to register STUN enabled transport";
-            return;
-        }
-
-        //
-        // TODO: The order of register and destroy might have to be reversed for this to work properly.
-        //
-        boost::shared_ptr<pjsip_transport> oldTransport = resetCurrentTransport(newTransport);
-        if (oldTransport)
-        {
-            pjsip_transport_destroy(oldTransport.get());
-        }
-    }
-
-    void initTransport(const boost::shared_ptr<pjsip_transport>& transport)
-    {
-        assert(transport != 0);
-        memset(transport.get(), 0, sizeof *transport);
-        strcpy(transport->obj_name, "ASCF"); // TODO: proper name initialization.
-        transport->send_msg = &sendMsgImpl;
-        transport->do_shutdown = &shutdownImpl;
-        transport->destroy = &destroyImpl;
-        transport->endpt = mEndpoint;
-        transport->tpmgr = pjsip_endpt_get_tpmgr(mEndpoint);
-        transport->pool = mModule->getPool();
-        transport->data = this;
-
-        pj_status_t result = pj_atomic_create(transport->pool, 0, &transport->ref_cnt);
-        if (fail(result))
-        {
-            logger(Error) << "Unable to create reference count for STUN transport";
-            return;
-        }
-
-        result = pj_lock_create_recursive_mutex(transport->pool, transport->pool->obj_name, &transport->lock);
-        if (fail(result))
-        {
-            logger(Error) << "Unable to create mutex for STUN transport";
-            return;
-        }
-
-        transport->type_name = "ASCF_SIP_NAT";
-        transport->info = "Asterisk SCF PJNATH based SIP transport";
-        transport->remote_name.host = pj_str("0.0.0.0");
-        transport->remote_name.port = 0;
-        
-        pj_stun_sock_info socketInfo;
-        result = pj_stun_sock_get_info(mSocket, &socketInfo);
-        if (fail(result))
-        {
-            logger(Error) << "Unable to get socket info for STUN transport";
-            return;
-        }
-
-        char buf[PJ_INET6_ADDRSTRLEN];
-        pj_strdup2(mModule->getPool(), &transport->local_name.host,
-                pj_sockaddr_print(&socketInfo.mapped_addr, buf, sizeof buf, 0));
-        transport->local_name.port = pj_sockaddr_get_port(&socketInfo.mapped_addr);
-        memcpy(&transport->local_addr, &socketInfo.bound_addr, sizeof &transport->local_addr);
-        transport->addr_len = sizeof transport->local_addr;
-    }
-
-    void dataReceived(void* packet, unsigned packetLength, const pj_sockaddr_t* sourceAddress, unsigned addressLength)
-    {
-        boost::shared_ptr<pjsip_transport> transport(getCurrentTransport());
-        pjsip_rx_data* data = reinterpret_cast<pjsip_rx_data*>(pj_pool_zalloc(mModule->getPool(), sizeof pjsip_rx_data));
-        data->tp_info.pool = mModule->getPool();
-        data->tp_info.transport = transport.get();
-        data->tp_info.tp_data = 0;
-        data->tp_info.op_key.rdata = data;
-        pj_ioqueue_op_key_init(&(data->tp_info.op_key.op_key), sizeof data->tp_info.op_key.op_key);
-
-
-        pj_gettimeofday(&data->pkt_info.timestamp);
-        if (packetLength > sizeof data->pkt_info.packet)
-        {
-            assert(false); // XXX houston, we have a problem.
-        }
-        data->pkt_info.len = packetLength;
-        data->pkt_info.zero = 0;
-        memcpy(data->pkt_info.packet, reinterpret_cast<const char*>(packet), data->pkt_info.len); 
-        memcpy(&data->pkt_info.src_addr, reinterpret_cast<const pj_sockaddr*>(sourceAddress), addressLength);
-        data->pkt_info.src_addr_len = addressLength;
-        pj_sockaddr_print(&data->pkt_info.src_addr, data->pkt_info.src_name, 
-            sizeof data->pkt_info.src_name, 0);
-        data->pkt_info.src_port = pj_sockaddr_get_port(&data->pkt_info.src_addr);
-        pj_size_t bytesReceived = pjsip_tpmgr_receive_packet(transport->tpmgr, data);
-        if (bytesReceived < 0)
-        {
-            assert(false);
-        }
-    }
-
-    pj_status_t sendData(pjsip_tx_data* data, const pj_sockaddr_t* remoteAddress, int remoteAddressLength, 
-        void* token, pjsip_transport_callback callback)
-    {
-        return pj_stun_sock_sendto(mSocket, &data->op_key.key, &data->buf.start, data->buf.cur - data->buf.start, 0,
-            remoteAddress, remoteAddressLength);
-    }
-};
-
 static void *monitorThread(void *endpt)
 {
     PJSipManager* endpoint = reinterpret_cast<PJSipManager*> (endpt);
@@ -557,7 +83,6 @@ PJSipManager::PJSipManager(const Ice::PropertiesPtr& props) :
     pj_caching_pool_init(&mCachingPool, NULL, 1024 * 1024);
     pjsip_endpt_create(&mCachingPool.factory, "SIP", &mEndpoint);
 
-
     //
     // Careful! This was after the setTransports call, so reordering it might cause issues.
     //
@@ -568,7 +93,7 @@ PJSipManager::PJSipManager(const Ice::PropertiesPtr& props) :
         logger(Error) << message;
         throw InternalInitializationException(message);
     }
-
+    
     //
     // Initialize the global STUN configuration if it is enabled.
     //
@@ -576,14 +101,10 @@ PJSipManager::PJSipManager(const Ice::PropertiesPtr& props) :
     {
         if (props->getPropertyAsIntWithDefault("Sip.Transport.STUN.Enable", 0) == 1)
         {
-            mSTUN = boost::shared_ptr<STUNModule>(new STUNModule(mMemoryPool, mCachingPool, props));
+            mModules["STUN"] = STUNModule::create(shared_from_this(), props, logger);
         }
-        mTransports.push_back(boost::shared_ptr<Transport>(new STUNTransport(mEndpoint, props, mSTUN)));
-    }
-    else
-    {
-        mTransports.push_back(boost::shared_ptr<Transport>(new UDPTransport(mEndpoint, props)));
     }
+    initializeDefaultTransports(props);
 
     status = pj_thread_create(mMemoryPool, "SIP", (pj_thread_proc *) &monitorThread,
         this, PJ_THREAD_DEFAULT_STACK_SIZE * 2, 0, &mPjThread);
@@ -597,9 +118,20 @@ PJSipManager::PJSipManager(const Ice::PropertiesPtr& props) :
 
 PJSipManager::~PJSipManager()
 {
-    //
-    // TODO: Surely there are some cleanups required here.
-    //
+    for (SipModuleMap::iterator i = mModules.begin(); i != mModules.end(); ++i)
+    {
+        i->second->destroy();
+        i->second.reset();
+    }
+    for (TransportSeq::const_iterator i = mTransports.begin(); i != mTransports.end(); ++i)
+    {
+        (*i)->destroy();
+    }
+}
+
+pjsip_endpoint* PJSipManager::getEndpoint()
+{
+    return mEndpoint;
 }
 
 void PJSipManager::registerSessionModule(const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
@@ -619,15 +151,26 @@ void PJSipManager::registerLoggingModule()
     mLoggingModule = new PJSipLoggingModule(mEndpoint);
 }
 
-void PJSipManager::handleEvents()
+void PJSipManager::addTransport(const TransportPtr& transport)
 {
-    //
-    // XXX: The polling for the two pools should probably be occurring in separate threads.
-    //
-    if (mSTUN)
+    boost::unique_lock<boost::shared_mutex> lock(mLock);
+    mTransports.push_back(transport);
+}
+
+SipModulePtr PJSipManager::getModule(const string& moduleName)
+{
+    boost::shared_lock<boost::shared_mutex> lock(mLock);
+    SipModuleMap::const_iterator i = mModules.find(moduleName);
+    if (i != mModules.end())
     {
-        mSTUN->poll();
+        return i->second;
     }
+    return SipModulePtr();
+}
+
+void PJSipManager::handleEvents()
+{
+    onHandleEvents(mModules);
     const pj_time_val delay = {0, 10};
     pjsip_endpt_handle_events(mEndpoint, &delay);
 }
@@ -642,106 +185,32 @@ PJSipLoggingModule *PJSipManager::getLoggingModule()
     return mLoggingModule;
 }
 
-bool PJSipManager::setTransports(pjsip_endpoint *endpoint, const Ice::PropertiesPtr& props)
+pj_caching_pool* PJSipManager::getCachingPool()
 {
-    //XXX We'll also want to allow for TCP and TLS-specific
-    //addresses to be specified.
-    pj_sockaddr udpAddr;
-    pj_status_t status;
-    std::string udpBindAddr = props->getPropertyWithDefault("Sip.Transport.UdpBindAddr", "0.0.0.0:5060");
-    pj_str_t udpString;
-    pj_cstr(&udpString, udpBindAddr.c_str());
-    //UNSPEC family means "you figure out the address family, pjlib!"
-    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &udpString, &udpAddr);
-    if (udpAddr.addr.sa_family == pj_AF_INET())
-    {
-        //XXX The fourth parameter should probably be controlled through
-        //configuration. PJSIP reference says it should be the number of
-        //processors on the machine.
-        //
-        status = pjsip_udp_transport_start(endpoint, &udpAddr.ipv4, NULL, 2, &mUdpTransport);
-        if (status != PJ_SUCCESS)
-        {
-            lg(Error) << "Failed to create IPv4 UDP transport. DANG!";
-        }
-    }
-    else if (udpAddr.addr.sa_family == pj_AF_INET6())
-    {
-        status = pjsip_udp_transport_start6(endpoint, &udpAddr.ipv6, NULL, 2, &mUdpTransport);
-        if (status != PJ_SUCCESS)
-        {
-            lg(Error) << "Failed to create IPv4 UDP transport. DANG!";
-        }
-    }
-    //XXX Note that TCP and TLS stuff should be done here. Also note that
-    //currently PJSIP does not have functions for starting IPv6 TCP or
-    //TLS transports, so we'll have to modify the code to allow for it.
-    return true;
+    return &mCachingPool;
 }
 
-pjsip_transport *PJSipManager::createUDPTransport(std::string address, int port)
+pj_pool_t* PJSipManager::getMemoryPool()
 {
-    pj_sockaddr udpAddr;
-    pj_status_t status;
-    pj_str_t udpString;
-    pj_cstr(&udpString, address.c_str());
-    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &udpString, &udpAddr);
-    pj_sockaddr_set_port(&udpAddr, boost::lexical_cast<pj_uint16_t>(port));
-
-    pjsip_transport *udpTransport = NULL;
-    if (udpAddr.addr.sa_family == pj_AF_INET())
-    {
-	status = pjsip_udp_transport_start(mEndpoint, &udpAddr.ipv4, NULL, 2, &udpTransport);
-    }
-    else if (udpAddr.addr.sa_family == pj_AF_INET6())
-    {
-	status = pjsip_udp_transport_start6(mEndpoint, &udpAddr.ipv6, NULL, 2, &udpTransport);
-    }
-
-    if (status != PJ_SUCCESS)
-    {
-	lg(Error) << "Failed to create UDP transport.";
-    }
-
-    return udpTransport;
+    return mMemoryPool;
 }
 
-pjsip_tpfactory *PJSipManager::createTCPTransport(std::string address, int port)
+void PJSipManager::initializeDefaultTransports(const Ice::PropertiesPtr& properties)
 {
-    pj_sockaddr tcpAddr;
-    pj_str_t tcpString;
-    pj_cstr(&tcpString, address.c_str());
-    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &tcpString, &tcpAddr);
-    pj_sockaddr_set_port(&tcpAddr, boost::lexical_cast<pj_uint16_t>(port));
-
-    pjsip_tpfactory *tcpTransport = NULL;
-
-    if (pjsip_tcp_transport_start(mEndpoint, &tcpAddr, 2, &tcpTransport) != PJ_SUCCESS)
+    string bindAddress = properties->getPropertyWithDefault("Sip.Transport.UdpBindAddr", "0.0.0.0:5060");
+    string addressPart;
+    int portPart = 5060;
+    size_t colon = bindAddress.rfind(':');
+    if (colon != string::npos)
     {
-	lg(Error) << "Failed to create TCP transport.";
+        addressPart = bindAddress.substr(0, colon);
+        portPart = boost::lexical_cast<int>(bindAddress.substr(colon+1));
     }
-
-    return tcpTransport;
-}
-
-pjsip_tpfactory *PJSipManager::createTLSTransport(std::string address, int port, pjsip_tls_setting *)
-{
-    pj_sockaddr tlsAddr;
-    pj_str_t tlsString;
-    pj_cstr(&tlsString, address.c_str());
-    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &tlsString, &tlsAddr);
-    pj_sockaddr_set_port(&tlsAddr, boost::lexical_cast<pj_uint16_t>(port));
-
-    pjsip_tpfactory *tlsTransport = NULL;
-
-#if PJSIP_HAS_TLS_TRANSPORT
-    if (pjsip_tls_transport_start(mEndpoint, tlsSettings, &tlsAddr, NULL, 2, &tlsTransport) != PJ_SUCCESS)
-#endif
+    else
     {
-        lg(Error) << "Failed to create TLS transport.";
+        addressPart = bindAddress;
     }
-
-    return tlsTransport;
+    mTransports.push_back(createUDPTransport(shared_from_this(), addressPart, portPart));
 }
 
 }; //End namespace SipSessionManager
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index b9b4bd4..0fc788e 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -29,6 +29,8 @@
 
 #include "PJSipSessionModule.h"
 #include "PJSipLoggingModule.h"
+#include "Transports.h"
+#include "SipModule.h"
 
 namespace AsteriskSCF
 {
@@ -36,41 +38,12 @@ namespace AsteriskSCF
 namespace SipSessionManager
 {
 
-//
-// Forward declarations.
-//
-class STUNModule;
-
-<<<<<<< HEAD
-/**
- * Base class for transport objects allocated during SIP endpoint initialization. The PJSIP manager
- * does not perform any operations on these objects at the moment.
- **/
-class Transport
-{
-public:
-    virtual ~Transport() {}
-};
-
-/**
-=======
-/**
- * Base class for transport objects allocated during SIP endpoint initialization. The PJSIP manager
- * does not perform any operations on these objects at the moment.
- **/
-class Transport
-{
-public:
-    virtual ~Transport() {}
-};
-
-/**
->>>>>>> e8979048bb3679d1332b9abfd7e59a89f345efa4
+/*
  * This class is responsible for providing access to the pjsip_endpoint for the Asterisk SCF SIP component.
  *
  * In addition, it provides some common functions that many SIP services will use.
  */
-class PJSipManager
+class PJSipManager : public boost::enable_shared_from_this<PJSipManager>
 {
 public:
     PJSipManager(const Ice::PropertiesPtr& props);
@@ -93,6 +66,10 @@ public:
      */
     PJSipLoggingModule *getLoggingModule();
 
+    pj_caching_pool* getCachingPool();
+    
+    pj_pool_t* getMemoryPool();
+
     /**
      * Register the PJSipSessionModule, responsible
      * for basic call handling
@@ -111,23 +88,13 @@ public:
      */
     void registerLoggingModule();
 
-<<<<<<< HEAD
     /**
-     * Create a UDP transport.
-     */
-    pjsip_transport *createUDPTransport(std::string, int);
+     * Add a transport the module. TODO: does PJSipManager need this? That is, does the PJSipManager care?
+     **/
+    void addTransport(const TransportPtr& transport);
 
-    /**
-     * Create a TCP transport.
-     */
-    pjsip_tpfactory *createTCPTransport(std::string, int);
+    SipModulePtr getModule(const std::string& moduleName);
 
-    /**
-     * Create a TLS transport.
-     */
-    pjsip_tpfactory *createTLSTransport(std::string, int, pjsip_tls_setting*);
-=======
->>>>>>> e8979048bb3679d1332b9abfd7e59a89f345efa4
     void handleEvents();
 
 private:
@@ -138,8 +105,11 @@ private:
     pj_caching_pool mCachingPool;
     pj_pool_t *mMemoryPool;
 
-    boost::shared_ptr<STUNModule> mSTUN;
-    std::vector<boost::shared_ptr<Transport> > mTransports;
+    boost::shared_mutex mLock;
+    SipModuleMap mModules;
+    TransportSeq mTransports;
+
+    void initializeDefaultTransports(const Ice::PropertiesPtr& properties);
 };
 
 typedef boost::shared_ptr<PJSipManager> PJSipManagerPtr;
diff --git a/src/PJSipModule.h b/src/PJSipModule.h
index 706a582..716d6da 100644
--- a/src/PJSipModule.h
+++ b/src/PJSipModule.h
@@ -15,12 +15,12 @@
  */
 
 #pragma once
+
 #include <pjlib.h>
 #include <string>
 #include <pjsip.h>
 #include <pjsip_ua.h>
 
-
 #include <SipStateReplicationIf.h>
 
 namespace AsteriskSCF
diff --git a/src/PJUtil.h b/src/PJUtil.h
new file mode 100644
index 0000000..c30a1a6
--- /dev/null
+++ b/src/PJUtil.h
@@ -0,0 +1,37 @@
+/*
+ * 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 <pjlib.h>
+
+namespace AsteriskSCF
+{
+namespace SipSessionManager
+{
+
+inline bool success(pj_status_t r)
+{
+    return r == PJ_SUCCESS;
+}
+
+inline bool fail(pj_status_t r)
+{
+    return !success(r);
+}
+
+} /* End of namespace SipSessionManager */
+} /* End of namespace AsteriskSCF */
diff --git a/src/STUNModule.cpp b/src/STUNModule.cpp
new file mode 100644
index 0000000..aefee48
--- /dev/null
+++ b/src/STUNModule.cpp
@@ -0,0 +1,156 @@
+/*
+ * 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.
+ */
+
+#include "STUNModule.h"
+#include <pjlib.h>
+#include <pjnath.h>
+#include <Ice/Properties.h>
+#include <AsteriskSCF/logger.h>
+#include "PJSipManager.h"
+
+#include <pjnath/stun_sock.h>
+#include <pjnath/stun_session.h>
+#include <AsteriskSCF/System/ExceptionsIf.h>
+#include "DebugUtil.h"
+#include "PJUtil.h"
+
+using namespace AsteriskSCF::System::V1;
+using namespace AsteriskSCF::SipSessionManager;
+using namespace AsteriskSCF::System::Logging;
+
+namespace AsteriskSCF
+{
+namespace SipSessionManager
+{
+
+const pj_time_val DEFAULT_PROCESSING_TIMEOUT = { 0 /* seconds */, 100 /* milliseconds */ };
+
+//
+// Public methods.
+//
+STUNModule::~STUNModule()
+{
+    destroyImpl();
+}
+
+void STUNModule::destroy()
+{
+    destroyImpl();
+}
+
+void STUNModule::onHandleEvents()
+{
+    //
+    // Since the STUN module currently has it's own ioqueue and timer heap, we need to run them in a timely
+    // fashion. Every poll of the pjsip library seems appropriate.
+    // TODO: It may be possible to simply use the SIP endpoint's ioqueue for STUN transports, but
+    // this seems safter for the time being.
+    //
+    boost::shared_lock<boost::shared_mutex> lock(mLock);
+    pj_ioqueue_poll(mConfig->ioqueue, mTimeout.get());
+    pj_timer_heap_poll(mConfig->timer_heap, 0);
+}
+
+pj_stun_config* STUNModule::getConfig()
+{
+    return mConfig.get();
+}
+
+pj_pool_t* STUNModule::getPool()
+{
+    return mPool;
+}
+
+//
+// Static public
+//
+boost::shared_ptr<STUNModule> STUNModule::create(const PJSipManagerPtr& sipManager,
+        const Ice::PropertiesPtr& properties, const Logger& logger)
+{
+    logger(Debug) << FUNLOG << " : initializing STUN module";
+    pj_status_t status = pjnath_init();
+    if (fail(status))
+    {
+        const char* message = "Unable to initialize PJNATH library.";
+        logger(Error) << message;
+        throw InternalInitializationException(message);
+    }
+
+    boost::shared_ptr<pj_stun_config> config(new pj_stun_config);
+    
+    //
+    // We set the pool, queue, etc. to 0 because they are initialized later on.
+    // TODO: We may be able to use the main SIP ioqueue and timer heap. If so
+    // we can remove the poll method on this object.
+    //
+    pj_stun_config_init(config.get(), &sipManager->getCachingPool()->factory, 0, 0, 0);
+    
+    status = pj_timer_heap_create(sipManager->getMemoryPool(), 
+            properties->getPropertyAsIntWithDefault("Sip.PJSip.TimerHeap.Size", 1000), 
+            &(config->timer_heap));
+    
+    if (fail(status))
+    {
+        //
+        // No far we haven't allocated anything that won't clean up after itself, so we can just throw here.
+        //
+        const char* message = "Unable to initialize timer heap.";
+        logger(Error) << message;
+        throw InternalInitializationException(message);
+    }
+
+    status = pj_ioqueue_create(sipManager->getMemoryPool(), properties->getPropertyAsIntWithDefault("Sip.PJSip.IOQueue.MaxSize", 16), 
+            &(config->ioqueue));
+    if (fail(status))
+    {
+        //
+        // Now we should probably clean up that timer heap!
+        //
+        pj_timer_heap_destroy(config->timer_heap);
+        const char* message = "Unable to initialize IO queue.";
+        logger(Error) << message;
+        throw InternalInitializationException(message);
+    }
+    return STUNModulePtr(new STUNModule(config));
+}
+
+//
+// Protected methods.
+//
+
+/**
+ * Construct the STUNModule object to "hold" the PJNATH STUN resources.
+ * TODO: we might want to make that processing timeout configurable.
+ **/
+STUNModule::STUNModule(const boost::shared_ptr<pj_stun_config>& config) :
+    mConfig(config),
+    mTimeout(new pj_time_val(DEFAULT_PROCESSING_TIMEOUT))
+{
+}
+
+//
+// Private methods.
+//
+void STUNModule::destroyImpl()
+{
+    boost::unique_lock<boost::shared_mutex> lock(mLock);
+    pj_ioqueue_destroy(mConfig->ioqueue);
+    pj_timer_heap_destroy(mConfig->timer_heap);
+
+    mConfig.reset();
+}
+}
+}
\ No newline at end of file
diff --git a/src/STUNModule.h b/src/STUNModule.h
new file mode 100644
index 0000000..d499687
--- /dev/null
+++ b/src/STUNModule.h
@@ -0,0 +1,95 @@
+/*
+ * 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 <boost/shared_ptr.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include "SipModule.h"
+#include <Ice/PropertiesF.h>
+
+//
+// Forward declarations.
+//
+struct pj_stun_config;
+struct pj_caching_pool;
+struct pj_time_val;
+struct pj_pool_t;
+
+namespace AsteriskSCF
+{
+namespace System
+{
+namespace Logging
+{
+class Logger;
+}
+}
+
+namespace SipSessionManager
+{
+
+// 
+// forward declarations.
+//
+class PJSipManager;
+typedef boost::shared_ptr<PJSipManager> PJSipManagerPtr;
+
+class STUNModule : public SipModule
+{
+public:
+    ~STUNModule();
+
+    /**
+     * SipModule interface.
+     **/
+    void destroy();
+    void onHandleEvents();
+
+    /**
+     * Accessors required to create STUN enable transports, etc. These are dangerous because they take the pointers out
+     * of context and it may not be safe to use them in multiple threads. It's basically only safe to use these during
+     * initialization.
+     **/
+    pj_stun_config* getConfig();
+    pj_pool_t* getPool();
+
+    //
+    //
+    static boost::shared_ptr<STUNModule> create(const PJSipManagerPtr& sipManager,
+            const Ice::PropertiesPtr& properties, const AsteriskSCF::System::Logging::Logger& logger);
+protected:
+    STUNModule(const boost::shared_ptr<pj_stun_config>& config);
+
+private:
+    boost::shared_mutex mLock;
+    boost::shared_ptr<pj_stun_config> mConfig;
+    boost::shared_ptr<pj_time_val> mTimeout;
+    pj_pool_t* mPool;
+
+    void destroyImpl();
+
+    //
+    // Unimplemented.
+    //
+    STUNModule(const STUNModule&);
+    void operator=(const STUNModule&);
+};
+typedef boost::shared_ptr<STUNModule> STUNModulePtr;
+
+
+} /* End of namespace SipSessionManager */
+} /* End of namespace AsteriskSCF */
diff --git a/src/PJSipManager.cpp b/src/STUNTransport.cpp
similarity index 50%
copy from src/PJSipManager.cpp
copy to src/STUNTransport.cpp
index f299aac..82c50c2 100644
--- a/src/PJSipManager.cpp
+++ b/src/STUNTransport.cpp
@@ -1,7 +1,7 @@
 /*
  * Asterisk SCF -- An open-source communications framework.
  *
- * Copyright (C) 2010, Digium, Inc.
+ * Copyright (C) 2011, Digium, Inc.
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk SCF project. Please do not directly contact
@@ -14,21 +14,17 @@
  * at the top of the source tree.
  */
 
+#include "STUNTransport.h"
+#include "STUNModule.h"
+#include "PJSipManager.h"
+
 #include <pjlib.h>
+#include <pjnath.h>
 #include <AsteriskSCF/logger.h>
 #include <AsteriskSCF/System/ExceptionsIf.h>
 
-#include <boost/lexical_cast.hpp>
-#include "PJSipManager.h"
-
 #include "DebugUtil.h"
-
-#include <boost/shared_ptr.hpp>
-#include <boost/thread/locks.hpp>
-#include <vector>
-
-#include <pjnath/stun_sock.h>
-#include <pjnath/stun_session.h>
+#include "PJUtil.h"
 
 using namespace AsteriskSCF::System::Logging;
 using namespace AsteriskSCF::System::V1;
@@ -39,171 +35,11 @@ namespace
 Logger logger = getLoggerFactory().getLogger("AsteriskSCF.SipSessionManager");
 }
 
-
 namespace AsteriskSCF
 {
-
 namespace SipSessionManager
 {
 
-static bool success(pj_status_t r)
-{
-    return r == PJ_SUCCESS;
-}
-
-static bool fail(pj_status_t r)
-{
-    return !success(r);
-}
-
-class STUNModule
-{
-public:
-    //
-    // TODO: More configuration details!
-    //
-    STUNModule(pj_pool_t* pool, pj_caching_pool& cachingPool, const Ice::PropertiesPtr& props) :
-        mPool(pool)
-    {
-        logger(Debug) << FUNLOG << " : initializing STUN module";
-        pj_status_t status = pjnath_init();
-        if (fail(status))
-        {
-            const char* message = "Unable to initialize PJNATH library.";
-            logger(Error) << message;
-            throw InternalInitializationException(message);
-        }
-        //
-        // We set the pool, queue, etc. to 0 because they are initialized later on.
-        // TODO: We may be able to use the main SIP ioqueue and timer heap. If so
-        // we can remove the poll method on this object.
-        //
-        pj_stun_config_init(&mConfig, &cachingPool.factory, 0, 0, 0);
-        status = pj_timer_heap_create(mPool, 
-            props->getPropertyAsIntWithDefault("Sip.PJSip.TimerHeap.Size", 1000), 
-            &mConfig.timer_heap);
-        if (fail(status))
-        {
-            const char* message = "Unable to initialize timer heap.";
-            logger(Error) << message;
-            throw InternalInitializationException(message);
-        }
-        status = pj_ioqueue_create(mPool, props->getPropertyAsIntWithDefault("Sip.PJSip.IOQueue.MaxSize", 16), 
-            &mConfig.ioqueue);
-        if (fail(status))
-        {
-            const char* message = "Unable to initialize IO queue.";
-            logger(Error) << message;
-            throw InternalInitializationException(message);
-        }
-    }
-
-    void poll()
-    {
-        const pj_time_val delay = {0, 10};
-        pj_ioqueue_poll(mConfig.ioqueue, &delay);
-        pj_timer_heap_poll(mConfig.timer_heap, 0);
-    }
-
-    ~STUNModule()
-    {
-        pj_ioqueue_destroy(mConfig.ioqueue);
-        mConfig.ioqueue = 0;
-        pj_timer_heap_destroy(mConfig.timer_heap);
-        mConfig.timer_heap = 0;
-    }
-
-    /**
-     * This is "sketchy". There is no mutex protection, etc. While the shared pointer would prevent
-     * accessing memory that no longer exists (if it is *used*), this accessor is really only for
-     * use during initialization when there shouldn't be much going on.
-     **/
-    pj_stun_config* getConfig()
-    {
-        return &mConfig;
-    }
-
-    pj_pool_t* getPool()
-    {
-        return mPool;
-    }
-
-    //
-    // TODO: I think PJNATH takes care of all of the required cleanups via the pools, so there is nothing for a
-    // destructor to do. This code could just as easily be put inline, but I figured the PJSipManager might
-    // have to have other stuff added in later on, so compartamentalizing this code seemed good for organization.
-    // The presence of non-0 value in the member pointer also serves double duty as a flag that that STUN
-    // has been configured.
-    //
-
-private:
-    pj_stun_config mConfig;
-    pj_pool_t* mPool;
-};
-typedef boost::shared_ptr<STUNModule> STUNModulePtr;
-
-//
-// TODO: The Transport/TransportFactory classes could be extended to allow multiple transports to
-// be configured on this endpoint. 
-// 
-
-class UDPTransport : public Transport
-{
-public:
-    UDPTransport(pjsip_endpoint* endpoint, const Ice::PropertiesPtr& props)
-    {
-        logger(Debug) << FUNLOG << " : initializing UDP transport";
-         //
-        // TODO: const table for property names?
-        //
-        string bindAddr = props->getPropertyWithDefault("Sip.Transport.UdpBindAddr", "0.0.0.0:5060");
-
-        //
-        // UNSPEC family means "you figure out the address family, pjlib!"
-        //
-        pj_sockaddr udpAddr;
-        pj_str_t pjAddrStr;
-        pj_sockaddr_parse(pj_AF_UNSPEC(), 0, pj_cstr(&pjAddrStr, bindAddr.c_str()), &udpAddr);
-        
-        if (udpAddr.addr.sa_family == pj_AF_INET())
-        {
-            //
-            // XXX The fourth parameter should probably be controlled through
-            // configuration. PJSIP reference says it should be the number of
-            // processors on the machine.
-            //
-             pj_status_t status = pjsip_udp_transport_start(endpoint, &udpAddr.ipv4, NULL, 2, &mSocket);
-             if (fail(status))
-             {
-                 const char* msg = "Failed to create IPv4 UDP transport.";
-                 logger(Error) << msg;
-                 throw InternalInitializationException(msg);
-             }
-        }
-        else if (udpAddr.addr.sa_family == pj_AF_INET6())
-        {
-            pj_status_t status = pjsip_udp_transport_start6(endpoint, &udpAddr.ipv6, NULL, 2, &mSocket);
-            if (fail(status))
-            {
-                const char* msg = "Failed to create IPv6 UDP transport.";
-                logger(Error) << msg;
-                throw InternalInitializationException(msg);
-            }
-        }
-    };
-    
-    ~UDPTransport()
-    {
-        //
-        // We don't have to worry about cleaning up. PJSIP takes care of that.
-        //
-        mSocket = 0;
-    };
-
-private:
-    pjsip_transport* mSocket;
-};
-
 class STUNTransport : public Transport
 {
 private:
@@ -524,226 +360,12 @@ private:
     }
 };
 
-static void *monitorThread(void *endpt)
-{
-    PJSipManager* endpoint = reinterpret_cast<PJSipManager*> (endpt);
-    for (;;)
-    {
-        endpoint->handleEvents();
-    }
-
-    return NULL;
-}
-
-PJSipManager::PJSipManager(const Ice::PropertiesPtr& props) :
-    mEndpoint(0),
-    mSessionModule(0),
-    mLoggingModule(0),
-    mPjThread(0),
-    mMemoryPool(0)
-{
-    memset(&mCachingPool, 0, sizeof(mCachingPool));
-
-    pj_status_t status = pj_init();
-    if (fail(status))
-    {
-        const char* message = "Failed to Initialize PJSIP";
-        logger(Error) << message;
-        throw InternalInitializationException(message);
-    }
-    // The third parameter is just copied from
-    // example code from PJLIB. This can be adjusted
-    // if necessary.
-    pj_caching_pool_init(&mCachingPool, NULL, 1024 * 1024);
-    pjsip_endpt_create(&mCachingPool.factory, "SIP", &mEndpoint);
-
-
-    //
-    // Careful! This was after the setTransports call, so reordering it might cause issues.
-    //
-    mMemoryPool = pj_pool_create(&mCachingPool.factory, "SIP", 1024, 1024, NULL);
-    if (!mMemoryPool)
-    {
-        const char* message = "Failed to create a memory pool";
-        logger(Error) << message;
-        throw InternalInitializationException(message);
-    }
-
-    //
-    // Initialize the global STUN configuration if it is enabled.
-    //
-    if (props)
-    {
-        if (props->getPropertyAsIntWithDefault("Sip.Transport.STUN.Enable", 0) == 1)
-        {
-            mSTUN = boost::shared_ptr<STUNModule>(new STUNModule(mMemoryPool, mCachingPool, props));
-        }
-        mTransports.push_back(boost::shared_ptr<Transport>(new STUNTransport(mEndpoint, props, mSTUN)));
-    }
-    else
-    {
-        mTransports.push_back(boost::shared_ptr<Transport>(new UDPTransport(mEndpoint, props)));
-    }
-
-    status = pj_thread_create(mMemoryPool, "SIP", (pj_thread_proc *) &monitorThread,
-        this, PJ_THREAD_DEFAULT_STACK_SIZE * 2, 0, &mPjThread);
-    if (fail(status))
-    {
-        const char* message = "Failed to create SIP maintenance thread";
-        logger(Error) << message;
-        throw InternalInitializationException(message);
-    }
-}
-
-PJSipManager::~PJSipManager()
-{
-    //
-    // TODO: Surely there are some cleanups required here.
-    //
-}
-
-void PJSipManager::registerSessionModule(const boost::shared_ptr<SipEndpointFactory>& endpointFactoryPtr,
-        const AsteriskSCF::SmartProxy::SmartProxy<
-            AsteriskSCF::SessionCommunications::V1::SessionRouterPrx>& sessionRouter,
-        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx>& stateReplicator,
-        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica
-    )
+TransportPtr createSTUNTransport(const PJSipManagerPtr& sipManager, const Ice::PropertiesPtr& properties,
+        const std::string& hostname, int port)
 {
-    mSessionModule = new PJSipSessionModule(mEndpoint, endpointFactoryPtr, sessionRouter,
-        serviceLocator, stateReplicator, replica);
+    return TransportPtr(new STUNTransport(sipManager->getEndpoint(), properties, 
+        dynamic_pointer_cast<STUNModule>(sipManager->getModule("STUN"))));
 }
 
-void PJSipManager::registerLoggingModule()
-{
-    mLoggingModule = new PJSipLoggingModule(mEndpoint);
 }
-
-void PJSipManager::handleEvents()
-{
-    //
-    // XXX: The polling for the two pools should probably be occurring in separate threads.
-    //
-    if (mSTUN)
-    {
-        mSTUN->poll();
-    }
-    const pj_time_val delay = {0, 10};
-    pjsip_endpt_handle_events(mEndpoint, &delay);
 }
-
-PJSipSessionModule *PJSipManager::getSessionModule()
-{
-    return mSessionModule;
-}
-
-PJSipLoggingModule *PJSipManager::getLoggingModule()
-{
-    return mLoggingModule;
-}
-
-bool PJSipManager::setTransports(pjsip_endpoint *endpoint, const Ice::PropertiesPtr& props)
-{
-    //XXX We'll also want to allow for TCP and TLS-specific
-    //addresses to be specified.
-    pj_sockaddr udpAddr;
-    pj_status_t status;
-    std::string udpBindAddr = props->getPropertyWithDefault("Sip.Transport.UdpBindAddr", "0.0.0.0:5060");
-    pj_str_t udpString;
-    pj_cstr(&udpString, udpBindAddr.c_str());
-    //UNSPEC family means "you figure out the address family, pjlib!"
-    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &udpString, &udpAddr);
-    if (udpAddr.addr.sa_family == pj_AF_INET())
-    {
-        //XXX The fourth parameter should probably be controlled through
-        //configuration. PJSIP reference says it should be the number of
-        //processors on the machine.
-        //
-        status = pjsip_udp_transport_start(endpoint, &udpAddr.ipv4, NULL, 2, &mUdpTransport);
-        if (status != PJ_SUCCESS)
-        {
-            lg(Error) << "Failed to create IPv4 UDP transport. DANG!";
-        }
-    }
-    else if (udpAddr.addr.sa_family == pj_AF_INET6())
-    {
-        status = pjsip_udp_transport_start6(endpoint, &udpAddr.ipv6, NULL, 2, &mUdpTransport);
-        if (status != PJ_SUCCESS)
-        {
-            lg(Error) << "Failed to create IPv4 UDP transport. DANG!";
-        }
-    }
-    //XXX Note that TCP and TLS stuff should be done here. Also note that
-    //currently PJSIP does not have functions for starting IPv6 TCP or
-    //TLS transports, so we'll have to modify the code to allow for it.
-    return true;
-}
-
-pjsip_transport *PJSipManager::createUDPTransport(std::string address, int port)
-{
-    pj_sockaddr udpAddr;
-    pj_status_t status;
-    pj_str_t udpString;
-    pj_cstr(&udpString, address.c_str());
-    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &udpString, &udpAddr);
-    pj_sockaddr_set_port(&udpAddr, boost::lexical_cast<pj_uint16_t>(port));
-
-    pjsip_transport *udpTransport = NULL;
-    if (udpAddr.addr.sa_family == pj_AF_INET())
-    {
-	status = pjsip_udp_transport_start(mEndpoint, &udpAddr.ipv4, NULL, 2, &udpTransport);
-    }
-    else if (udpAddr.addr.sa_family == pj_AF_INET6())
-    {
-	status = pjsip_udp_transport_start6(mEndpoint, &udpAddr.ipv6, NULL, 2, &udpTransport);
-    }
-
-    if (status != PJ_SUCCESS)
-    {
-	lg(Error) << "Failed to create UDP transport.";
-    }
-
-    return udpTransport;
-}
-
-pjsip_tpfactory *PJSipManager::createTCPTransport(std::string address, int port)
-{
-    pj_sockaddr tcpAddr;
-    pj_str_t tcpString;
-    pj_cstr(&tcpString, address.c_str());
-    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &tcpString, &tcpAddr);
-    pj_sockaddr_set_port(&tcpAddr, boost::lexical_cast<pj_uint16_t>(port));
-
-    pjsip_tpfactory *tcpTransport = NULL;
-
-    if (pjsip_tcp_transport_start(mEndpoint, &tcpAddr, 2, &tcpTransport) != PJ_SUCCESS)
-    {
-	lg(Error) << "Failed to create TCP transport.";
-    }
-
-    return tcpTransport;
-}
-
-pjsip_tpfactory *PJSipManager::createTLSTransport(std::string address, int port, pjsip_tls_setting *)
-{
-    pj_sockaddr tlsAddr;
-    pj_str_t tlsString;
-    pj_cstr(&tlsString, address.c_str());
-    pj_sockaddr_parse(pj_AF_UNSPEC(), 0, &tlsString, &tlsAddr);
-    pj_sockaddr_set_port(&tlsAddr, boost::lexical_cast<pj_uint16_t>(port));
-
-    pjsip_tpfactory *tlsTransport = NULL;
-
-#if PJSIP_HAS_TLS_TRANSPORT
-    if (pjsip_tls_transport_start(mEndpoint, tlsSettings, &tlsAddr, NULL, 2, &tlsTransport) != PJ_SUCCESS)
-#endif
-    {
-        lg(Error) << "Failed to create TLS transport.";
-    }
-
-    return tlsTransport;
-}
-
-}; //End namespace SipSessionManager
-
-}; //End namespace AsteriskSCF
diff --git a/src/STUNTransport.h b/src/STUNTransport.h
new file mode 100644
index 0000000..a895298
--- /dev/null
+++ b/src/STUNTransport.h
@@ -0,0 +1,43 @@
+/*
+ * 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 "Transports.h"
+#include <string>
+#include <Ice/PropertiesF.h>
+
+//
+// Forward declarations.
+//
+struct pjsip_endpoint;
+
+namespace AsteriskSCF
+{
+namespace SipSessionManager
+{
+
+//
+// Forward declarations.
+//
+class PJSipManager;
+typedef boost::shared_ptr<PJSipManager> PJSipManagerPtr;
+
+TransportPtr createSTUNTransport(const PJSipManagerPtr& sipManager, const Ice::PropertiesPtr& properties,
+        const std::string& hostname, int port);
+
+} /* End of namespace SipSessionManager */
+} /* End of namespace AsteriskSCF */
diff --git a/src/SipConfiguration.cpp b/src/SipConfiguration.cpp
index da49417..83637e5 100644
--- a/src/SipConfiguration.cpp
+++ b/src/SipConfiguration.cpp
@@ -30,6 +30,10 @@
 #include "PJSipManager.h"
 #include "SipEndpointFactory.h"
 #include "SipConfiguration.h"
+
+#include "UDPTransport.h"
+#include "TCPTransport.h"
+#include "TLSTransport.h"
 #include <vector>
 
 using namespace AsteriskSCF::SIP::V1;
@@ -338,8 +342,7 @@ public:
      */
     UDPTransportConfig(const SipUDPTransportGroupPtr& group, PJSipManager* manager) :
         mGroup(group),
-        mManager(manager),
-        mTransport(0)
+        mManager(manager)
     {
     };
 
@@ -348,10 +351,6 @@ public:
      */
     ~UDPTransportConfig()
     {
-        if (mTransport)
-        {
-            pjsip_transport_shutdown(mTransport);
-        }
     };
 
     SipConfigurationItemVisitorPtr getVisitor()
@@ -361,20 +360,13 @@ public:
 
     void update(const SipHostItemPtr& hostItem)
     {
-        pjsip_transport* oldTransport = 0;
         boost::unique_lock<boost::shared_mutex> lock(mLock);
         if (mAddress != hostItem->host || mPort != hostItem->port)
         {
             mAddress = hostItem->host;
             mPort = hostItem->port;
-            oldTransport = mTransport;
-            mTransport = mManager->createUDPTransport(mAddress, mPort);
-        }
-        if (oldTransport)
-        {
-            pjsip_transport_shutdown(oldTransport);
+            mTransport = createUDPTransport(mManager, mAddress, mPort);
         }
-        
     }
         
     SipUDPTransportGroupPtr getTypedGroup() const
@@ -400,12 +392,12 @@ private:
      */
     mutable SipUDPTransportGroupPtr mGroup;
 
-    PJSipManager* mManager;
+    PJSipManagerPtr mManager;
     
     /**
      * Transport within pjsip.
      */
-    pjsip_transport *mTransport;
+    TransportPtr mTransport;
 };
 typedef boost::shared_ptr<UDPTransportConfig> UDPTransportConfigPtr;
 typedef std::map<std::string, UDPTransportConfigPtr> UDPTransportMap;
@@ -438,8 +430,7 @@ public:
      */
     TCPTransportConfig(const SipTCPTransportGroupPtr& group, PJSipManager* manager) :
         mGroup(group),
-        mManager(manager),
-        mTransportFactory(0)
+        mManager(manager)
     {
     };
 
@@ -448,10 +439,6 @@ public:
      */
     ~TCPTransportConfig()
     {
-        if (mTransportFactory)
-        {
-            // I hope in the future it will be possible to shut down TCP based transports but for now... it is not
-        }
     };
     
     SipConfigurationItemVisitorPtr getVisitor()
@@ -466,7 +453,7 @@ public:
         {
             mAddress = hostItem->host;
             mPort = hostItem->port;
-            mTransportFactory = mManager->createTCPTransport(mAddress, mPort);
+            mTransport = createTCPTransport(mManager, mAddress, mPort);
         }
     }
 
@@ -493,12 +480,12 @@ private:
      */
     mutable SipTCPTransportGroupPtr mGroup;
 
-    PJSipManager* mManager;
+    PJSipManagerPtr mManager;
 
     /**
      * Transport factory within pjsip.
      */
-    pjsip_tpfactory *mTransportFactory;
+    TransportPtr mTransport;
 };
 typedef boost::shared_ptr<TCPTransportConfig> TCPTransportConfigPtr;
 typedef std::map<std::string, TCPTransportConfigPtr> TCPTransportMap;
@@ -558,7 +545,6 @@ public:
     TLSTransportConfig(const SipTLSTransportGroupPtr& group, PJSipManager* manager) :
         mGroup(group),
         mManager(manager),
-        mTransportFactory(0),
         mNeedsUpdating(false)
     {
         pjsip_tls_setting_default(&mTLSSettings);
@@ -652,7 +638,7 @@ public:
         if (mNeedsUpdating)
         {
             mNeedsUpdating = false;
-            mTransportFactory = mManager->createTLSTransport(mAddress, mPort, &mTLSSettings);
+            mTransportFactory = createTLSTransport(mManager, mAddress, mPort, &mTLSSettings);
         }
     }
 
@@ -685,12 +671,12 @@ private:
      */
     mutable SipTLSTransportGroupPtr mGroup;
 
-    PJSipManager* mManager;
+    PJSipManagerPtr mManager;
 
     /**
      * Transport factory within pjsip.
      */
-    pjsip_tpfactory *mTransportFactory;
+    TransportPtr mTransportFactory;
 
     bool mNeedsUpdating;
 };
diff --git a/src/SipModule.h b/src/SipModule.h
new file mode 100644
index 0000000..c0f4e59
--- /dev/null
+++ b/src/SipModule.h
@@ -0,0 +1,68 @@
+/*
+ * 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 <boost/shared_ptr.hpp>
+#include <string>
+#include <map>
+
... 4297 lines suppressed ...


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list