[asterisk-scf-commits] asterisk-scf/integration/sip.git branch "code-conventions" created.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Mar 21 08:14:14 CDT 2011


branch "code-conventions" has been created
        at  827fc662e122ea00689893d167e77a46adf47a15 (commit)

- Log -----------------------------------------------------------------
commit 827fc662e122ea00689893d167e77a46adf47a15
Author: Brent Eagles <beagles at digium.com>
Date:   Mon Mar 21 10:35:11 2011 -0230

    * Update method signatures to pass smart pointers, references and proxies
    by const ref.
    
    * Split some long lines

diff --git a/src/PJSipManager.cpp b/src/PJSipManager.cpp
index 22b5955..8da907b 100644
--- a/src/PJSipManager.cpp
+++ b/src/PJSipManager.cpp
@@ -44,7 +44,7 @@ static void *monitorThread(void *endpt)
     return NULL;
 }
 
-PJSipManager::PJSipManager(Ice::PropertiesPtr props)
+PJSipManager::PJSipManager(const Ice::PropertiesPtr& props)
 {
     pj_status_t status = pj_init();
     if (status != PJ_SUCCESS)
@@ -70,11 +70,12 @@ PJSipManager::PJSipManager(Ice::PropertiesPtr props)
     }
 }
 
-void PJSipManager::registerSessionModule(boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr,
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx> sessionRouter,
-    AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> stateReplicator,
-    AsteriskSCF::System::Component::V1::ReplicaPtr replica
+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
     )
 {
     mSessionModule = new PJSipSessionModule(mEndpoint, endpointFactoryPtr, sessionRouter,
@@ -96,7 +97,7 @@ PJSipLoggingModule *PJSipManager::getLoggingModule()
     return mLoggingModule;
 }
 
-bool PJSipManager::setTransports(pjsip_endpoint *endpoint, Ice::PropertiesPtr props)
+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.
diff --git a/src/PJSipManager.h b/src/PJSipManager.h
index eaedf0d..1dc7b02 100644
--- a/src/PJSipManager.h
+++ b/src/PJSipManager.h
@@ -47,7 +47,7 @@ namespace SipSessionManager
 class PJSipManager
 {
 public:
-    PJSipManager(Ice::PropertiesPtr props);
+    PJSipManager(const Ice::PropertiesPtr& props);
     /**
      * Get a handle to the PJSipEndpoint for operations
      * that may require it
@@ -68,11 +68,12 @@ public:
      * Register the PJSipSessionModule, responsible
      * for basic call handling
      */
-    void registerSessionModule(boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr,
-        AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx> sessionRouter,
-        AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
-        AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> stateReplicator,
-        AsteriskSCF::System::Component::V1::ReplicaPtr replica
+    void 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
         );
 
     /**
@@ -90,7 +91,7 @@ private:
     pj_pool_t *mMemoryPool;
     pjsip_transport *mUdpTransport;
 
-    bool setTransports(pjsip_endpoint *endpoint, Ice::PropertiesPtr props);
+    bool setTransports(pjsip_endpoint *endpoint, const Ice::PropertiesPtr& props);
 };
 
 }; //End namespace SipSessionManager
diff --git a/src/PJSipModule.cpp b/src/PJSipModule.cpp
index c53a60e..0465a50 100644
--- a/src/PJSipModule.cpp
+++ b/src/PJSipModule.cpp
@@ -35,7 +35,8 @@ namespace SipSessionManager
 //to retrieve PJSIP URI strings.
 const int URI_SIZE = 64;
 
-PJSipDialogModInfo::PJSipDialogModInfo(pjsip_dialog *dialog) : mDialogState(new SipDialogStateItem) , mNeedsReplication(true), mNeedsRemoval(false)
+PJSipDialogModInfo::PJSipDialogModInfo(pjsip_dialog *dialog) :
+    mDialogState(new SipDialogStateItem) , mNeedsReplication(true), mNeedsRemoval(false)
 {
     //XXX Is there a way to tell ICE to make the default
     //constructor for SipStateItem set key?
@@ -98,7 +99,8 @@ void PJSipDialogModInfo::updateDialogState(pjsip_dialog *dialog)
     mNeedsReplication = true;
 }
 
-PJSipTransactionModInfo::PJSipTransactionModInfo(pjsip_transaction *transaction) : mTransactionState(new SipTransactionStateItem), mNeedsReplication(true), mNeedsRemoval(false)
+PJSipTransactionModInfo::PJSipTransactionModInfo(pjsip_transaction *transaction) :
+    mTransactionState(new SipTransactionStateItem), mNeedsReplication(true), mNeedsRemoval(false)
 {
     mTransactionState->key = IceUtil::generateUUID();
     updateTransactionState(transaction);
@@ -112,7 +114,8 @@ PJSipTransactionModInfo::~PJSipTransactionModInfo()
 void PJSipTransactionModInfo::updateTransactionState(pjsip_transaction *transaction)
 {
     mTransactionState->mBranch = std::string(pj_strbuf(&transaction->branch), pj_strlen(&transaction->branch));
-    mTransactionState->mIsClient = (transaction->role == PJSIP_ROLE_UAC || transaction->role == PJSIP_UAC_ROLE) ? true : false;
+    mTransactionState->mIsClient =
+        (transaction->role == PJSIP_ROLE_UAC || transaction->role == PJSIP_UAC_ROLE) ? true : false;
     mTransactionState->mCurrentState = transactionStateTranslate(transaction->state);
     mNeedsReplication = true;
 }
diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 3080204..58a30c5 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -84,7 +84,7 @@ typedef IceUtil::Handle<RouteSessionCallback> RouteSessionCallbackPtr;
 class ConnectBridgedSessionsCallback : public IceUtil::Shared
 {
 public:
-    ConnectBridgedSessionsCallback(pjsip_inv_session *inv_session, pjsip_rx_data *rdata, SipSessionPtr session)
+    ConnectBridgedSessionsCallback(pjsip_inv_session *inv_session, pjsip_rx_data *rdata, const SipSessionPtr& session)
         : mInvSession(inv_session), mRData(rdata), mSession(session) { }
 
     void callback(const Ice::AsyncResultPtr &r)
@@ -117,7 +117,8 @@ typedef IceUtil::Handle<ConnectBridgedSessionsCallback> ConnectBridgedSessionsCa
 class ConnectBridgedSessionsWithDestinationCallback : public IceUtil::Shared
 {
 public:
-    ConnectBridgedSessionsWithDestinationCallback(pjsip_inv_session *inv_session, pjsip_rx_data *rdata, SipSessionPtr session, std::string target)
+    ConnectBridgedSessionsWithDestinationCallback(pjsip_inv_session *inv_session, pjsip_rx_data *rdata,
+            const SipSessionPtr& session, const std::string& target)
         : mInvSession(inv_session), mRData(rdata), mSession(session), mTarget(target) { }
 
     void callback(const Ice::AsyncResultPtr &r)
@@ -129,7 +130,8 @@ public:
         }
         catch (const AsteriskSCF::Core::Routing::V1::DestinationNotFoundException &)
         {
-            lg(Debug) << "ConnectBridgedSessionsWithDestination sending 404 due to destination not found for target: "<< mTarget;
+            lg(Debug) << "ConnectBridgedSessionsWithDestination sending 404 due to destination not found for target: "
+                      << mTarget;
 
             pjsip_dlg_respond(mInvSession->dlg, mRData, 404, NULL, NULL, NULL);
             return;
@@ -158,8 +160,8 @@ typedef IceUtil::Handle<ConnectBridgedSessionsWithDestinationCallback> ConnectBr
 class ListenerCallback : public IceUtil::Shared
 {
 public:
-    ListenerCallback(const std::string name) : mCallbackName(name) {}
-    void failure(const Ice::Exception &ex)
+    ListenerCallback(const std::string& name) : mCallbackName(name) {}
+    void failure(const Ice::Exception& ex)
     {
         lg(Error) << "Ice exception when attempting to relate " << mCallbackName << " state: " << ex.what();
     }
@@ -170,8 +172,7 @@ private:
 typedef IceUtil::Handle<ListenerCallback> ListenerCallbackPtr;
 
 PJSipSessionModInfo::PJSipSessionModInfo(pjsip_inv_session *inv_session,
-    SipSessionPtr session)
-    :
+    const SipSessionPtr& session) :
     mSessionState(new SipSessionStateItem),
     mInviteState(new SipInviteSessionStateItem),
     mNeedsReplication(true),
@@ -233,7 +234,7 @@ SipSessionPtr PJSipSessionModInfo::getSessionPtr()
     return mSession;
 }
 
-void PJSipSessionModInfo::setSessionPtr(SipSessionPtr sessionPtr)
+void PJSipSessionModInfo::setSessionPtr(const SipSessionPtr& sessionPtr)
 {
     mSession = sessionPtr;
 }
@@ -365,7 +366,8 @@ void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo, PJSipTransa
                 lg(Error) << "No endpoint for oneway invocation of setState() for state replication.";
             }
 
-            AsteriskSCF::SIP::V1::SipStateReplicatorPrx oneWayStateReplicator = AsteriskSCF::SIP::V1::SipStateReplicatorPrx::uncheckedCast(oneway);
+            AsteriskSCF::SIP::V1::SipStateReplicatorPrx oneWayStateReplicator = 
+                AsteriskSCF::SIP::V1::SipStateReplicatorPrx::uncheckedCast(oneway);
 
             try
             {
@@ -389,7 +391,8 @@ void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo, PJSipTransa
                 lg(Error) << "No endpoint for oneway invocation of removeState() for state replication.";
             }
 
-            AsteriskSCF::SIP::V1::SipStateReplicatorPrx oneWayStateReplicator = AsteriskSCF::SIP::V1::SipStateReplicatorPrx::uncheckedCast(oneway);
+            AsteriskSCF::SIP::V1::SipStateReplicatorPrx oneWayStateReplicator =
+                AsteriskSCF::SIP::V1::SipStateReplicatorPrx::uncheckedCast(oneway);
 
             try
             {
@@ -548,7 +551,8 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
     {
         if (replaced_dlg)
         {
-            // For attended transfers we need to contact the routing service which should then (hopefully) replace the other session
+            // For attended transfers we need to contact the routing service which should then (hopefully) replace the
+            // other session
         }
         else
         {
@@ -570,7 +574,8 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
 void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdata)
 {
     const pj_str_t str_refer_to = { (char*)"Refer-To", 8 };
-    pjsip_generic_string_hdr *refer_to = static_cast<pjsip_generic_string_hdr *>(pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_refer_to, NULL));
+    pjsip_generic_string_hdr *refer_to =
+        static_cast<pjsip_generic_string_hdr *>(pjsip_msg_find_hdr_by_name(rdata->msg_info.msg, &str_refer_to, NULL));
 
     lg(Debug) << "Handling a REFER";
     if (!refer_to)
@@ -618,12 +623,15 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
 
         if (to_tag_param && from_tag_param)
         {
-            other_dlg = pjsip_ua_find_dialog(&replaces_param->value, &to_tag_param->value, &from_tag_param->value, PJ_TRUE);
+            other_dlg = pjsip_ua_find_dialog(&replaces_param->value, &to_tag_param->value, &from_tag_param->value,
+                    PJ_TRUE);
         }
         else
         {
-            // It is possible for the to and from tag value to be present within the Replaces parameter value, so try to parse it out
-            std::string replaces_value_tmp = std::string(pj_strbuf(&replaces_param->value), pj_strlen(&replaces_param->value));
+            // It is possible for the to and from tag value to be present within the Replaces parameter value, so try to
+            // parse it out
+            std::string replaces_value_tmp = std::string(pj_strbuf(&replaces_param->value),
+                    pj_strlen(&replaces_param->value));
             size_t from_tag_pos = replaces_value_tmp.find(";from-tag=");
             size_t to_tag_pos = replaces_value_tmp.find(";to-tag=");
 
@@ -692,7 +700,8 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
             Ice::CallbackPtr d = Ice::newCallback(cb, &ConnectBridgedSessionsCallback::callback);
 
             lg(Debug) << "handleRefer() calling router connectBridgedSessions(). ";
-            mSessionRouter->begin_connectBridgedSessions(session->getSessionProxy(), other_session->getSessionProxy(), d);
+            mSessionRouter->begin_connectBridgedSessions(session->getSessionProxy(),
+                    other_session->getSessionProxy(), d);
         }
         catch (const Ice::CommunicatorDestroyedException &)
         {
@@ -711,7 +720,8 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
         {
             PJSipSessionModInfo *session_mod_info = (PJSipSessionModInfo*)inv->mod_data[mModule.id];
             SipSessionPtr session = session_mod_info->getSessionPtr();
-            ConnectBridgedSessionsWithDestinationCallbackPtr cb(new ConnectBridgedSessionsWithDestinationCallback(inv, rdata, session, target));
+            ConnectBridgedSessionsWithDestinationCallbackPtr cb(
+                new ConnectBridgedSessionsWithDestinationCallback(inv, rdata, session, target));
             Ice::CallbackPtr d = Ice::newCallback(cb, &ConnectBridgedSessionsWithDestinationCallback::callback);
 
             lg(Debug) << "handleRefer() calling router connectBridgedSessionsWithDestination(). ";
@@ -744,7 +754,8 @@ pj_bool_t PJSipSessionModule::on_rx_request(pjsip_rx_data *rdata)
     case PJSIP_OTHER_METHOD:
         if (dlg && !pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, pjsip_get_refer_method()))
         {
-            // We are essentially stopping the pjsip code from sending a 500 here, but this will actually be handled within the transaction code
+            // We are essentially stopping the pjsip code from sending a 500 here, but this will actually be handled
+            // within the transaction code
             break;
         }
     default:
@@ -888,7 +899,8 @@ void PJSipSessionModule::invOnStateChanged(pjsip_inv_session *inv, pjsip_event *
             return;
         }
         SipSessionPtr session = session_mod_info->getSessionPtr();
-        AsteriskSCF::SessionCommunications::V1::ResponseCodePtr response = new AsteriskSCF::SessionCommunications::V1::ResponseCode();
+        AsteriskSCF::SessionCommunications::V1::ResponseCodePtr response =
+            new AsteriskSCF::SessionCommunications::V1::ResponseCode();
         if (inv->cause == 486)
         {
             response->isdnCode = 17;
@@ -904,7 +916,8 @@ void PJSipSessionModule::invOnStateChanged(pjsip_inv_session *inv, pjsip_event *
         }
         std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx> listeners = session->getListeners();
         lg(Debug) << "Relating stopped state to " << listeners.size() << " listeners";
-        for (std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx>::iterator listener = listeners.begin();
+        for (std::vector<AsteriskSCF::SessionCommunications::V1::SessionListenerPrx>::iterator listener =
+                 listeners.begin();
              listener != listeners.end();
              ++listener)
         {
@@ -941,7 +954,8 @@ void PJSipSessionModule::invOnStateChanged(pjsip_inv_session *inv, pjsip_event *
         replicateState(NULL, NULL, session_mod_info);
 
         //Compare branches to see if this got handled by the transaction layer.
-        if (inv->invite_tsx && pj_strcmp(&event->body.rx_msg.rdata->msg_info.via->branch_param, &inv->invite_tsx->branch) != 0)
+        if (inv->invite_tsx &&
+                pj_strcmp(&event->body.rx_msg.rdata->msg_info.via->branch_param, &inv->invite_tsx->branch) != 0)
         {
             //Mismatched branch!
             invOnTsxStateChanged(inv, inv->invite_tsx, event);
@@ -972,26 +986,22 @@ void PJSipSessionModule::invOnNewSession(pjsip_inv_session *inv, pjsip_event *ev
 
 void PJSipSessionModule::invOnTsxStateChanged(pjsip_inv_session *inv, pjsip_transaction *tsx, pjsip_event *e)
 {
-    if (tsx->role == PJSIP_ROLE_UAS && tsx->state == PJSIP_TSX_STATE_TRYING && !pjsip_method_cmp(&tsx->method, pjsip_get_refer_method()))
+    if (tsx->role == PJSIP_ROLE_UAS && tsx->state == PJSIP_TSX_STATE_TRYING &&
+            !pjsip_method_cmp(&tsx->method, pjsip_get_refer_method()))
     {
         handleRefer(inv, e->body.tsx_state.src.rdata);
     }
-    //This will be our key point for updating transaction state.
-    //This function will not be called until after a module has registered
-    //itself as the transaction user, so this won't be called on the initial
-    //INVITE we receive.
+    //This will be our key point for updating transaction state.  This function will not be called until after a module
+    //has registered itself as the transaction user, so this won't be called on the initial INVITE we receive.
     //
-    //Having taken a look at the pjsip inv_session code, the transaction state
-    //changed callback is called *after* the inv_state_changed callback. This
-    //means that on both reception and transmission of requests, this is called
-    //last, meaning this is the prime spot to do state replication of dialogs,
-    //transactions, sessions.
+    //Having taken a look at the pjsip inv_session code, the transaction state changed callback is called *after* the
+    //inv_state_changed callback. This means that on both reception and transmission of requests, this is called last,
+    //meaning this is the prime spot to do state replication of dialogs, transactions, sessions.
     //
-    //There is one exception. If we receive an ACK for an INVITE transaction and
-    //the ACK has a different Via branch parameter than the INVITE and its response,
-    //then this callback will not be called at all, and we will need to perform the
-    //proper state replication in the invOnStateChanged function. This can be
-    //done simply by calling this function from there.
+    //There is one exception. If we receive an ACK for an INVITE transaction and the ACK has a different Via branch
+    //parameter than the INVITE and its response, then this callback will not be called at all, and we will need to
+    //perform the proper state replication in the invOnStateChanged function. This can be done simply by calling this
+    //function from there.
 
     PJSipTransactionModInfo *tsx_mod_info = static_cast<PJSipTransactionModInfo *> (tsx->mod_data[mModule.id]);
     // TODO: Determine if this is perfectly acceptable, since it occurs when the call is going bye bye
@@ -1082,11 +1092,14 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t st
             FormatDiscoverySDPPtr params = new FormatDiscoverySDP();
             params->category = "media_format";
             params->payload = pj_strtoul(&remote_sdp->media[stream]->desc.fmt[format]);
-            params->type = std::string(pj_strbuf(&remote_sdp->media[stream]->desc.media), pj_strlen(&remote_sdp->media[stream]->desc.media));
+            params->type = std::string(pj_strbuf(&remote_sdp->media[stream]->desc.media),
+                    pj_strlen(&remote_sdp->media[stream]->desc.media));
 
-            // Some devices rely solely on the payload for known formats (such as PCMU) so the following format parameters are optional
+            // Some devices rely solely on the payload for known formats (such as PCMU) so the following format
+            // parameters are optional
             const pjmedia_sdp_attr *attr;
-            if ((attr = pjmedia_sdp_media_find_attr2(remote_sdp->media[stream], "rtpmap", &remote_sdp->media[stream]->desc.fmt[format])))
+            if ((attr = pjmedia_sdp_media_find_attr2(remote_sdp->media[stream], "rtpmap",
+                                    &remote_sdp->media[stream]->desc.fmt[format])))
             {
                 pjmedia_sdp_rtpmap *rtpmap;
                 if ((pjmedia_sdp_attr_to_rtpmap(inv->pool_active, attr, &rtpmap)) == PJ_SUCCESS)
@@ -1097,7 +1110,8 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t st
             }
 
             // Next we move on to the format specific parameters
-            if ((attr = pjmedia_sdp_media_find_attr2(remote_sdp->media[stream], "fmtp", &remote_sdp->media[stream]->desc.fmt[format])))
+            if ((attr = pjmedia_sdp_media_find_attr2(remote_sdp->media[stream], "fmtp",
+                                    &remote_sdp->media[stream]->desc.fmt[format])))
             {
                 pjmedia_sdp_fmtp fmtp;
                 if ((pjmedia_sdp_attr_get_fmtp(attr, &fmtp)) == PJ_SUCCESS)
@@ -1110,7 +1124,8 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t st
             // Next up are attributes that are not specific to the format, such as ptime
             for (unsigned int attribute = 0; attribute < remote_sdp->media[stream]->attr_count; attribute++)
             {
-                // Attributes we already touch above OR know aren't helpful to the media format component don't need to be given to it, obviously
+                // Attributes we already touch above OR know aren't helpful to the media format component don't need to
+                // be given to it, obviously
                 if (!pj_strcmp2(&remote_sdp->media[stream]->attr[attribute]->name, "rtpmap") ||
                     !pj_strcmp2(&remote_sdp->media[stream]->attr[attribute]->name, "fmtp") ||
                     !pj_strcmp2(&remote_sdp->media[stream]->attr[attribute]->name, "rtcp") ||
@@ -1121,8 +1136,10 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t st
                     continue;
                 }
 
-                std::string parameter = std::string(pj_strbuf(&remote_sdp->media[stream]->attr[attribute]->name), pj_strlen(&remote_sdp->media[stream]->attr[attribute]->name)) + ':' +
-                    std::string(pj_strbuf(&remote_sdp->media[stream]->attr[attribute]->value), pj_strlen(&remote_sdp->media[stream]->attr[attribute]->value));
+                std::string parameter = std::string(pj_strbuf(&remote_sdp->media[stream]->attr[attribute]->name),
+                        pj_strlen(&remote_sdp->media[stream]->attr[attribute]->name)) + ':' +
+                    std::string(pj_strbuf(&remote_sdp->media[stream]->attr[attribute]->value),
+                            pj_strlen(&remote_sdp->media[stream]->attr[attribute]->value));
                 params->parameters.push_back(parameter);
             }
 
@@ -1130,7 +1147,8 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t st
             {
                 MediaFormatServicePrx service = MediaFormatServicePrx::uncheckedCast(mServiceLocator->locate(params));
 
-                // It is entirely possible for the service locator to not find a service that knows about this media format
+                // It is entirely possible for the service locator to not find a service that knows about this media
+                // format
                 if (service != 0)
                 {
                     FormatPtr format = FormatPtr::dynamicCast(service->getFormat(params));
@@ -1145,7 +1163,8 @@ void PJSipSessionModule::invOnMediaUpdate(pjsip_inv_session *inv, pj_status_t st
     }
 }
 
-pjsip_redirect_op PJSipSessionModule::invOnRedirected(pjsip_inv_session *inv, const pjsip_uri *target, const pjsip_event *e)
+pjsip_redirect_op PJSipSessionModule::invOnRedirected(pjsip_inv_session *inv, const pjsip_uri *target,
+        const pjsip_event *e)
 {
     //stub
     return PJSIP_REDIRECT_REJECT;
diff --git a/src/PJSipSessionModule.h b/src/PJSipSessionModule.h
index 5569170..a1fdde3 100644
--- a/src/PJSipSessionModule.h
+++ b/src/PJSipSessionModule.h
@@ -39,11 +39,11 @@ namespace SipSessionManager
 class PJSipSessionModInfo
 {
 public:
-    PJSipSessionModInfo(pjsip_inv_session *inv_session, SipSessionPtr);
+    PJSipSessionModInfo(pjsip_inv_session *inv_session, const SipSessionPtr&);
     ~PJSipSessionModInfo();
     void updateSessionState(pjsip_inv_session *inv_session);
     SipSessionPtr getSessionPtr();
-    void setSessionPtr(SipSessionPtr sessionPtr);
+    void setSessionPtr(const SipSessionPtr& sessionPtr);
     SipSessionStateItemPtr mSessionState;
     SipInviteSessionStateItemPtr mInviteState;
     bool mNeedsReplication;
@@ -57,11 +57,12 @@ private:
 class PJSipSessionModule : public PJSipModule
 {
 public:
-    PJSipSessionModule(pjsip_endpoint *endpt, boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr,
-        AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx> sessionRouter,
-        AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
-        AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> stateReplicator,
-        AsteriskSCF::System::Component::V1::ReplicaPtr replica);
+    PJSipSessionModule(pjsip_endpoint *endpt, 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);
     pj_status_t load(pjsip_endpoint *endpoint);
     pj_status_t start();
     pj_status_t stop();
diff --git a/src/PJSipSessionModuleConstruction.cpp b/src/PJSipSessionModuleConstruction.cpp
index e6cebaf..c1da3a7 100644
--- a/src/PJSipSessionModuleConstruction.cpp
+++ b/src/PJSipSessionModuleConstruction.cpp
@@ -92,11 +92,11 @@ static pjsip_dialog *uaOnDialogForked(pjsip_dialog *first_set, pjsip_rx_data *rd
 }
 
 PJSipSessionModule::PJSipSessionModule(pjsip_endpoint *endpt,
-    boost::shared_ptr<SipEndpointFactory> endpointFactoryPtr,
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SessionCommunications::V1::SessionRouterPrx> sessionRouter,
-    AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
-    AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::SIP::V1::SipStateReplicatorPrx> stateReplicator,
-    AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+    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)
     : mName(moduleName), mEndpointFactory(endpointFactoryPtr),
       mSessionRouter(sessionRouter), mServiceLocator(serviceLocator),
       mStateReplicator(stateReplicator), mReplica(replica)
diff --git a/src/SipEndpoint.cpp b/src/SipEndpoint.cpp
index 03f88b9..58e4ff6 100644
--- a/src/SipEndpoint.cpp
+++ b/src/SipEndpoint.cpp
@@ -45,9 +45,15 @@ public:
     /**
      * Constructor for the SipEndpointImplPriv class.
      */
-    SipEndpointImplPriv(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, PJSipManager *manager,
-        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica) :
-        mName(name), mAdapter(adapter), mEndpointFactory(factory), mManager(manager), mServiceLocator(serviceLocator), mReplica(replica) { };
+    SipEndpointImplPriv(const Ice::ObjectAdapterPtr& adapter, const boost::shared_ptr<SipEndpointFactory>& factory,
+            const std::string& name, PJSipManager *manager,
+            const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+            const AsteriskSCF::System::Component::V1::ReplicaPtr& replica) :
+        mName(name), mAdapter(adapter), mEndpointFactory(factory), mManager(manager), mServiceLocator(serviceLocator),
+        mReplica(replica)
+    {
+    };
+    
     /**
      * The name of the endpoint.
      */
@@ -97,18 +103,22 @@ public:
 /**
  * Default constructor.
  */
-SipEndpoint::SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props, PJSipManager *manager,
-    const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+SipEndpoint::SipEndpoint(const Ice::ObjectAdapterPtr& adapter, const boost::shared_ptr<SipEndpointFactory>& factory,
+        const std::string& name, const Ice::PropertyDict& props, PJSipManager *manager,
+        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica)
     : mImplPriv(new SipEndpointImplPriv(adapter, factory, name, manager, serviceLocator, replica))
 {
     lg(Debug) << "Constructing SIP endpoint " << name;
 
-    mImplPriv->mEndpointProxy = AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx::uncheckedCast(mImplPriv->mAdapter->addWithUUID(this));
+    mImplPriv->mEndpointProxy =
+        AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx::uncheckedCast(
+            mImplPriv->mAdapter->addWithUUID(this));
 
     setConfiguration(props);
 }
 
-void SipEndpoint::setConfiguration(Ice::PropertyDict props)
+void SipEndpoint::setConfiguration(const Ice::PropertyDict& props)
 {
     setTransportConfiguration(props);
     //setAuthConfiguration(props);
@@ -118,13 +128,13 @@ void SipEndpoint::setConfiguration(Ice::PropertyDict props)
     //setSubscriptionConfiguration(props);
 }
 
-void SipEndpoint::setTransportConfiguration(Ice::PropertyDict props)
+void SipEndpoint::setTransportConfiguration(const Ice::PropertyDict& props)
 {
     std::string prefix("Sip.Endpoint.");
     prefix.append(mImplPriv->mName);
     prefix.append(".Transport.");
     // Got the basic prefix. Now get the known config options.
-    Ice::PropertyDict::iterator IpAddress = props.find(prefix + "Address");
+    Ice::PropertyDict::const_iterator IpAddress = props.find(prefix + "Address");
     if (IpAddress != props.end())
     {
         pj_str_t addr;
@@ -139,29 +149,29 @@ void SipEndpoint::setTransportConfiguration(Ice::PropertyDict props)
             mImplPriv->mConfig.transportConfig.address = IpAddress->second;
         }
     }
-    Ice::PropertyDict::iterator direction = props.find(prefix + "SecureTransport");
+    Ice::PropertyDict::const_iterator direction = props.find(prefix + "SecureTransport");
     if (direction != props.end())
     {
         mImplPriv->mConfig.transportConfig.secureTransport = SipEndpointConfig::stringToDirection(direction->second);
     }
-    Ice::PropertyDict::iterator user = props.find(prefix + "User");
+    Ice::PropertyDict::const_iterator user = props.find(prefix + "User");
     if (user != props.end())
     {
         mImplPriv->mConfig.transportConfig.user = user->second;
     }
 }
 
-void SipEndpoint::setSessionConfiguration(Ice::PropertyDict props)
+void SipEndpoint::setSessionConfiguration(const Ice::PropertyDict& props)
 {
     std::string prefix("Sip.Endpoint.");
     prefix.append(mImplPriv->mName);
     prefix.append(".Session.");
-    Ice::PropertyDict::iterator direction = props.find(prefix + "CallDirection");
+    Ice::PropertyDict::const_iterator direction = props.find(prefix + "CallDirection");
     if (direction != props.end())
     {
         mImplPriv->mConfig.sessionConfig.callDirection = SipEndpointConfig::stringToDirection(direction->second);
     }
-    Ice::PropertyDict::iterator address = props.find(prefix + "SourceAddress");
+    Ice::PropertyDict::const_iterator address = props.find(prefix + "SourceAddress");
     if (address != props.end())
     {
         pj_str_t addr;
@@ -178,7 +188,7 @@ void SipEndpoint::setSessionConfiguration(Ice::PropertyDict props)
     }
 }
 
-Direction SipEndpointConfig::stringToDirection(std::string directionString)
+Direction SipEndpointConfig::stringToDirection(const std::string& directionString)
 {
     if (directionString == "Both")
     {
@@ -213,47 +223,54 @@ std::string SipEndpoint::getId(const Ice::Current&)
     return mImplPriv->mEndpointProxy->ice_getIdentity().name;
 }
 
-AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(const std::string& destination, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current&)
+AsteriskSCF::SessionCommunications::V1::SessionPrx SipEndpoint::createSession(const std::string& destination,
+        const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current&)
 {
-    if (mImplPriv->mConfig.sessionConfig.callDirection != BOTH && mImplPriv->mConfig.sessionConfig.callDirection != INBOUND)
+    if (mImplPriv->mConfig.sessionConfig.callDirection != BOTH &&
+            mImplPriv->mConfig.sessionConfig.callDirection != INBOUND)
     {
         // TODO: We should have an exception here
         return 0;
     }
 
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplica);
+    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, listener, mImplPriv->mManager,
+            mImplPriv->mServiceLocator, mImplPriv->mReplica);
     mImplPriv->mSessions.push_back(session);
     return session->getSessionProxy();
 }
 
 AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const std::string& destination)
 {
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplica);
+    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, 0, mImplPriv->mManager,
+            mImplPriv->mServiceLocator, mImplPriv->mReplica);
     mImplPriv->mSessions.push_back(session);
     return session;
 }
 
-AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const std::string& destination, const Ice::Identity& sessionid,
-    const Ice::Identity& mediaid, const AsteriskSCF::Media::V1::SessionPrx& mediasession,
-    const AsteriskSCF::Media::V1::StreamSourceSeq& sources,
-    const AsteriskSCF::Media::V1::StreamSinkSeq& sinks)
+AsteriskSCF::SipSessionManager::SipSessionPtr SipEndpoint::createSession(const std::string& destination,
+        const Ice::Identity& sessionid, const Ice::Identity& mediaid,
+        const AsteriskSCF::Media::V1::SessionPrx& mediasession, const AsteriskSCF::Media::V1::StreamSourceSeq& sources,
+        const AsteriskSCF::Media::V1::StreamSinkSeq& sinks)
 {
-    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, mediaid, mediasession, sources, sinks, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplica);
+    SipSessionPtr session = new SipSession(mImplPriv->mAdapter, this, destination, sessionid, mediaid, mediasession,
+            sources, sinks, mImplPriv->mManager, mImplPriv->mServiceLocator, mImplPriv->mReplica);
     mImplPriv->mSessions.push_back(session);
     return session;
 }
 
-void SipEndpoint::removeSession(AsteriskSCF::SessionCommunications::V1::SessionPtr session)
+void SipEndpoint::removeSession(const AsteriskSCF::SessionCommunications::V1::SessionPtr& session)
 {
     SipSessionPtr sipsession = SipSessionPtr::dynamicCast(session);
-    mImplPriv->mSessions.erase(std::remove(mImplPriv->mSessions.begin(), mImplPriv->mSessions.end(), sipsession), mImplPriv->mSessions.end());
+    mImplPriv->mSessions.erase(std::remove(mImplPriv->mSessions.begin(), mImplPriv->mSessions.end(), sipsession),
+            mImplPriv->mSessions.end());
 }
 
 AsteriskSCF::SessionCommunications::V1::SessionSeq SipEndpoint::getSessions(const Ice::Current&)
 {
     AsteriskSCF::SessionCommunications::V1::SessionSeq sessions;
 
-    for (std::vector<SipSessionPtr>::const_iterator session = mImplPriv->mSessions.begin(); session != mImplPriv->mSessions.end(); ++session)
+    for (std::vector<SipSessionPtr>::const_iterator session = mImplPriv->mSessions.begin();
+         session != mImplPriv->mSessions.end(); ++session)
     {
         sessions.push_back((*session)->getSessionProxy());
     }
diff --git a/src/SipEndpoint.h b/src/SipEndpoint.h
index 63471f1..994554d 100644
--- a/src/SipEndpoint.h
+++ b/src/SipEndpoint.h
@@ -195,7 +195,7 @@ public:
     /* Convert a specified direction string into its proper
      * enumerated value.
      */
-    static Direction stringToDirection(std::string directionString);
+    static Direction stringToDirection(const std::string& directionString);
 private:
 };
 
@@ -207,8 +207,10 @@ class SipEndpointImplPriv;
 class SipEndpoint : public AsteriskSCF::SessionCommunications::V1::SessionEndpoint
 {
 public:
-    SipEndpoint(Ice::ObjectAdapterPtr adapter, boost::shared_ptr<SipEndpointFactory> factory, std::string name, Ice::PropertyDict props, PJSipManager *manager,
-        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator, const AsteriskSCF::System::Component::V1::ReplicaPtr replica);
+    SipEndpoint(const Ice::ObjectAdapterPtr& adapter, const boost::shared_ptr<SipEndpointFactory>& factory,
+            const std::string& name, const Ice::PropertyDict& props, PJSipManager *manager,
+            const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+            const AsteriskSCF::System::Component::V1::ReplicaPtr& replica);
 
     bool operator==(const std::string &name) const;
 
@@ -216,7 +218,8 @@ public:
      * Interface implementation.
      */
     std::string getId(const Ice::Current&);
-    AsteriskSCF::SessionCommunications::V1::SessionPrx createSession(const std::string&, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
+    AsteriskSCF::SessionCommunications::V1::SessionPrx createSession(const std::string&,
+            const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
     AsteriskSCF::SessionCommunications::V1::SessionSeq getSessions(const Ice::Current&);
 
     /**
@@ -228,13 +231,16 @@ public:
 
     AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx getEndpointProxy();
 
-    // TODO: Find a way to use SipSessionPtr here, right now trying to do so results in the world exploding due to dependency insanity
+    //
+    // TODO: Find a way to use SipSessionPtr here, right now trying to do so results in the world exploding due to
+    // dependency insanity
+    //
     AsteriskSCF::SipSessionManager::SipSessionPtr createSession(const std::string&);
-    AsteriskSCF::SipSessionManager::SipSessionPtr createSession(const std::string&, const Ice::Identity&, const Ice::Identity&,
-        const AsteriskSCF::Media::V1::SessionPrx&, const AsteriskSCF::Media::V1::StreamSourceSeq&,
-        const AsteriskSCF::Media::V1::StreamSinkSeq&);
+    AsteriskSCF::SipSessionManager::SipSessionPtr createSession(const std::string&, const Ice::Identity&,
+            const Ice::Identity&, const AsteriskSCF::Media::V1::SessionPrx&,
+            const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&);
 
-    void removeSession(AsteriskSCF::SessionCommunications::V1::SessionPtr);
+    void removeSession(const AsteriskSCF::SessionCommunications::V1::SessionPtr&);
 
 private:
     /**
@@ -245,15 +251,15 @@ private:
     /**
      * Set up configuration for the endpoint
      */
-    void setConfiguration(Ice::PropertyDict props);
+    void setConfiguration(const Ice::PropertyDict& props);
 
-    void setTransportConfiguration(Ice::PropertyDict props);
+    void setTransportConfiguration(const Ice::PropertyDict& props);
 
-    void setSessionConfiguration(Ice::PropertyDict props);
-    void setRegistrationConfiguration(Ice::PropertyDict props);
-    void setAuthConfiguration(Ice::PropertyDict props);
-    void setMediaConfiguration(Ice::PropertyDict props);
-    void setSubscriptionConfiguration(Ice::PropertyDict props);
+    void setSessionConfiguration(const Ice::PropertyDict& props);
+    void setRegistrationConfiguration(const Ice::PropertyDict& props);
+    void setAuthConfiguration(const Ice::PropertyDict& props);
+    void setMediaConfiguration(const Ice::PropertyDict& props);
+    void setSubscriptionConfiguration(const Ice::PropertyDict& props);
 };
 
 /**
diff --git a/src/SipEndpointFactory.cpp b/src/SipEndpointFactory.cpp
index 62d89cc..ea072c4 100644
--- a/src/SipEndpointFactory.cpp
+++ b/src/SipEndpointFactory.cpp
@@ -22,23 +22,24 @@ namespace AsteriskSCF
 namespace SipSessionManager
 {
 
-SipEndpointPtr SipEndpointFactory::createEndpoint(std::string destination, Ice::PropertiesPtr props)
+SipEndpointPtr SipEndpointFactory::createEndpoint(const std::string& destination, const Ice::PropertiesPtr& props)
 {
     std::string prefix("Sip.Endpoint.");
     prefix.append(destination);
     Ice::PropertyDict endpointProps = props->getPropertiesForPrefix(prefix);
-    SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this(), destination, endpointProps, mManager, mServiceLocator, mReplica);
+    SipEndpointPtr endpoint = new SipEndpoint(mAdapter, shared_from_this(), destination, endpointProps, mManager,
+            mServiceLocator, mReplica);
     mEndpoints.push_back(endpoint);
     return endpoint;
 }
 
-void SipEndpointFactory::remove(SipEndpointPtr endpoint)
+void SipEndpointFactory::remove(const SipEndpointPtr& endpoint)
 {
     // TODO: Do we even need to remove sip endpoints yet?
 //   mEndpoints.erase(std::remove(mEndpoints.begin(), mEndpoints.end(), endpoint), mEndpoints.end());
 }
 
-SipEndpointPtr SipEndpointFactory::findByName(std::string endpointName)
+SipEndpointPtr SipEndpointFactory::findByName(const std::string& endpointName)
 {
     std::vector<SipEndpointPtr>::iterator iter;
     for (iter = mEndpoints.begin(); iter != mEndpoints.end(); ++ iter)
diff --git a/src/SipEndpointFactory.h b/src/SipEndpointFactory.h
index 77a34fa..73c4d3a 100644
--- a/src/SipEndpointFactory.h
+++ b/src/SipEndpointFactory.h
@@ -36,16 +36,16 @@ namespace SipSessionManager
 class SipEndpointFactory : public boost::enable_shared_from_this<SipEndpointFactory>
 {
 public:
-    SipEndpointFactory(Ice::ObjectAdapterPtr adapter, PJSipManager *manager,
-        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx serviceLocator,
-        const AsteriskSCF::System::Component::V1::ReplicaPtr replica) :
+    SipEndpointFactory(const Ice::ObjectAdapterPtr& adapter, PJSipManager *manager,
+        const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica) :
         mAdapter(adapter), mManager(manager), mServiceLocator(serviceLocator), mReplica(replica) { };
 
-    SipEndpointPtr createEndpoint(std::string destination, Ice::PropertiesPtr props);
+    SipEndpointPtr createEndpoint(const std::string& destination, const Ice::PropertiesPtr& props);
 
-    void remove(SipEndpointPtr);
+    void remove(const SipEndpointPtr&);
 
-    SipEndpointPtr findByName(std::string endpointName);
+    SipEndpointPtr findByName(const std::string& endpointName);
 
     void generateRoutingDestinations(AsteriskSCF::Core::Routing::V1::RegExSeq&);
 private:
diff --git a/src/SipSession.cpp b/src/SipSession.cpp
index 0c6dd3e..cd003e3 100644
--- a/src/SipSession.cpp
+++ b/src/SipSession.cpp
@@ -42,7 +42,7 @@ namespace SipSessionManager
 class SipMediaSession : public Media::V1::Session
 {
 public:
-    SipMediaSession(SipSessionPtr session) : mId(IceUtil::generateUUID()), mSession(session) { };
+    SipMediaSession(const SipSessionPtr& session) : mId(IceUtil::generateUUID()), mSession(session) { };
 
     AsteriskSCF::Media::V1::StreamSourceSeq getSources(const Ice::Current&)
     {
@@ -80,10 +80,10 @@ public:
     /**
      * Constructor for the SipSessionPriv class.
      */
-    SipSessionPriv(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint,
+    SipSessionPriv(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPtr& endpoint,
         const std::string& destination, PJSipManager *manager,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica)
         : mAdapter(adapter), mDialog(0), mInviteSession(0), mEndpoint(endpoint), mDestination(destination),
           mManager(manager), mServiceLocator(serviceLocator), mReplica(replica) { };
 
@@ -170,10 +170,10 @@ public:
 /**
  * Default constructor.
  */
-SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination,
-    const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, PJSipManager *manager,
-    const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-    const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPtr& endpoint,
+        const std::string& destination,  const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
+        PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica)
     : mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager, serviceLocator, replica))
 {
     if (listener != 0)
@@ -181,10 +181,12 @@ SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, c
         mImplPriv->mListeners.push_back(listener);
     }
 
-    mImplPriv->mSessionProxy = AsteriskSCF::SessionCommunications::V1::SessionPrx::uncheckedCast(adapter->addWithUUID(this));
+    mImplPriv->mSessionProxy =
+        AsteriskSCF::SessionCommunications::V1::SessionPrx::uncheckedCast(adapter->addWithUUID(this));
 
     mImplPriv->mMediaSession = new SipMediaSession(this);
-    mImplPriv->mMediaSessionProxy = AsteriskSCF::Media::V1::SessionPrx::uncheckedCast(adapter->addWithUUID(mImplPriv->mMediaSession));
+    mImplPriv->mMediaSessionProxy =
+        AsteriskSCF::Media::V1::SessionPrx::uncheckedCast(adapter->addWithUUID(mImplPriv->mMediaSession));
 
     // Get an RTP session capable of handling the formats we are going to offer
     AsteriskSCF::Media::V1::FormatSeq formats;
@@ -194,32 +196,39 @@ SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, c
 /**
  * Replica constructor.
  */
-SipSession::SipSession(Ice::ObjectAdapterPtr adapter, SipEndpointPtr endpoint, const std::string& destination, const Ice::Identity& sessionid,
-    const Ice::Identity& mediaid, const AsteriskSCF::Media::V1::SessionPrx& mediasession,
-    const AsteriskSCF::Media::V1::StreamSourceSeq& sources, const AsteriskSCF::Media::V1::StreamSinkSeq& sinks,
-    PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-    const AsteriskSCF::System::Component::V1::ReplicaPtr replica)
+SipSession::SipSession(const Ice::ObjectAdapterPtr& adapter, const SipEndpointPtr& endpoint,
+        const std::string& destination, const Ice::Identity& sessionid,
+        const Ice::Identity& mediaid, const AsteriskSCF::Media::V1::SessionPrx& mediasession,
+        const AsteriskSCF::Media::V1::StreamSourceSeq& sources, const AsteriskSCF::Media::V1::StreamSinkSeq& sinks,
+        PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
+        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica)
     : mImplPriv(new SipSessionPriv(adapter, endpoint, destination, manager, serviceLocator, replica))
 {
-    mImplPriv->mSessionProxy = AsteriskSCF::SessionCommunications::V1::SessionPrx::uncheckedCast(adapter->add(this, sessionid));
+    mImplPriv->mSessionProxy =
+        AsteriskSCF::SessionCommunications::V1::SessionPrx::uncheckedCast(adapter->add(this, sessionid));
 
     mImplPriv->mMediaSession = new SipMediaSession(this);
-    mImplPriv->mMediaSessionProxy = AsteriskSCF::Media::V1::SessionPrx::uncheckedCast(adapter->add(mImplPriv->mMediaSession, mediaid));
+    mImplPriv->mMediaSessionProxy =
+        AsteriskSCF::Media::V1::SessionPrx::uncheckedCast(adapter->add(mImplPriv->mMediaSession, mediaid));
 
-    AsteriskSCF::Media::RTP::V1::RTPSessionPrx rtpsession = AsteriskSCF::Media::RTP::V1::RTPSessionPrx::uncheckedCast(mediasession);
+    AsteriskSCF::Media::RTP::V1::RTPSessionPrx rtpsession =
+        AsteriskSCF::Media::RTP::V1::RTPSessionPrx::uncheckedCast(mediasession);
     mImplPriv->mRTPSessions.push_back(rtpsession);
 
     mImplPriv->mSources = sources;
     mImplPriv->mSinks = sinks;
 }
 
-AsteriskSCF::SessionCommunications::V1::SessionInfoPtr SipSession::addListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current& current)
+AsteriskSCF::SessionCommunications::V1::SessionInfoPtr SipSession::addListener(
+    const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current& current)
 {
     boost::unique_lock<boost::shared_mutex> lock(mImplPriv->mLock);
     mImplPriv->mListeners.push_back(listener);
     if (mImplPriv->mInviteSession)
     {
-        PJSipSessionModInfo *session_mod_info = static_cast<PJSipSessionModInfo*>(mImplPriv->mInviteSession->mod_data[mImplPriv->mManager->getSessionModule()->getModule().id]);
+        PJSipSessionModInfo *session_mod_info =
+            static_cast<PJSipSessionModInfo*>(
+                mImplPriv->mInviteSession->mod_data[mImplPriv->mManager->getSessionModule()->getModule().id]);
         lock.unlock();
         session_mod_info->updateSessionState(mImplPriv->mInviteSession);
         mImplPriv->mManager->getSessionModule()->replicateState(NULL, NULL, session_mod_info);
@@ -263,7 +272,8 @@ AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx SipSession::getEndpoi
  */
 AsteriskSCF::SessionCommunications::V1::SessionInfoPtr SipSession::getInfo(const Ice::Current&)
 {
-    AsteriskSCF::SessionCommunications::V1::SessionInfoPtr sessioninfo = new AsteriskSCF::SessionCommunications::V1::SessionInfo();
+    AsteriskSCF::SessionCommunications::V1::SessionInfoPtr sessioninfo =
+        new AsteriskSCF::SessionCommunications::V1::SessionInfo();
 
     /* TODO: Utilize locking so this becomes safe
        if (!mImplPriv->mInviteSession || mImplPriv->mInviteSession->state == PJSIP_INV_STATE_NULL)
@@ -325,7 +335,8 @@ AsteriskSCF::SessionCommunications::V1::BridgePrx SipSession::getBridge(const Ic
 /**
  * An implementation of the setBridge method as defined in SessionCommunications.ice
  */
-AsteriskSCF::SessionCommunications::V1::SessionInfoPtr SipSession::setBridge(const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
+AsteriskSCF::SessionCommunications::V1::SessionInfoPtr SipSession::setBridge(
+    const AsteriskSCF::SessionCommunications::V1::BridgePrx& bridge,
     const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
     const Ice::Current& current)
 {
@@ -346,7 +357,8 @@ void SipSession::setBridge(const AsteriskSCF::SessionCommunications::V1::BridgeP
 /**
  * An implementation of the removeBridge method as defined in SessionCommunications.ice
  */
-void SipSession::removeBridge(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current& current)
+void SipSession::removeBridge(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener,
+        const Ice::Current& current)
 {
     if (mImplPriv->mBridge == 0)
     {
@@ -395,10 +407,13 @@ void SipSession::progress(const AsteriskSCF::SessionCommunications::V1::Response
 void SipSession::removeListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx& listener, const Ice::Current&)
 {
     boost::unique_lock<boost::shared_mutex> lock(mImplPriv->mLock);
-    mImplPriv->mListeners.erase(std::remove(mImplPriv->mListeners.begin(), mImplPriv->mListeners.end(), listener), mImplPriv->mListeners.end());
+    mImplPriv->mListeners.erase(std::remove(mImplPriv->mListeners.begin(), mImplPriv->mListeners.end(),
+                    listener), mImplPriv->mListeners.end());
     if (mImplPriv->mInviteSession)
     {
-        PJSipSessionModInfo *session_mod_info = static_cast<PJSipSessionModInfo*>(mImplPriv->mInviteSession->mod_data[mImplPriv->mManager->getSessionModule()->getModule().id]);
+        PJSipSessionModInfo *session_mod_info =
+            static_cast<PJSipSessionModInfo*>(
+                mImplPriv->mInviteSession->mod_data[mImplPriv->mManager->getSessionModule()->getModule().id]);
         lock.unlock();
         session_mod_info->updateSessionState(mImplPriv->mInviteSession);
         mImplPriv->mManager->getSessionModule()->replicateState(NULL, NULL, session_mod_info);
@@ -443,7 +458,8 @@ void SipSession::start(const Ice::Current&)
     lg(Debug) << "Sending new SIP INVITE to " << remote;
 
     // Create a UAC dialog for the outgoing call
-    if ((pjsip_dlg_create_uac(pjsip_ua_instance(), &local_uri, &local_uri, &remote_uri, &remote_uri, &dialog)) != PJ_SUCCESS)
+    if ((pjsip_dlg_create_uac(pjsip_ua_instance(), &local_uri, &local_uri, &remote_uri, &remote_uri, &dialog)) !=
+            PJ_SUCCESS)
     {
         // What should we do here? Throw an exception?
         return;
@@ -543,7 +559,8 @@ void SipSession::destroy()
     if (mImplPriv->mReplica->isActive() == true)
     {
         // Release all the RTP sessions we are using
-        for (std::vector<AsteriskSCF::Media::RTP::V1::RTPSessionPrx>::const_iterator i = mImplPriv->mRTPSessions.begin(); i != mImplPriv->mRTPSessions.end(); ++i)
+        for (std::vector<AsteriskSCF::Media::RTP::V1::RTPSessionPrx>::const_iterator i =
+                 mImplPriv->mRTPSessions.begin(); i != mImplPriv->mRTPSessions.end(); ++i)
         {
             (*i)->release();
         }
@@ -557,7 +574,8 @@ void SipSession::destroy()
  */
 pjmedia_sdp_session *SipSession::createSDPOffer()
 {
-    pjmedia_sdp_session *sdp = static_cast<pjmedia_sdp_session*>(pj_pool_zalloc(mImplPriv->mDialog->pool, sizeof(pjmedia_sdp_session)));
+    pjmedia_sdp_session *sdp = static_cast<pjmedia_sdp_session*>(
+        pj_pool_zalloc(mImplPriv->mDialog->pool, sizeof(pjmedia_sdp_session)));
 
     pj_strdup2(mImplPriv->mDialog->pool, &sdp->origin.user, "AsteriskSCF");
     pj_time_val tv;
@@ -572,7 +590,8 @@ pjmedia_sdp_session *SipSession::createSDPOffer()
     sdp->attr_count = 0;
 
     // Right now we only support a single stream so go and get it
-    AsteriskSCF::Media::RTP::V1::StreamSourceRTPPrx stream = AsteriskSCF::Media::RTP::V1::StreamSourceRTPPrx::uncheckedCast(mImplPriv->mSources.front());
+    AsteriskSCF::Media::RTP::V1::StreamSourceRTPPrx stream =
+        AsteriskSCF::Media::RTP::V1::StreamSourceRTPPrx::uncheckedCast(mImplPriv->mSources.front());
 
     // Add connection details at the session level since we currently only support one media stream.
     sdp->conn = static_cast<pjmedia_sdp_conn*>(pj_pool_zalloc(mImplPriv->mDialog->pool, sizeof(pjmedia_sdp_conn)));
@@ -582,7 +601,8 @@ pjmedia_sdp_session *SipSession::createSDPOffer()
 
     // Add a single media stream
     sdp->media_count = 1;
-    pjmedia_sdp_media* media = static_cast<pjmedia_sdp_media*>(pj_pool_zalloc(mImplPriv->mDialog->pool, sizeof(pjmedia_sdp_media)));
+    pjmedia_sdp_media* media =
+        static_cast<pjmedia_sdp_media*>(pj_pool_zalloc(mImplPriv->mDialog->pool, sizeof(pjmedia_sdp_media)));
     sdp->media[0] = media;
     pj_strdup2(mImplPriv->mDialog->pool, &media->desc.media, "audio");
     media->desc.port = stream->getLocalPort();
@@ -620,10 +640,12 @@ pjmedia_sdp_session *SipSession::createSDPOffer()
 void SipSession::requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats)
 {
     // TODO: This needs to be improved for multiple streams
-    AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParamsPtr params = new AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParams();
+    AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParamsPtr params =
+        new AsteriskSCF::Media::RTP::V1::RTPServiceLocatorParams();
     params->category = "rtp";
 
-    AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx factory = AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx::uncheckedCast(mImplPriv->mServiceLocator->locate(params));
+    AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx factory =
+        AsteriskSCF::Media::RTP::V1::RTPMediaServicePrx::uncheckedCast(mImplPriv->mServiceLocator->locate(params));
     AsteriskSCF::Media::RTP::V1::RTPSessionPrx session = factory->allocate(formats);
     mImplPriv->mRTPSessions.push_back(session);
 
@@ -649,9 +671,10 @@ void SipSession::requestRTPSessions(AsteriskSCF::Media::V1::FormatSeq& formats)
 /**
  * Internal function called to set the remote details for RTP.
  */
-void SipSession::setRemoteDetails(std::string destination, int port)
+void SipSession::setRemoteDetails(const std::string& destination, int port)
 {
-    AsteriskSCF::Media::RTP::V1::StreamSinkRTPPrx sink = AsteriskSCF::Media::RTP::V1::StreamSinkRTPPrx::uncheckedCast(mImplPriv->mSinks.front());
+    AsteriskSCF::Media::RTP::V1::StreamSinkRTPPrx sink =
+        AsteriskSCF::Media::RTP::V1::StreamSinkRTPPrx::uncheckedCast(mImplPriv->mSinks.front());
     sink->setRemoteDetails(destination, port);
 }
 
diff --git a/src/SipSession.h b/src/SipSession.h
index 105af5c..9466267 100644
--- a/src/SipSession.h
+++ b/src/SipSession.h
@@ -59,30 +59,33 @@ class PJSipManager;
 class SipSession : public AsteriskSCF::SessionCommunications::V1::Session
 {
 public:
-    SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&,
+    SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&,
         const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, PJSipManager *manager,
         const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::System::Component::V1::ReplicaPtr replica);
+        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica);
 
-    SipSession(Ice::ObjectAdapterPtr, SipEndpointPtr, const std::string&, const Ice::Identity&,
+    SipSession(const Ice::ObjectAdapterPtr&, const SipEndpointPtr&, const std::string&, const Ice::Identity&,
         const Ice::Identity&, const AsteriskSCF::Media::V1::SessionPrx&,
         const AsteriskSCF::Media::V1::StreamSourceSeq&, const AsteriskSCF::Media::V1::StreamSinkSeq&,
         PJSipManager *manager, const AsteriskSCF::Core::Discovery::V1::ServiceLocatorPrx& serviceLocator,
-        const AsteriskSCF::System::Component::V1::ReplicaPtr replica);
+        const AsteriskSCF::System::Component::V1::ReplicaPtr& replica);
 
     bool operator==(const SipSession &other) const;
 
     /**
      * Interface specific functions.
      */
-    AsteriskSCF::SessionCommunications::V1::SessionInfoPtr addListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
+    AsteriskSCF::SessionCommunications::V1::SessionInfoPtr
+        addListener(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
     void connect(const Ice::Current&);
     void flash(const Ice::Current&);
     AsteriskSCF::SessionCommunications::V1::SessionEndpointPrx getEndpoint(const Ice::Current&);
     AsteriskSCF::SessionCommunications::V1::SessionInfoPtr getInfo(const Ice::Current&);
     AsteriskSCF::Media::V1::SessionPrx getMediaSession(const Ice::Current&);
     AsteriskSCF::SessionCommunications::V1::BridgePrx getBridge(const Ice::Current&);
-    AsteriskSCF::SessionCommunications::V1::SessionInfoPtr setBridge(const AsteriskSCF::SessionCommunications::V1::BridgePrx&, const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
+    AsteriskSCF::SessionCommunications::V1::SessionInfoPtr setBridge(
+        const AsteriskSCF::SessionCommunications::V1::BridgePrx&,
+        const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
     void setBridge(const AsteriskSCF::SessionCommunications::V1::BridgePrx&);
     void removeBridge(const AsteriskSCF::SessionCommunications::V1::SessionListenerPrx&, const Ice::Current&);
     void hold(const Ice::Current&);
@@ -100,7 +103,7 @@ public:
 
     pjmedia_sdp_session *createSDPOffer();
 
-    void setRemoteDetails(std::string, int);
+    void setRemoteDetails(const std::string&, int);
 
     void setDialog(pjsip_dialog *dialog);
 
@@ -110,6 +113,9 @@ public:
 
     pjsip_inv_session *getInviteSession();
 
+    //
+    // TODO: Are these thread safe?
+    //
     AsteriskSCF::Media::V1::StreamSourceSeq& getSources();
 
     AsteriskSCF::Media::V1::StreamSinkSeq& getSinks();
diff --git a/src/SipSessionManagerApp.cpp b/src/SipSessionManagerApp.cpp
index 2afe7ab..34d4128 100644
--- a/src/SipSessionManagerApp.cpp
+++ b/src/SipSessionManagerApp.cpp
@@ -83,10 +83,10 @@ public:
     virtual void stop();
 
 private:
-    void initialize(const std::string appName, const Ice::CommunicatorPtr& ic);
+    void initialize(const string& appName, const Ice::CommunicatorPtr& ic);
     void registerWithServiceLocator();
     void deregisterFromServiceLocator();
-    void setCategory(Discovery::V1::ServiceManagementPrx serviceManagement, const string &category);
+    void setCategory(const Discovery::V1::ServiceManagementPrx& serviceManagement, const string &category);
     void locateRoutingService();
     void locateSessionRouter();
     void locateStateReplicator();
@@ -156,7 +156,7 @@ public: // Overrides of the ComponentService interface.
     }
 
 private:
-    SipSessionManager& mService;
+    SipSessionManager& mService; // TODO reference?
 };
 
 /**
@@ -165,7 +165,7 @@ private:
 class ReplicaImpl : public Replica
 {
 public:
-    ReplicaImpl(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter), mPaused(false), mActive(true) { }
+    ReplicaImpl(const Ice::ObjectAdapterPtr& adapter) : mAdapter(adapter), mPaused(false), mActive(true) { }
 
     bool isActive(const Ice::Current&)
     {
@@ -176,9 +176,11 @@ public:
     {
         mActive = true;
 
-        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
+        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener =
+                 mListeners.begin(); listener != mListeners.end(); ++listener)
         {
-            (*listener)->activated(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
+            (*listener)->activated(ReplicaPrx::uncheckedCast(
+                        mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
         }
 
         return true;
@@ -188,9 +190,11 @@ public:
     {
         mActive = false;
 
-        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
+        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener =
+                 mListeners.begin(); listener != mListeners.end(); ++listener)
         {
-            (*listener)->onStandby(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
+            (*listener)->onStandby(ReplicaPrx::uncheckedCast(
+                        mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
         }
     }
 
@@ -276,7 +280,7 @@ private:
  * Helper function to add some parameters to one of our registered interfaces in the ServiceLocator, so that
  * other components can look up our interfaces.
  */
-void SipSessionManager::setCategory(Discovery::V1::ServiceManagementPrx serviceManagement, const string &category)
+void SipSessionManager::setCategory(const Discovery::V1::ServiceManagementPrx& serviceManagement, const string &category)
 {
     // Add category as a parameter to enable other components look this component up.
     ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
@@ -292,8 +296,10 @@ void SipSessionManager::registerWithServiceLocator()
 {
     try
     {
-        // Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system discovery mechanisms.
-        mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("LocatorServiceManagement.Proxy"));
+        // Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system
+        // discovery mechanisms.
+        mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(
+            mCommunicator->propertyToProxy("LocatorServiceManagement.Proxy"));
 
         if (mServiceLocatorManagement == 0)
         {
@@ -302,12 +308,14 @@ void SipSessionManager::registerWithServiceLocator()
         }
 
         // Get a proxy to our ComponentService interface and add it to the Service Locator.
-        Ice::ObjectPrx componentServiceObjectPrx = mLocalAdapter->createDirectProxy(mCommunicator->stringToIdentity(ComponentServiceId));
+        Ice::ObjectPrx componentServiceObjectPrx =
+            mLocalAdapter->createDirectProxy(mCommunicator->stringToIdentity(ComponentServiceId));
         ComponentServicePrx componentServicePrx = ComponentServicePrx::checkedCast(componentServiceObjectPrx);
 
         // The GUID passed in to add service needs to be unique for reporting.
         string componentServiceGuid("SipSessionManager");
-        mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
+        mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(
+            mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
 
         setCategory(mComponentServiceManagement, AsteriskSCF::SIP::V1::ComponentServiceDiscoveryCategory);
 
@@ -332,7 +340,8 @@ void SipSessionManager::registerWithRoutingService()
 
     mRoutingId = mCommunicator->getProperties()->getPropertyWithDefault("Sip.RoutingId", "pjsip");
 
-    EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(mGlobalAdapter->createDirectProxy(mCommunicator->stringToIdentity(EndpointLocatorObjectId)));
+    EndpointLocatorPrx locator = EndpointLocatorPrx::uncheckedCast(
+        mGlobalAdapter->createDirectProxy(mCommunicator->stringToIdentity(EndpointLocatorObjectId)));
     mRoutingServiceLocatorRegistry->addEndpointLocator(mRoutingId, destinations, locator);
 }
 
@@ -371,7 +380,8 @@ void SipSessionManager::locateStateReplicator()
 
     SIP::V1::SipStateReplicatorParamsPtr replicatorParams = new SIP::V1::SipStateReplicatorParams();
     replicatorParams->category = SIP::V1::StateReplicatorDiscoveryCategory;
-    replicatorParams->mName = mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorName", "default");
+    replicatorParams->mName =
+        mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorName", "default");
 
     try
     {
@@ -484,7 +494,7 @@ void SipSessionManager::deregisterFromStateReplicator()
  * Create the primary functional objects of this component.
  *   @param appName Name of the application or component.
  */
-void SipSessionManager::initialize(const std::string appName, const Ice::CommunicatorPtr& ic)
+void SipSessionManager::initialize(const string& appName, const Ice::CommunicatorPtr& ic)
 {
     try
     {
@@ -539,7 +549,8 @@ void SipSessionManager::initialize(const std::string appName, const Ice::Communi
 
         // Create and publish our state replicator listener interface.
         mReplicatorListener = new SipStateReplicatorListenerI(mEndpointFactory, mPJSipManager);
-        mReplicatorListenerProxy = SipStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
+        mReplicatorListenerProxy =
+            SipStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
         lg(Debug) << "Got proxy to SIP state replicator";
 
         mGlobalAdapter->activate();
diff --git a/src/SipSessionManagerEndpointLocator.h b/src/SipSessionManagerEndpointLocator.h
index afa65b9..c942e74 100644
--- a/src/SipSessionManagerEndpointLocator.h
+++ b/src/SipSessionManagerEndpointLocator.h
@@ -34,7 +34,8 @@ namespace SipSessionManager
 class SipSessionManagerEndpointLocator : public AsteriskSCF::Core::Routing::V1::EndpointLocator
 {
 public:
-    SipSessionManagerEndpointLocator(boost::shared_ptr<SipEndpointFactory> factory) : mEndpointFactory(factory) { };
+    SipSessionManagerEndpointLocator(const boost::shared_ptr<SipEndpointFactory>& factory) :
+        mEndpointFactory(factory) { };
 
 public:  // Overrides of EndpointLocator
 
@@ -42,7 +43,8 @@ public:  // Overrides of EndpointLocator
      * The Routing Service will call this method when it needs to lookup an endpoint that
      * we have indicated that we are managing.
      */
-    virtual ::AsteriskSCF::Core::Endpoint::V1::EndpointSeq lookup(const ::std::string& destination, const ::Ice::Current& = ::Ice::Current());
+     ::AsteriskSCF::Core::Endpoint::V1::EndpointSeq lookup(const ::std::string& destination,
+             const ::Ice::Current& = ::Ice::Current());
 
 private:
     /**
diff --git a/src/SipSessionManagerEventPublisher.cpp b/src/SipSessionManagerEventPublisher.cpp
index ae98668..794eb5b 100644
--- a/src/SipSessionManagerEventPublisher.cpp
+++ b/src/SipSessionManagerEventPublisher.cpp
@@ -41,7 +41,7 @@ namespace SipSessionManager
 class SipSessionManagerEventPublisherPriv
 {
 public:
-    SipSessionManagerEventPublisherPriv(Ice::ObjectAdapterPtr adapter) :  mAdapter(adapter), mInitialized(false)
+    SipSessionManagerEventPublisherPriv(const Ice::ObjectAdapterPtr& adapter) :  mAdapter(adapter), mInitialized(false)
     {
         initialize();
     }
@@ -103,7 +103,8 @@ public:
     {
         if (!mInitialized)
         {
-            lg(Error) << "Warning: Attempting to use SipSessionManagerEventPublisher in uninitialized state! IceStorm may be inaccessible.";
+            lg(Error) << "Warning: Attempting to use SipSessionManagerEventPublisher in uninitialized state! "
+                "IceStorm may be inaccessible.";
         }
 
         return mInitialized;
@@ -118,7 +119,7 @@ public:
 /**
  * Class constructor.
  */
-SipSessionManagerEventPublisher::SipSessionManagerEventPublisher(Ice::ObjectAdapterPtr adapter)
+SipSessionManagerEventPublisher::SipSessionManagerEventPublisher(const Ice::ObjectAdapterPtr& adapter)
     : mImpl(new SipSessionManagerEventPublisherPriv(adapter))
 {
 }
diff --git a/src/SipSessionManagerEventPublisher.h b/src/SipSessionManagerEventPublisher.h
index 81bbfd1..c8f1660 100644
--- a/src/SipSessionManagerEventPublisher.h
+++ b/src/SipSessionManagerEventPublisher.h
@@ -32,7 +32,7 @@ class SipSessionManagerEventPublisherPriv;
 class SipSessionManagerEventPublisher
 {
 public:
-    SipSessionManagerEventPublisher(Ice::ObjectAdapterPtr adapter);
+    SipSessionManagerEventPublisher(const Ice::ObjectAdapterPtr& adapter);
 
     /**
      * Send a message to the service's event topic to report a lookup event.
diff --git a/src/SipStateReplicator.h b/src/SipStateReplicator.h
index b025afb..707f67c 100644
--- a/src/SipStateReplicator.h
+++ b/src/SipStateReplicator.h
@@ -27,36 +27,19 @@ namespace AsteriskSCF
 namespace SipSessionManager
 {
 using namespace AsteriskSCF::SIP::V1;
-#if 0
-class SipStateReplicatorI : public SipStateReplicator
-{
-public:
-    SipStateReplicatorI(std::string name);
-    ~SipStateReplicatorI();
-    void addListener(const SipStateReplicatorListenerPrx &listener, const Ice::Current&);
-    void removeListener(const SipStateReplicatorListenerPrx &listener, const Ice::Current &);
-    void setState(const SipStateItemSeq &items, const Ice::Current &);
-    void removeState(const SipStateItemSeq &items, const Ice::Current &);
-    SipStateItemSeq getState(const Ice::StringSeq &itemKeys, const Ice::Current &);
-    SipStateItemSeq getAllStates(const Ice::Current &);
-    std::string getName();
-private:
-    struct SipStateReplicatorImpl *mImpl;
-    //SipStateReplicatorImpl *mImpl;
-};
-#endif
 
-typedef AsteriskSCF::StateReplication::StateReplicator<SipStateReplicator, SipStateItemPtr, std::string, SipStateReplicatorListenerPrx> SipStateReplicatorI;
+typedef AsteriskSCF::StateReplication::StateReplicator<SipStateReplicator, SipStateItemPtr, std::string,
+                                                       SipStateReplicatorListenerPrx> SipStateReplicatorI;
 typedef IceUtil::Handle<SipStateReplicatorI> SipStateReplicatorIPtr;
 
 class SipStateReplicatorListenerI : public SipStateReplicatorListener
 {
 public:
-    SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory, PJSipManager *manager);
+    SipStateReplicatorListenerI(const boost::shared_ptr<SipEndpointFactory>& factory, PJSipManager *manager);
     ~SipStateReplicatorListenerI();
     void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
     void stateSet(const SipStateItemSeq&, const Ice::Current&);
-    bool operator==(SipStateReplicatorListenerI &rhs);
+    bool operator==(const SipStateReplicatorListenerI &rhs);
 private:
     struct SipStateReplicatorListenerImpl *mImpl;
 };
diff --git a/src/SipStateReplicatorApp.cpp b/src/SipStateReplicatorApp.cpp
index 32f35b9..fae2b3b 100644
--- a/src/SipStateReplicatorApp.cpp
+++ b/src/SipStateReplicatorApp.cpp
@@ -52,7 +52,7 @@ public:
     virtual void start(const string &name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args);
     virtual void stop();
 private:
-    void initialize(std::string appName, const Ice::CommunicatorPtr& ic);
+    void initialize(const std::string& appName, const Ice::CommunicatorPtr& ic);
     void registerWithServiceLocator(const Ice::CommunicatorPtr& ic);
     void deregisterFromServiceLocator();
     std::string mAppName;
@@ -95,13 +95,13 @@ public: // Overrides of the ComponentService interface.
     }
 
 private:
-    SipStateReplicatorService& mService;
+    SipStateReplicatorService& mService; // TODO: Reference?
 };
 
 class SipStateReplicatorCompare : public ServiceLocatorParamsCompare
 {
 public:
-    SipStateReplicatorCompare(string name) : mName(name) {}
+    SipStateReplicatorCompare(const string&  name) : mName(name) {}
     bool isSupported(const ServiceLocatorParamsPtr &params, const Ice::Current &)
     {
         SipStateReplicatorParamsPtr sipParams = SipStateReplicatorParamsPtr::dynamicCast(params);
@@ -126,21 +126,25 @@ void SipStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
     try
     {
         // Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system discovery mechanisms.
-        mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(ic->propertyToProxy("LocatorServiceManagement.Proxy"));
+        mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(
+            ic->propertyToProxy("LocatorServiceManagement.Proxy"));
 
         if (mServiceLocatorManagement == 0)
         {
-            lg(Error) << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. This component can't be found until this is corrected." << endl;
+            lg(Error) << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. "
+                "This component can't be found until this is corrected.";
             return;
         }
 
         // Get a proxy to our ComponentService interface and add it to the Service Locator.
-        Ice::ObjectPrx componentServiceObjectPrx = mAdapter->createDirectProxy(ic->stringToIdentity(ComponentServiceId));
+        Ice::ObjectPrx componentServiceObjectPrx =
+            mAdapter->createDirectProxy(ic->stringToIdentity(ComponentServiceId));
         ComponentServicePrx componentServicePrx = ComponentServicePrx::checkedCast(componentServiceObjectPrx);
 
         // The GUID passed in to add service needs to be unique for reporting.
         string componentServiceGuid(AsteriskSCF::SIP::V1::StateReplicatorComponentCategory);
-        mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
+        mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(
+            mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
 
         // Add category as a parameter to enable other components look this component up.
         ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
@@ -152,14 +156,16 @@ void SipStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
         SipStateReplicatorPrx stateReplicatorPrx = SipStateReplicatorPrx::checkedCast(stateReplicatorObjectPrx);
 
         string stateReplicationGuid(AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory);
-        mStateReplicationManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(stateReplicatorPrx, stateReplicationGuid));
+        mStateReplicationManagement = ServiceManagementPrx::uncheckedCast(
+            mServiceLocatorManagement->addService(stateReplicatorPrx, stateReplicationGuid));
 
         ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams();
         discoveryParams->category = AsteriskSCF::SIP::V1::StateReplicatorDiscoveryCategory;
 
         string replicatorName = ic->getProperties()->getPropertyWithDefault("SipStateReplicator.Name", "default");
         SipStateReplicatorCompare* nameCompare = new SipStateReplicatorCompare(replicatorName);
-        ServiceLocatorParamsComparePrx compareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(mAdapter->addWithUUID(nameCompare));
+        ServiceLocatorParamsComparePrx compareProxy =
+            ServiceLocatorParamsComparePrx::uncheckedCast(mAdapter->addWithUUID(nameCompare));
 
         string compareGuid = IceUtil::generateUUID();
         mServiceLocatorManagement->addCompare(compareGuid, compareProxy);
@@ -190,7 +196,7 @@ void SipStateReplicatorService::deregisterFromServiceLocator()
     }
 }
 
-void SipStateReplicatorService::initialize(const std::string appName, const Ice::CommunicatorPtr& ic)
+void SipStateReplicatorService::initialize(const std::string& appName, const Ice::CommunicatorPtr& ic)
 {
     mAdapter = ic->createObjectAdapter("SipStateReplicator");
 
diff --git a/src/SipStateReplicatorListener.cpp b/src/SipStateReplicatorListener.cpp
index 9f1f3db..36c09e4 100644
--- a/src/SipStateReplicatorListener.cpp
+++ b/src/SipStateReplicatorListener.cpp
@@ -58,8 +58,9 @@ private:
 struct SipStateReplicatorListenerImpl
 {
 public:
-    SipStateReplicatorListenerImpl(boost::shared_ptr<SipEndpointFactory> factory, PJSipManager *manager)
+    SipStateReplicatorListenerImpl(const boost::shared_ptr<SipEndpointFactory>& factory, PJSipManager *manager)
         : mId(IceUtil::generateUUID()), mEndpointFactory(factory), mManager(manager) {}
+    
     void removeStateNoticeImpl(const Ice::StringSeq& itemKeys)
     {
         for (Ice::StringSeq::const_iterator key = itemKeys.begin(); key != itemKeys.end(); ++key)
@@ -72,7 +73,8 @@ public:
     {
         for (SipStateItemSeq::const_iterator item = items.begin(); item != items.end(); ++item)
         {
-            std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> >::iterator i = mStateItems.find((*item)->mSessionId);
+            std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> >::iterator i =
+                mStateItems.find((*item)->mSessionId);
             SipSessionStateItemPtr session;
             SipDialogStateItemPtr dialog;
             SipInviteSessionStateItemPtr invitesession;
@@ -92,9 +94,10 @@ public:
                         continue;
                     }
 
-                    // Unlike other state items sessions are special in that they create the local class that binds everything together
+                    // Unlike other state items sessions are special in that they create the local class that binds
+                    // everything together
                     boost::shared_ptr<SipStateReplicatorItem> newitem(new SipStateReplicatorItem());
-                    mStateItems.insert(std::map<std::string, boost::shared_ptr<SipStateReplicatorItem> >::value_type((*item)->mSessionId, newitem));
+                    mStateItems.insert(make_pair((*item)->mSessionId, newitem));
                     localitem = newitem;
 
                     // Now that all is well we can create an actual session
@@ -121,7 +124,8 @@ public:
 
                 if (!localDialog)
                 {
-                    // Dialogs always start out as UAC since that does not require an actual packet, it is only later that we change them
+                    // Dialogs always start out as UAC since that does not require an actual packet, it is only later
+                    // that we change them
                     pj_str_t localUri = pj_str((char*)dialog->mLocalUri.c_str());
                     pj_str_t remoteUri = pj_str((char*)dialog->mRemoteUri.c_str());
                     if ((pjsip_dlg_create_uac(pjsip_ua_instance(), &localUri, &localUri, &remoteUri, &remoteUri, &localDialog)) != PJ_SUCCESS)
@@ -132,7 +136,8 @@ public:
 
                     localDialog->role = (dialog->mIsUac == true) ? PJSIP_ROLE_UAC : PJSIP_ROLE_UAS;
 
-                    // Since the Call ID will never change for the lifetime of the dialog we only mess with it here when creating the dialog itself
+                    // Since the Call ID will never change for the lifetime of the dialog we only mess with it here when
+                    // creating the dialog itself
                     pj_strdup2(localDialog->pool, &localDialog->call_id->id, dialog->mCallId.c_str());
 
                     // Secure status is another thing that should never change
@@ -144,29 +149,34 @@ public:
                     localDialog->mod_data[mManager->getSessionModule()->getModule().id] = (void *) dlg_mod_info;
                 }
 
-                localDialog->state = (dialog->mIsDialogEstablished == true) ? PJSIP_DIALOG_STATE_ESTABLISHED : PJSIP_DIALOG_STATE_NULL;
+                localDialog->state = (dialog->mIsDialogEstablished == true) ? PJSIP_DIALOG_STATE_ESTABLISHED :
+                    PJSIP_DIALOG_STATE_NULL;
                 localDialog->uac_has_2xx = (dialog->mUacHas2xx == true) ? PJ_TRUE : PJ_FALSE;
                 localDialog->local.cseq = dialog->mLocalCSeq;
                 localDialog->remote.cseq = dialog->mRemoteCSeq;
 
-                // Strings we do not just set since doing so could needlessly increase memory usage, and we have to be careful of that
+                // Strings we do not just set since doing so could needlessly increase memory usage, and we have to be
+                // careful of that
                 if (pj_strcmp2(&localDialog->local.info->tag, dialog->mLocalTag.c_str()))
                 {
                     pjsip_ua_unregister_dlg(pjsip_ua_instance(), localDialog);
                     pj_strdup2(localDialog->pool, &localDialog->local.info->tag, dialog->mLocalTag.c_str());
-                    localDialog->local.tag_hval = pj_hash_calc(0, localDialog->local.info->tag.ptr, localDialog->local.info->tag.slen);
+                    localDialog->local.tag_hval = pj_hash_calc(0, localDialog->local.info->tag.ptr,
+                            localDialog->local.info->tag.slen);
                     pjsip_ua_register_dlg(pjsip_ua_instance(), localDialog);
                 }
 
                 if (pj_strcmp2(&localDialog->remote.info->tag, dialog->mRemoteTag.c_str()))
                 {
                     pj_strdup2(localDialog->pool, &localDialog->remote.info->tag, dialog->mRemoteTag.c_str());
-                    localDialog->remote.tag_hval = pj_hash_calc(0, localDialog->remote.info->tag.ptr, localDialog->remote.info->tag.slen);
+                    localDialog->remote.tag_hval = pj_hash_calc(0, localDialog->remote.info->tag.ptr,
+                            localDialog->remote.info->tag.slen);
                 }
 
                 // TODO: Handle mRouteSet, which is not as easy as it sounds!
 
-                // TODO: Handle mTransport, which is rather difficult since transport is decided on a packet basis... do we even need it?
+                // TODO: Handle mTransport, which is rather difficult since transport is decided on a packet basis... do
+                // we even need it?
             }
             else if ((invitesession = SipInviteSessionStateItemPtr::dynamicCast((*item))))
             {
@@ -188,12 +198,14 @@ public:
                     }
                     localInviteSession->role = localDialog->role;
 
-                    PJSipSessionModInfo *session_mod_info = new PJSipSessionModInfo(localInviteSession, i->second->getSession());
+                    PJSipSessionModInfo *session_mod_info = new PJSipSessionModInfo(localInviteSession,
+                            i->second->getSession());
                     localInviteSession->mod_data[mManager->getSessionModule()->getModule().id] = session_mod_info;
 
                     i->second->getSession()->setInviteSession(localInviteSession);
 
-                    PJSipDialogModInfo *dlg_mod_info = static_cast<PJSipDialogModInfo *>(localDialog->mod_data[mManager->getSessionModule()->getModule().id]);
+                    PJSipDialogModInfo *dlg_mod_info = static_cast<PJSipDialogModInfo *>(
+                            localDialog->mod_data[mManager->getSessionModule()->getModule().id]);
                     pjsip_dlg_add_usage(localDialog, &mManager->getSessionModule()->getModule(), (void *)dlg_mod_info);
                 }
 
@@ -253,7 +265,8 @@ public:
     PJSipManager *mManager;
 };
 
-SipStateReplicatorListenerI::SipStateReplicatorListenerI(boost::shared_ptr<SipEndpointFactory> factory, PJSipManager *manager)
+SipStateReplicatorListenerI::SipStateReplicatorListenerI(const boost::shared_ptr<SipEndpointFactory>& factory,
+        PJSipManager *manager)
     : mImpl(new SipStateReplicatorListenerImpl(factory, manager)) {}
 
 SipStateReplicatorListenerI::~SipStateReplicatorListenerI()
@@ -271,7 +284,7 @@ void SipStateReplicatorListenerI::stateSet(const SipStateItemSeq& items, const I
     mImpl->setStateNoticeImpl(items);
 }
 
-bool SipStateReplicatorListenerI::operator==(SipStateReplicatorListenerI &rhs)
+bool SipStateReplicatorListenerI::operator==(const SipStateReplicatorListenerI &rhs)
 {
     return mImpl->mId == rhs.mImpl->mId;
 }

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list