[asterisk-scf-commits] asterisk-scf/release/sip.git branch "ami-route" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Nov 19 09:53:50 CST 2010


branch "ami-route" has been updated
       via  35690a88a5eb3b1b3489ca00bcc7a9113dd164ea (commit)
       via  478517fdad6acf1bd1fb59679f6428e27f8bfdf3 (commit)
      from  aff455f2325eaeccf88893db4ed650d5062272ba (commit)

Summary of changes:
 src/PJSipSessionModule.cpp |   35 +++++++++++++----------------------
 1 files changed, 13 insertions(+), 22 deletions(-)


- Log -----------------------------------------------------------------
commit 35690a88a5eb3b1b3489ca00bcc7a9113dd164ea
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Nov 19 09:58:32 2010 -0600

    Make Kevin's suggested change regarding renaming the callback member.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 654f67e..3f64de1 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -52,7 +52,7 @@ class RouteSessionCallback : public IceUtil::Shared
 public:
     RouteSessionCallback(pjsip_inv_session *inv_session, pjsip_tx_data *tdata)
         : mInvSession(inv_session), mTData(tdata) { }
-    void routeSessionCB(const Ice::AsyncResultPtr& r)
+    void callback(const Ice::AsyncResultPtr& r)
     {
         SessionRouterPrx router = SessionRouterPrx::uncheckedCast(r->getProxy());
         try
@@ -461,7 +461,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::routeSessionCB);
+            Ice::CallbackPtr d = Ice::newCallback(cb, &RouteSessionCallback::callback);
             mSessionRouter->begin_routeSession(session->getSessionProxy(), destination, d);
         }
     }

commit 478517fdad6acf1bd1fb59679f6428e27f8bfdf3
Author: Mark Michelson <mmichelson at digium.com>
Date:   Fri Nov 19 09:56:24 2010 -0600

    Address dlee's comments on Crucible.
    
    I removed the cookie class entirely, and instead moved the
    data that had been on the cookie previously into the callback
    class. This also implicitly handles his comment regarding the
    downcast of the cookie that was happening in the callback.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 68b8ec7..654f67e 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -47,41 +47,33 @@ using namespace AsteriskSCF::SessionCommunications::V1;
 using namespace AsteriskSCF::Media::V1;
 using namespace AsteriskSCF::SIP::V1;
 
-class RouteSessionCookie : public Ice::LocalObject
-{
-public:
-    RouteSessionCookie(pjsip_inv_session *inv_session, pjsip_tx_data *tdata)
-        : mInvSession(inv_session), mTData(tdata) { }
-    pjsip_inv_session *mInvSession;
-    pjsip_tx_data *mTData;
-};
-
-typedef IceUtil::Handle<RouteSessionCookie> RouteSessionCookiePtr;
-
 class RouteSessionCallback : public IceUtil::Shared
 {
 public:
+    RouteSessionCallback(pjsip_inv_session *inv_session, pjsip_tx_data *tdata)
+        : mInvSession(inv_session), mTData(tdata) { }
     void routeSessionCB(const Ice::AsyncResultPtr& r)
     {
         SessionRouterPrx router = SessionRouterPrx::uncheckedCast(r->getProxy());
-        RouteSessionCookiePtr cookie = RouteSessionCookiePtr::dynamicCast(r->getCookie());
         try
         {
             router->end_routeSession(r);
         }
         catch (const DestinationNotFoundException &)
         {
-            pjsip_inv_end_session(cookie->mInvSession, 404, NULL, &cookie->mTData);
-            pjsip_inv_send_msg(cookie->mInvSession, cookie->mTData);
+            pjsip_inv_end_session(mInvSession, 404, NULL, &mTData);
+            pjsip_inv_send_msg(mInvSession, mTData);
         }
         catch (...)
         {
-            pjsip_inv_end_session(cookie->mInvSession, 500, NULL, &cookie->mTData);
-            pjsip_inv_send_msg(cookie->mInvSession, cookie->mTData);
+            pjsip_inv_end_session(mInvSession, 500, NULL, &mTData);
+            pjsip_inv_send_msg(mInvSession, mTData);
         }
     }
+private:
+    pjsip_inv_session *mInvSession;
+    pjsip_tx_data *mTData;
 };
-
 typedef IceUtil::Handle<RouteSessionCallback> RouteSessionCallbackPtr;
 
 PJSipSessionModInfo::PJSipSessionModInfo(pjsip_inv_session *inv_session,
@@ -468,10 +460,9 @@ void PJSipSessionModule::handleNewInvite(pjsip_rx_data *rdata)
         else
         {
             // If this is not an attended transfer we can just route the session as normally
-            RouteSessionCallbackPtr cb = new RouteSessionCallback();
+            RouteSessionCallbackPtr cb = new RouteSessionCallback(inv_session, tdata);
             Ice::CallbackPtr d = Ice::newCallback(cb, &RouteSessionCallback::routeSessionCB);
-            RouteSessionCookiePtr cookie = new RouteSessionCookie(inv_session, tdata);
-            mSessionRouter->begin_routeSession(session->getSessionProxy(), destination, d, cookie);
+            mSessionRouter->begin_routeSession(session->getSessionProxy(), destination, d);
         }
     }
     catch (const Ice::CommunicatorDestroyedException &)

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


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list