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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Jul 28 16:56:27 CDT 2011


branch "transfer-improvements" has been updated
       via  7295b9fd56b022ae4f2f3490a7b27adc8bb9d82b (commit)
      from  6dc4fb170b7ce46665a7b5bda8b51a0d16839ede (commit)

Summary of changes:
 src/SipTransfer.cpp |   29 ++++++++++++++++++++++++-----
 src/SipTransfer.h   |    5 ++---
 2 files changed, 26 insertions(+), 8 deletions(-)


- Log -----------------------------------------------------------------
commit 7295b9fd56b022ae4f2f3490a7b27adc8bb9d82b
Author: Mark Michelson <mmichelson at digium.com>
Date:   Thu Jul 28 16:56:59 2011 -0500

    Make concessions for attended transfers where necessary.

diff --git a/src/SipTransfer.cpp b/src/SipTransfer.cpp
index 5a0dec0..39da03d 100644
--- a/src/SipTransfer.cpp
+++ b/src/SipTransfer.cpp
@@ -249,7 +249,7 @@ HandleReferOperation::HandleReferOperation(
     mReferredBy(referredBy),
     mTarget(target),
     mSession(session), mSessionRouter(sessionRouter), mAdapter(adapter),
-    mModuleId(moduleId), mReferCSeq(tsx->cseq), mWasWithDestination(false) {}
+    mModuleId(moduleId), mReferCSeq(tsx->cseq), mBlindTransfer(false) {}
 
 HandleReferOperation::~HandleReferOperation()
 {
@@ -359,7 +359,7 @@ SuspendableWorkResult HandleReferOperation::initial(const SuspendableWorkListene
             lg(Debug) << "handleRefer() calling router connectBridgedSessionsWithDestination(). ";
             lg(Debug) << "Session to replace is with endpoint " << session->getEndpoint()->getName();
             lg(Debug) << "Destination is " << mTarget;
-            mWasWithDestination = true;
+            mBlindTransfer = true;
             
             createTransferSessionCreationHook();
             
@@ -387,7 +387,7 @@ SuspendableWorkResult HandleReferOperation::calledBack(const Ice::AsyncResultPtr
 
     try
     {
-        if (mWasWithDestination)
+        if (mBlindTransfer)
         {
             router->end_connectBridgedSessionsWithDestination(asyncResult);
         }
@@ -402,7 +402,11 @@ SuspendableWorkResult HandleReferOperation::calledBack(const Ice::AsyncResultPtr
         pjsip_tx_data *tdata = createNotify(mInv->dlg, mReferCSeq, false);
         addNotifyBody(tdata, "SIP/2.0 404 Not Found");
         pjsip_dlg_send_request(mInv->dlg, tdata, -1, NULL);
-        mAdapter->remove(mHookPrx->ice_getIdentity());
+        //Only blind transfers have the session creation hook to get rid of
+        if (mBlindTransfer)
+        {
+            mAdapter->remove(mHookPrx->ice_getIdentity());
+        }
         return Complete;
     }
     catch (const std::exception& e)
@@ -411,9 +415,24 @@ SuspendableWorkResult HandleReferOperation::calledBack(const Ice::AsyncResultPtr
         pjsip_tx_data *tdata = createNotify(mInv->dlg, mReferCSeq, false);
         addNotifyBody(tdata, "SIP/2.0 400 Bad Request");
         pjsip_dlg_send_request(mInv->dlg, tdata, -1, NULL);
-        mAdapter->remove(mHookPrx->ice_getIdentity());
+        //Only blind transfers have the session creation hook to get rid of
+        if (mBlindTransfer)
+        {
+            mAdapter->remove(mHookPrx->ice_getIdentity());
+        }
         return Complete;
     }
+
+    //With attended transfers, the call to the transfer target occurs
+    //prior to the REFER. Since we don't actually place a new call out to
+    //the transfer target, but just use the session we already have up, there
+    //is nothing to report on here, so we just fake a 200 OK sipfrag NOTIFY.
+    if (!mBlindTransfer)
+    {
+        pjsip_tx_data *tdata = createNotify(mInv->dlg, mReferCSeq, false);
+        addNotifyBody(tdata, "SIP/2.0 200 OK");
+        pjsip_dlg_send_request(mInv->dlg, tdata, -1, NULL);
+    }
     return Complete;
 }
 
diff --git a/src/SipTransfer.h b/src/SipTransfer.h
index 37ac51f..b00195e 100644
--- a/src/SipTransfer.h
+++ b/src/SipTransfer.h
@@ -134,11 +134,10 @@ private:
      */
     pj_int32_t mReferCSeq;
     /**
+     * Distinguishes between a blind and attended transfer.
      * Helps determine which end_* method to call on the session router when AMI completes.
-     * XXX It may be more elegant to handle this by sending a cookie to the AMI method
-     * instead.
      */
-    bool mWasWithDestination;
+    bool mBlindTransfer;
     /**
      * The proxy of the session creation hook we create.
      * We have to hold onto this in case our AMI call to create the outbound

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list