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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Apr 12 20:34:44 CDT 2011


branch "route_replica" has been updated
       via  d47ab831d318683075b4bb449400c6495897af5a (commit)
      from  cb755f8a3323b07ee999aa1559439e1410dded92 (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit d47ab831d318683075b4bb449400c6495897af5a
Author: Ken Hunt <ken.hunt at digium.com>
Date:   Tue Apr 12 20:34:04 2011 -0500

    Cleanup of transaction setting on routing operations.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index cd7ca72..199d796 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -167,6 +167,17 @@ private:
     const std::string mCallbackName;
 };
 
+/**
+ * Utility function to create an Ice context with a single entry. 
+ * The entry in the context is a transaction id, and it is set to a UUID. 
+ */
+Ice::Context nextTransactionalContext()
+{
+    Ice::Context context;
+    context[AsteriskSCF::SessionCommunications::V1::TransactionKey] = IceUtil::generateUUID();
+    return context;
+}
+
 typedef IceUtil::Handle<ListenerCallback> ListenerCallbackPtr;
 
 PJSipSessionModInfo::PJSipSessionModInfo(pjsip_inv_session *inv_session,
@@ -555,8 +566,7 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
             // If this is not an attended transfer we can just route the session as normally
             RouteSessionCallbackPtr cb = new RouteSessionCallback(inv_session, tdata);
             Ice::CallbackPtr d = Ice::newCallback(cb, &RouteSessionCallback::callback);
-            Ice::Context context;
-            context[AsteriskSCF::SessionCommunications::V1::TransactionKey] = IceUtil::generateUUID();
+            Ice::Context context = nextTransactionalContext();
             mSessionRouter->begin_routeSession(session->getSessionProxy(), destination, context, d);
         }
     }
@@ -694,8 +704,7 @@ 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(). ";
-            Ice::Context context;
-            context[AsteriskSCF::SessionCommunications::V1::TransactionKey] = IceUtil::generateUUID();
+            Ice::Context context = nextTransactionalContext();
             mSessionRouter->begin_connectBridgedSessions(session->getSessionProxy(), other_session->getSessionProxy(), context, d);
         }
         catch (const Ice::CommunicatorDestroyedException &)
@@ -719,8 +728,7 @@ void PJSipSessionModule::handleRefer(pjsip_inv_session *inv, pjsip_rx_data *rdat
             Ice::CallbackPtr d = Ice::newCallback(cb, &ConnectBridgedSessionsWithDestinationCallback::callback);
 
             lg(Debug) << "handleRefer() calling router connectBridgedSessionsWithDestination(). ";
-            Ice::Context context;
-            context[AsteriskSCF::SessionCommunications::V1::TransactionKey] = IceUtil::generateUUID();
+            Ice::Context context = nextTransactionalContext();
             mSessionRouter->begin_connectBridgedSessionsWithDestination(session->getSessionProxy(), target, context, d);
         }
         catch (const Ice::CommunicatorDestroyedException &)

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list