commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10009 - in openbts/branches/developers/dburgess00/tru


From: dburgess00
Subject: [Commit-gnuradio] r10009 - in openbts/branches/developers/dburgess00/trunk: Control SIP
Date: Mon, 17 Nov 2008 20:20:30 -0700 (MST)

Author: dburgess00
Date: 2008-11-17 20:20:29 -0700 (Mon, 17 Nov 2008)
New Revision: 10009

Modified:
   openbts/branches/developers/dburgess00/trunk/Control/CallControl.cpp
   openbts/branches/developers/dburgess00/trunk/Control/ControlCommon.cpp
   openbts/branches/developers/dburgess00/trunk/Control/ControlCommon.h
   openbts/branches/developers/dburgess00/trunk/SIP/SIPInterface.cpp
Log:
Assign transaction ID and L3 TIValue in the TransactionEntry constructor.
This greatly mitigates bug #317, although TransactionTable::update still
does not perform as expected.


Modified: openbts/branches/developers/dburgess00/trunk/Control/CallControl.cpp
===================================================================
--- openbts/branches/developers/dburgess00/trunk/Control/CallControl.cpp        
2008-11-17 05:26:23 UTC (rev 10008)
+++ openbts/branches/developers/dburgess00/trunk/Control/CallControl.cpp        
2008-11-18 03:20:29 UTC (rev 10009)
@@ -212,6 +212,8 @@
        // Call clearing steps.
        // Good diagrams in GSM 04.08 7.3.4
 
+       // FIXME -- We should be checking TI values against the transaction 
object.
+
        // Disconnect (1st step of MOD)
        // GSM 04.08 5.4.3.2
        if (const L3Disconnect* disconnect = dynamic_cast<const 
L3Disconnect*>(message)) {
@@ -389,7 +391,6 @@
        bool SIPCleared = (engine.state()==SIP::Cleared);
 
        return GSMCleared && SIPCleared;
-
 }
 
 
@@ -526,10 +527,10 @@
                setup->calledPartyBCDNumber());
        transaction.SIP().User(IMSI);
        transaction.Q931State(TransactionEntry::MOCInitiated);
-       unsigned transactionID = gTransactionTable.add(transaction);
-       SDCCH->transactionID(transactionID);
-       TCH->transactionID(transactionID);
+       SDCCH->transactionID(transaction.ID());
+       TCH->transactionID(transaction.ID());
        CLDCOUT("MOC: transaction: " << transaction);
+       gTransactionTable.add(transaction);
 
        // At this point, we have enough information start the SIP call setup.
        // We have 2 seconds to repsond to the MS.  ITU-T Q.931 Table 9-1, T303.
@@ -696,16 +697,14 @@
        // Find the transction table entry that was created when the phone was 
paged.
        CLDCOUT("MTC: find TransactionEntry for " << resp->mobileIdentity());
        TransactionEntry transaction;
-       unsigned transactionID = 
gTransactionTable.findByMobileID(resp->mobileIdentity(),transaction);
-       if (transactionID==0) {
+       if 
(!gTransactionTable.findByMobileID(resp->mobileIdentity(),transaction)) {
                CLDCOUT("WARNING -- MTC attempt with no transaction record");
                return;
        }
-       unsigned L3TI = transactionID % 7;
-       CLDCOUT("MTC: transactionID="<<transactionID)
-       transaction.TIValue(L3TI);
-       TCH->transactionID(transactionID);      
-       SDCCH->transactionID(transactionID);    
+       CLDCOUT("MTC: transaction: "<< transaction);
+       TCH->transactionID(transaction.ID());   
+       SDCCH->transactionID(transaction.ID()); 
+       unsigned L3TI = transaction.TIValue();
 
        // GSM 04.08 5.2.2.1
        CLDCOUT("MTC: sending GSM Setup");

Modified: openbts/branches/developers/dburgess00/trunk/Control/ControlCommon.cpp
===================================================================
--- openbts/branches/developers/dburgess00/trunk/Control/ControlCommon.cpp      
2008-11-17 05:26:23 UTC (rev 10008)
+++ openbts/branches/developers/dburgess00/trunk/Control/ControlCommon.cpp      
2008-11-18 03:20:29 UTC (rev 10009)
@@ -46,6 +46,67 @@
 TransactionTable gTransactionTable;
 
 
+
+
+
+TransactionEntry::TransactionEntry()
+       :mID(gTransactionTable.newID()),
+       mQ931State(NullState),
+       mT301(T301ms), mT302(T302ms), mT303(T303ms),
+       mT304(T304ms), mT305(T305ms), mT308(T308ms),
+       mT310(T310ms), mT313(T313ms),
+       mT3113(GSM::T3113ms)
+{}
+
+TransactionEntry::TransactionEntry(const GSM::L3MobileIdentity& wSubscriber, 
+       const GSM::L3CMServiceType& wService,
+       const GSM::L3CallingPartyBCDNumber& wCalling)
+       :mID(gTransactionTable.newID()),
+       mSubscriber(wSubscriber),mService(wService),
+       mTIFlag(1), mTIValue(0),
+       mCalling(wCalling),
+       mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
+       mQ931State(NullState),
+       mT301(T301ms), mT302(T302ms), mT303(T303ms),
+       mT304(T304ms), mT305(T305ms), mT308(T308ms),
+       mT310(T310ms), mT313(T313ms),
+       mT3113(GSM::T3113ms)
+{}
+
+TransactionEntry::TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
+       const GSM::L3CMServiceType& wService,
+       unsigned wTIValue,
+       const GSM::L3CalledPartyBCDNumber& wCalled)
+       :mID(gTransactionTable.newID()),
+       mSubscriber(wSubscriber),mService(wService),
+       mTIFlag(0), mTIValue(wTIValue),
+       mCalled(wCalled),
+       mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
+       mQ931State(NullState),
+       mT301(T301ms), mT302(T302ms), mT303(T303ms),
+       mT304(T304ms), mT305(T305ms), mT308(T308ms),
+       mT310(T310ms), mT313(T313ms),
+       mT3113(GSM::T3113ms)
+{}
+
+
+TransactionEntry::TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
+       const GSM::L3CMServiceType& wService,
+       unsigned wTIValue,
+       const GSM::L3CallingPartyBCDNumber& wCalling)
+       :mID(gTransactionTable.newID()),
+       mSubscriber(wSubscriber),mService(wService),
+       mTIValue(wTIValue),mCalling(wCalling),
+       mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
+       mQ931State(NullState),
+       mT301(T301ms), mT302(T302ms), mT303(T303ms),
+       mT304(T304ms), mT305(T305ms), mT308(T308ms),
+       mT310(T310ms), mT313(T313ms),
+       mT3113(GSM::T3113ms)
+{}
+
+
+
 bool TransactionEntry::timerExpired() const
 {
        if (mT301.expired()) {
@@ -125,16 +186,21 @@
 }
 
 
-unsigned TransactionTable::add(TransactionEntry& value)
+unsigned TransactionTable::newID()
 {
+       mLock.lock();
+       unsigned ID = mIDCounter++;
+       mLock.unlock();
+       return ID;
+}
+
+
+void TransactionTable::add(const TransactionEntry& value)
+{
        clearDeadEntries();
        mLock.lock();
-       unsigned key = mIDCounter++;
-       value.ID(key);
-       TransactionMap::iterator iter = mTable.find(value.ID());
-       mTable[key]=value;
+       mTable[value.ID()]=value;
        mLock.unlock();
-       return key;
 }
 
 
@@ -145,8 +211,8 @@
        mLock.lock();
        TransactionMap::iterator iter = mTable.find(value.ID());
        if (iter==mTable.end()) {
+               mLock.unlock();
                CERR("WARNING -- attempt to update non-existent transaction 
entry with key " << value.ID());
-               mLock.unlock();
                return;
        }
        iter->second = value;
@@ -170,6 +236,8 @@
        return retVal;
 }
 
+
+
 bool TransactionTable::remove(unsigned key)
 {
        assert(key);
@@ -179,6 +247,8 @@
        return retVal;
 }
 
+
+
 void TransactionTable::clearDeadEntries()
 {
        mLock.lock();
@@ -201,25 +271,26 @@
        mLock.unlock();
 }
 
-unsigned TransactionTable::findByMobileID(const L3MobileIdentity& mobileID, 
TransactionEntry& target) const
+
+
+bool TransactionTable::findByMobileID(const L3MobileIdentity& mobileID, 
TransactionEntry& target) const
 {
        // FIXME -- If we were smart, we'd organize the table for a log-time 
search.
-       // Also removes "dead" entries.
-       unsigned retVal = 0;
+       bool foundIt = false;
        mLock.lock();
        // brute force search
        TransactionMap::const_iterator itr = mTable.begin();
        while (itr!=mTable.end()) {
                const TransactionEntry& transaction = itr->second;
                if (transaction.subscriber()==mobileID) {
-                       retVal = itr->first;
+                       foundIt = true;
                        target = transaction;
                        break;
                }
                ++itr;
        }
        mLock.unlock();
-       return retVal;
+       return foundIt;
 }
 
 

Modified: openbts/branches/developers/dburgess00/trunk/Control/ControlCommon.h
===================================================================
--- openbts/branches/developers/dburgess00/trunk/Control/ControlCommon.h        
2008-11-17 05:26:23 UTC (rev 10008)
+++ openbts/branches/developers/dburgess00/trunk/Control/ControlCommon.h        
2008-11-18 03:20:29 UTC (rev 10009)
@@ -332,59 +332,23 @@
 
        public:
 
-       TransactionEntry()
-               :mID(0),mQ931State(NullState),
-               mT301(T301ms), mT302(T302ms), mT303(T303ms),
-               mT304(T304ms), mT305(T305ms), mT308(T308ms),
-               mT310(T310ms), mT313(T313ms),
-               mT3113(GSM::T3113ms)
-       {}
+       TransactionEntry();
 
        /** This form is used for MTC. */
        TransactionEntry(const GSM::L3MobileIdentity& wSubscriber, 
                const GSM::L3CMServiceType& wService,
-               const GSM::L3CallingPartyBCDNumber& wCalling)
-               :mID(0),mSubscriber(wSubscriber),mService(wService),
-               // TIValue=7 means non-valid TI.
-               mTIFlag(1), mTIValue(7),
-               mCalling(wCalling),
-               mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
-               mQ931State(NullState),
-               mT301(T301ms), mT302(T302ms), mT303(T303ms),
-               mT304(T304ms), mT305(T305ms), mT308(T308ms),
-               mT310(T310ms), mT313(T313ms),
-               mT3113(GSM::T3113ms)
-       {}
+               const GSM::L3CallingPartyBCDNumber& wCalling);
 
        /** This form is used for MOC. */
        TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
                const GSM::L3CMServiceType& wService,
                unsigned wTIValue,
-               const GSM::L3CalledPartyBCDNumber& wCalled)
-               :mID(0),mSubscriber(wSubscriber),mService(wService),
-               mTIFlag(0), mTIValue(wTIValue),
-               mCalled(wCalled),
-               mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
-               mQ931State(NullState),
-               mT301(T301ms), mT302(T302ms), mT303(T303ms),
-               mT304(T304ms), mT305(T305ms), mT308(T308ms),
-               mT310(T310ms), mT313(T313ms),
-               mT3113(GSM::T3113ms)
-       {}
+               const GSM::L3CalledPartyBCDNumber& wCalled);
 
        TransactionEntry(const GSM::L3MobileIdentity& wSubscriber,
                const GSM::L3CMServiceType& wService,
                unsigned wTIValue,
-               const GSM::L3CallingPartyBCDNumber& wCalling)
-               :mID(0),mSubscriber(wSubscriber),mService(wService),
-               mTIValue(wTIValue),mCalling(wCalling),
-               mSIP(SIP_UDP_PORT,5060,"127.0.0.1"),
-               mQ931State(NullState),
-               mT301(T301ms), mT302(T302ms), mT303(T303ms),
-               mT304(T304ms), mT305(T305ms), mT308(T308ms),
-               mT310(T310ms), mT313(T313ms),
-               mT3113(GSM::T3113ms)
-       {}
+               const GSM::L3CallingPartyBCDNumber& wCalling);
 
        /address@hidden Accessors. */
        //@{
@@ -474,13 +438,15 @@
        }
 
        /**
+               Return a new ID for use in the table.
+       */
+       unsigned newID();
+
+       /**
                Insert a new entry into the table.
-               Also assigns a transaction ID to the argument
-               so that it will be identical to the copy in the table.
                @param value The entry to copy into the table.
-               @return The assigned transaction ID.
        */
-       unsigned add(TransactionEntry& value);
+       void add(const TransactionEntry& value);
 
        /**
                Update a transaction in the table.
@@ -508,18 +474,21 @@
                Find an entry by its mobile ID.
                @param mobileID The mobile at to search for.
                @param target A TransactionEntry to accept the found record.
-               @return Entry transaction ID or 0 on failure.
+               @return true is the mobile ID was foind.
        */
-       unsigned findByMobileID(const GSM::L3MobileIdentity& mobileID, 
TransactionEntry& target) const;
+       bool findByMobileID(const GSM::L3MobileIdentity& mobileID, 
TransactionEntry& target) const;
 
        /**
                Remove "dead" entries from the table.
+               A "dead" entry is a transaction that is no longer active.
        */
        void clearDeadEntries();
 };
 
 
 
+
+
 /address@hidden Control-layer exceptions. */
 //@{
 
@@ -586,11 +555,10 @@
 //@}
 
 
-
-
 }      //Control
 
 
+
 /address@hidden Globals */
 //@{
 /** A single global transaction table in the global namespace. */
@@ -599,6 +567,7 @@
 
 
 
+
 #endif
 
 // vim: ts=4 sw=4

Modified: openbts/branches/developers/dburgess00/trunk/SIP/SIPInterface.cpp
===================================================================
--- openbts/branches/developers/dburgess00/trunk/SIP/SIPInterface.cpp   
2008-11-17 05:26:23 UTC (rev 10008)
+++ openbts/branches/developers/dburgess00/trunk/SIP/SIPInterface.cpp   
2008-11-18 03:20:29 UTC (rev 10009)
@@ -214,8 +214,7 @@
        // Check SIP map.  Repeated entry?  Page again.
        if (mSIPMap.map().readNoBlock(call_id_string) != NULL) { 
                TransactionEntry transaction;
-               unsigned ID = 
gTransactionTable.findByMobileID(mobile_id,transaction);
-               if (ID==0) {
+               if (!gTransactionTable.findByMobileID(mobile_id,transaction)) {
                        CERR("WARNING -- repeated INVITE with no transaction 
record");
                        return false;
                }
@@ -249,8 +248,8 @@
        transaction.Q931State(TransactionEntry::Paging);
        transaction.SIP().User( call_id_num, to_sip_uri);
        transaction.SIP().saveINVITE(msg);
-       unsigned newID = gTransactionTable.add(transaction); 
-       DCOUT("SIPInterface::checkInvite: making transaction and add to 
transaction table ID= "<<newID)
+       gTransactionTable.add(transaction); 
+       DCOUT("SIPInterface::checkInvite: making transaction and add to 
transaction table ID= "<< transaction.ID());
        DCOUT("SIPInterface::checkInvite: adding mobile ID "<<mobile_id)
        
        // Add to paging list.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]