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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Jun 1 13:48:31 CDT 2011


branch "master" has been updated
       via  a41ade002c57ccdd90495a8c0d50ba40dd69e19d (commit)
      from  d85f529e42fa80a0a9f3309c34aab9d5b19fa1cc (commit)

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


- Log -----------------------------------------------------------------
commit a41ade002c57ccdd90495a8c0d50ba40dd69e19d
Author: Joshua Colp <jcolp at digium.com>
Date:   Wed Jun 1 15:45:14 2011 -0300

    Don't try to get the dialog from the transaction within the task since by the time it is executed the dialog will have been removed from it.

diff --git a/src/PJSipSessionModule.cpp b/src/PJSipSessionModule.cpp
index 6d3d980..ddc112d 100644
--- a/src/PJSipSessionModule.cpp
+++ b/src/PJSipSessionModule.cpp
@@ -182,8 +182,10 @@ void PJSipSessionModule::replicateState(PJSipDialogModInfo *dlgInfo, PJSipTransa
         lg(Debug) << "Is Secure: " << dlgInfo->mDialogState->mIsSecure;
         lg(Debug) << "Local CSeq: " << dlgInfo->mDialogState->mLocalCSeq;
         lg(Debug) << "Local URI: " << dlgInfo->mDialogState->mLocalUri;
+	lg(Debug) << "Local tag: " << dlgInfo->mDialogState->mLocalTag;
         lg(Debug) << "Remote CSeq: " << dlgInfo->mDialogState->mRemoteCSeq;
         lg(Debug) << "Remote URI: " << dlgInfo->mDialogState->mRemoteUri;
+	lg(Debug) << "Remote tag: " << dlgInfo->mDialogState->mRemoteTag;
         lg(Debug) << "Transport: " << dlgInfo->mDialogState->mTransport;
         lg(Debug) << "UAC Has 2xx: " << dlgInfo->mDialogState->mUacHas2xx;
         lg(Debug) << "Is Uac: " << dlgInfo->mDialogState->mIsUac;
@@ -1064,9 +1066,14 @@ public:
             const PJSipSessionModulePtr& module,
             pjsip_transaction *tsx,
             pjsip_inv_session *inv,
+	    pjsip_dialog *dlg,
             const int eventType,
             const int tsxState)
-        : mSessionModule(module), mTsx(tsx), mInv(inv), mEventType(eventType), mTsxState(tsxState) { }
+        : mSessionModule(module), mTsx(tsx), mInv(inv), mDlg(dlg), mEventType(eventType), mTsxState(tsxState)
+    { pjsip_dlg_inc_session(dlg, &mSessionModule->getModule()); }
+
+    ~TransactionStateOperation()
+    { pjsip_dlg_dec_session(mDlg, &mSessionModule->getModule()); }
 
 protected:
     SuspendableWorkResult initial(const SuspendableWorkListenerPtr&)
@@ -1087,11 +1094,11 @@ protected:
         }
         if (mEventType == PJSIP_EVENT_TSX_STATE)
         {
-            pjsip_dialog *dlg = pjsip_tsx_get_dlg(mTsx);
-            PJSipDialogModInfo *dlg_mod_info = dlg ? static_cast<PJSipDialogModInfo*>(dlg->mod_data[mSessionModule->getModule().id]) : NULL;
+            PJSipDialogModInfo *dlg_mod_info = mDlg ? static_cast<PJSipDialogModInfo*>(mDlg->mod_data[mSessionModule->getModule().id]) : NULL;
             if (dlg_mod_info)
             {
-                dlg_mod_info->updateDialogState(dlg);
+		std::cout << "Updating dialog state in transaction state operation" << std::endl;
+                dlg_mod_info->updateDialogState(mDlg);
             }
             PJSipSessionModInfo *session_mod_info = static_cast<PJSipSessionModInfo*>(mInv->mod_data[mSessionModule->getModule().id]);
             if (session_mod_info)
@@ -1113,6 +1120,7 @@ private:
     PJSipSessionModulePtr mSessionModule;
     pjsip_transaction *mTsx;
     pjsip_inv_session *mInv;
+    pjsip_dialog *mDlg;
     const int mEventType;
     const int mTsxState;
 };
@@ -1213,8 +1221,8 @@ protected:
                     {
                         lg(Debug) << "Queuing a TransactionStateOperation";
                         mSessionModule->enqueueSessionWork(
-                                new TransactionStateOperation(mSessionModule, mInv->invite_tsx, mInv, mEventType, mInv->invite_tsx->state),
-                                mInv);
+			    new TransactionStateOperation(mSessionModule, mInv->invite_tsx, mInv, pjsip_tsx_get_dlg(mInv->invite_tsx),
+				mEventType, mInv->invite_tsx->state), mInv);
                     }
                 }
             }
@@ -1305,7 +1313,7 @@ void PJSipSessionModule::invOnTsxStateChanged(pjsip_inv_session *inv, pjsip_tran
 
         std::string method(pj_strbuf(&tsx->method.name), pj_strlen(&tsx->method.name));
         lg(Debug) << "Queuing a Transaction state operation for transaction " << tsx  << " Method: " << method;
-        enqueueSessionWork(new TransactionStateOperation(this, tsx, inv, e->type, tsx->state), inv);
+        enqueueSessionWork(new TransactionStateOperation(this, tsx, inv, pjsip_tsx_get_dlg(tsx), e->type, tsx->state), inv);
     }
 }
 

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


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list