[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
Wed Jul 27 16:49:22 CDT 2011


branch "transfer-improvements" has been updated
       via  8606dbf96a428332539b91df02e0bd0c342ecf52 (commit)
       via  a8c236852ab96289a3ee8bff6aad7f9d89d21c6c (commit)
       via  e6438a32448f0543b9c1d5377f0d30d29fe3977a (commit)
      from  8c16967c089d97469b3381470e86eef2a4c6b9e3 (commit)

Summary of changes:
 src/SipTransfer.cpp |   68 +++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 58 insertions(+), 10 deletions(-)


- Log -----------------------------------------------------------------
commit 8606dbf96a428332539b91df02e0bd0c342ecf52
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jul 27 16:44:10 2011 -0500

    Be sure to clean up after we're done using the session creation hook and session listeners.

diff --git a/src/SipTransfer.cpp b/src/SipTransfer.cpp
index 99b4328..1a6e63b 100644
--- a/src/SipTransfer.cpp
+++ b/src/SipTransfer.cpp
@@ -77,8 +77,8 @@ using namespace AsteriskSCF::System::Hook::V1;
 class TransferListener : public SessionListener
 {
 public:
-    TransferListener(pjsip_dialog *dlg, pj_int32_t referCSeq)
-        : mDialog(dlg), mReferCSeq(referCSeq)
+    TransferListener(const Ice::ObjectAdapterPtr& adapter, pjsip_dialog *dlg, pj_int32_t referCSeq)
+        : mAdapter(adapter), mDialog(dlg), mReferCSeq(referCSeq)
     {
     }
 
@@ -91,12 +91,14 @@ public:
         ConnectedIndicationPtr connected;
         StoppedIndicationPtr stopped;
         RingingIndicationPtr ringing;
+        ProgressingIndicationPtr progressing;
         if ((connected = ConnectedIndicationPtr::dynamicCast(event)))
         {
             lg(Debug) << "Got the connected indication. Should send a 200 sipfrag NOTIFY";
             pjsip_tx_data *tdata = createNotify(mDialog, mReferCSeq);
             addNotifyBody(tdata, "SIP/2.0 200 OK");
             pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
+            die();
         }
         else if ((stopped = StoppedIndicationPtr::dynamicCast(event)))
         {
@@ -104,6 +106,7 @@ public:
             pjsip_tx_data *tdata = createNotify(mDialog, mReferCSeq);
             addNotifyBody(tdata, "SIP/2.0 200 OK");
             pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
+            die();
         }
         else if ((ringing = RingingIndicationPtr::dynamicCast(event)))
         {
@@ -112,10 +115,30 @@ public:
             addNotifyBody(tdata, "SIP/2.0 180 Ringing");
             pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
         }
+        else if ((progressing = ProgressingIndicationPtr::dynamicCast(event)))
+        {
+            lg(Debug) << "Got a progressing indication. Should send a 183 sipfrag NOTIFY";
+            pjsip_tx_data *tdata = createNotify(mDialog, mReferCSeq);
+            addNotifyBody(tdata, "SIP/2.0 183 Session Progress");
+            pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
+        }
+    }
+
+    void setProxyID(const Ice::Identity& id)
+    {
+        mProxyID = id;
     }
 private:
+
+    void die()
+    {
+        mAdapter->remove(mProxyID);
+    }
+
+    Ice::ObjectAdapterPtr mAdapter;
     pjsip_dialog *mDialog;
     pj_int32_t mReferCSeq;
+    Ice::Identity mProxyID;
 };
 
 typedef IceUtil::Handle<TransferListener> TransferListenerPtr;
@@ -141,24 +164,40 @@ public:
         setStuff(originalData, replacementData);
         HookResult result;
         result.status = Succeeded;
+        //There's no need for this hook to exist after the sesion
+        //gets modified. Go ahead and die.
+        die();
         return result;
     }
 
+    void setProxyID(const Ice::Identity& id)
+    {
+        mProxyID = id;
+    }
+
 private:
     void setStuff(
             const SessionCreationHookDataPtr& original,
             SessionCreationHookDataPtr& replacement)
     {
-        TransferListenerPtr transferListener = new TransferListener(mDialog, mReferCSeq);
+        TransferListenerPtr transferListener = new TransferListener(mAdapter, mDialog, mReferCSeq);
         SessionListenerPrx transferListenerPrx = SessionListenerPrx::uncheckedCast(mAdapter->addWithUUID(transferListener));
+        transferListener->setProxyID(transferListenerPrx->ice_getIdentity());
         SessionListenerSeq listeners = original->listeners;
         listeners.push_back(transferListenerPrx);
         replacement->session = original->session;
         replacement->listeners = listeners;
     }
+
+    void die()
+    {
+        mAdapter->remove(mProxyID);
+    }
+
     Ice::ObjectAdapterPtr mAdapter;
     pjsip_dialog *mDialog;
     pj_int32_t mReferCSeq;
+    Ice::Identity mProxyID;
 };
 
 typedef IceUtil::Handle<TransferSessionCreationHook> TransferSessionCreationHookPtr;
@@ -336,6 +375,7 @@ SuspendableWorkResult HandleReferOperation::initial(const SuspendableWorkListene
             mWasWithDestination = true;
             TransferSessionCreationHookPtr hook(new TransferSessionCreationHook(mAdapter, mInv->dlg, mReferCSeq));
             SessionCreationHookPrx hookPrx = SessionCreationHookPrx::uncheckedCast(mAdapter->addWithUUID(hook));
+            hook->setProxyID(hookPrx->ice_getIdentity());
             mHookPrxID = hookPrx->ice_getIdentity();
             mSessionRouter->begin_connectBridgedSessionsWithDestination(operationId, session->getSessionProxy(), mTarget, hookPrx, d);
             return Complete;

commit a8c236852ab96289a3ee8bff6aad7f9d89d21c6c
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jul 27 15:08:29 2011 -0500

    Add ringing sipfrag NOTIFY.

diff --git a/src/SipTransfer.cpp b/src/SipTransfer.cpp
index cbf1430..99b4328 100644
--- a/src/SipTransfer.cpp
+++ b/src/SipTransfer.cpp
@@ -90,6 +90,7 @@ public:
     {
         ConnectedIndicationPtr connected;
         StoppedIndicationPtr stopped;
+        RingingIndicationPtr ringing;
         if ((connected = ConnectedIndicationPtr::dynamicCast(event)))
         {
             lg(Debug) << "Got the connected indication. Should send a 200 sipfrag NOTIFY";
@@ -97,13 +98,20 @@ public:
             addNotifyBody(tdata, "SIP/2.0 200 OK");
             pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
         }
-        if ((stopped = StoppedIndicationPtr::dynamicCast(event)))
+        else if ((stopped = StoppedIndicationPtr::dynamicCast(event)))
         {
             lg(Debug) << "Got the stopped indication. Should send some sort of final response sipfrag NOTIFY";
             pjsip_tx_data *tdata = createNotify(mDialog, mReferCSeq);
             addNotifyBody(tdata, "SIP/2.0 200 OK");
             pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
         }
+        else if ((ringing = RingingIndicationPtr::dynamicCast(event)))
+        {
+            lg(Debug) << "Got a ringing indication. Should send a 180 sipfrag NOTIFY";
+            pjsip_tx_data *tdata = createNotify(mDialog, mReferCSeq);
+            addNotifyBody(tdata, "SIP/2.0 180 Ringing");
+            pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
+        }
     }
 private:
     pjsip_dialog *mDialog;

commit e6438a32448f0543b9c1d5377f0d30d29fe3977a
Author: Mark Michelson <mmichelson at digium.com>
Date:   Wed Jul 27 13:36:45 2011 -0500

    Send proper sipfrag NOTIFYs on indications.

diff --git a/src/SipTransfer.cpp b/src/SipTransfer.cpp
index 85cda24..cbf1430 100644
--- a/src/SipTransfer.cpp
+++ b/src/SipTransfer.cpp
@@ -93,10 +93,16 @@ public:
         if ((connected = ConnectedIndicationPtr::dynamicCast(event)))
         {
             lg(Debug) << "Got the connected indication. Should send a 200 sipfrag NOTIFY";
+            pjsip_tx_data *tdata = createNotify(mDialog, mReferCSeq);
+            addNotifyBody(tdata, "SIP/2.0 200 OK");
+            pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
         }
         if ((stopped = StoppedIndicationPtr::dynamicCast(event)))
         {
             lg(Debug) << "Got the stopped indication. Should send some sort of final response sipfrag NOTIFY";
+            pjsip_tx_data *tdata = createNotify(mDialog, mReferCSeq);
+            addNotifyBody(tdata, "SIP/2.0 200 OK");
+            pjsip_dlg_send_request(mDialog, tdata, -1, NULL);
         }
     }
 private:
@@ -374,13 +380,7 @@ SuspendableWorkResult HandleReferOperation::calledBack(const Ice::AsyncResultPtr
         mAdapter->remove(mHookPrxID);
         return Complete;
     }
-
-    addNotifyBody(tdata, "SIP/2.0 200 OK");
-    pjsip_dlg_send_request(mInv->dlg, tdata, -1, NULL);
     
-    Ice::Current current;
-    lg(Debug) << "ConnectBridgedSessionsCallback calling session->stop(). ";
-    mSession->stop(new ResponseCode(16), current);
     return Complete;
 }
 

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


-- 
asterisk-scf/integration/sip.git



More information about the asterisk-scf-commits mailing list