commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10087 - in openbts/branches/developers/dburgess00/ver


From: dburgess00
Subject: [Commit-gnuradio] r10087 - in openbts/branches/developers/dburgess00/veryearly: Control GSM SIP
Date: Fri, 28 Nov 2008 23:20:49 -0700 (MST)

Author: dburgess00
Date: 2008-11-28 23:20:48 -0700 (Fri, 28 Nov 2008)
New Revision: 10087

Modified:
   openbts/branches/developers/dburgess00/veryearly/Control/CallControl.cpp
   openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRElements.cpp
   openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRElements.h
   openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRMessages.cpp
   openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRMessages.h
   openbts/branches/developers/dburgess00/veryearly/SIP/SIPInterface.cpp
Log:
Final changes to support very early assignment.
This closes tracker #316.


Modified: 
openbts/branches/developers/dburgess00/veryearly/Control/CallControl.cpp
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/Control/CallControl.cpp    
2008-11-29 06:19:30 UTC (rev 10086)
+++ openbts/branches/developers/dburgess00/veryearly/Control/CallControl.cpp    
2008-11-29 06:20:48 UTC (rev 10087)
@@ -468,7 +468,7 @@
 
        // Determine if very early assignment already happened.
        bool veryEarly=false;
-       if (LCH->type()==TCHFType) veryEarly=true;
+       if (LCH->type()==FACCHType) veryEarly=true;
 
        // FIXME -- At this point, verify the that subscriber has access to 
this service.
        // If the subscriber isn't authorized, send a CM Service Reject with
@@ -697,12 +697,12 @@
 void Control::MTCStarter(const L3PagingResponse *resp, LogicalChannel *LCH)
 {
        assert(resp);
-       CLDCOUT("MTC: " << *resp);
        assert(LCH);
+       CLDCOUT("MTC on " << LCH->type() << ": " << *resp);
 
        // Determine if very early assigment already happened.
        bool veryEarly = false;
-       if (LCH->type()==TCHFType) veryEarly=true;
+       if (LCH->type()==FACCHType) veryEarly=true;
 
        // Allocate a TCH for the call.
        TCHFACCHLogicalChannel *TCH = NULL;
@@ -735,28 +735,44 @@
        CLDCOUT("MTC: wait for GSM Call Confirmed")
        while (transaction.Q931State()!=TransactionEntry::MTCConfirmed) {
                if (transaction.SIP().MTCSendTrying()==SIP::Fail) {
-                       TCH->send(RELEASE);
-                       return abortCall(transaction,LCH,L3Cause(0x7F));
+                       LCH->send(RELEASE);
+                       // Cause 0x03 is "no route to destination"
+                       return abortCall(transaction,LCH,L3Cause(0x03));
                }
                // FIXME -- What's the proper timeout here?
                // It's the SIP TRYING timeout, whatever that is.
                if (updateGSMSignalling(transaction,LCH,1000)) {
                        CLDCOUT("MTC: Release from GSM side");
-                       TCH->send(RELEASE);
+                       LCH->send(RELEASE);
                        return;
                }
                // Check for SIP cancel, too.
                if (transaction.SIP().MTCWaitForACK()==SIP::Fail) {
-                       TCH->send(RELEASE);
-                       return abortCall(transaction,LCH,L3Cause(0x7F));
+                       LCH->send(RELEASE);
+                       // Cause 0x10 is "normal clearing"
+                       return abortCall(transaction,LCH,L3Cause(0x10));
                }
        }
 
        // The transaction is moving to the MTCController.
        gTransactionTable.update(transaction);
        CLDCOUT("MTC: transaction: " << transaction);
-       if (veryEarly) 
MTCController(transaction,dynamic_cast<TCHFACCHLogicalChannel*>(LCH));
-       else assignTCHF(dynamic_cast<SDCCHLogicalChannel*>(LCH),TCH);
+       if (veryEarly) {
+               // For very early assignment, we need a mode change.
+               static const L3ChannelMode mode(L3ChannelMode::SpeechV1);
+               LCH->send(L3ChannelModeModify(LCH->channelDescription(),mode));
+               const L3ChannelModeModifyAcknowledge *ack =
+                       
dynamic_cast<L3ChannelModeModifyAcknowledge*>(getMessage(LCH));
+               if (!ack) throw UnexpectedMessage();
+               // Cause 0x06 is "channel unacceptable"
+               if (ack->mode() != mode) return 
abortCall(transaction,LCH,L3Cause(0x06));
+               
MTCController(transaction,dynamic_cast<TCHFACCHLogicalChannel*>(LCH));
+       }
+       else {
+               // For late assignment, send the TCH assignment now.
+               // This dispatcher on the next channel will continue the 
transaction.
+               assignTCHF(dynamic_cast<SDCCHLogicalChannel*>(LCH),TCH);
+       }
 }
 
 

Modified: 
openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRElements.cpp
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRElements.cpp    
2008-11-29 06:19:30 UTC (rev 10086)
+++ openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRElements.cpp    
2008-11-29 06:20:48 UTC (rev 10087)
@@ -111,6 +111,7 @@
 }
 
 
+
 void L3ControlChannelDescription::text(ostream& os) const
 {
        os << "ATT=" << mATT;
@@ -298,6 +299,7 @@
 
 void L3ChannelDescription::writeV( L3Frame &dest, size_t &wp ) const 
 {
+       // GSM 04.08 10.5.2.5
 //                                     Channel Description Format (non-hopping)
 //                     7      6      5      4      3     2      1      0
 //       [         TSC       ][ H=0 ][ SPARE(0,0)][ ARFCN[9:8] ]  Octet 3
@@ -305,7 +307,7 @@
 //
 
        // HACK -- Hard code for non-hopping.
-
+       assert(mHFlag==0);
        dest.writeField(wp,mTypeAndOffset,5);
        dest.writeField(wp,mTN,3);
        dest.writeField(wp,mTSC,3);
@@ -314,6 +316,24 @@
 }
 
 
+
+void L3ChannelDescription::parseV(const L3Frame& src, size_t &rp)
+{
+       // GSM 04.08 10.5.2.5
+       mTypeAndOffset = (TypeAndOffset)src.readField(rp,5);
+       mTN = src.readField(rp,3);
+       mTSC = src.readField(rp,3);
+       mHFlag = src.readField(rp,1);
+       if (mHFlag) {
+               mMAIO = src.readField(rp,6);
+               mHSN = src.readField(rp,6);
+       } else {
+               rp += 2;        // skip 2 spare bits
+               mARFCN = src.readField(rp,10);
+       }
+}
+
+
 void L3ChannelDescription::text(std::ostream& os) const
 {
 
@@ -405,6 +425,13 @@
        dest.writeField(wp, mMode, 8);
 }
 
+void L3ChannelMode::parseV(const L3Frame& src, size_t& rp)
+{
+       mMode = (Mode)src.readField(rp,8);
+}
+
+
+
 ostream& GSM::operator<<(ostream& os, L3ChannelMode::Mode mode)
 {
        switch (mode) {

Modified: openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRElements.h
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRElements.h      
2008-11-29 06:19:30 UTC (rev 10086)
+++ openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRElements.h      
2008-11-29 06:20:48 UTC (rev 10087)
@@ -387,10 +387,18 @@
                mARFCN(wARFCN),
                mMAIO(0),mHSN(0)
        { }
+
+       /** Blank initializer */
+       L3ChannelDescription()
+               :mTypeAndOffset(TDMA_MISC),
+               mTN(0),mTSC(0),mHFlag(0),mARFCN(0),mMAIO(0),mHSN(0)
+       { }
        
 
        void writeV( L3Frame &dest, size_t &wp ) const;
 
+       void parseV(const L3Frame& src, size_t &rp);
+
        size_t lengthV() const  { return 3; }
 
        void text(std::ostream&) const;
@@ -537,7 +545,11 @@
                mMode(wMode)
        {}
 
+       bool operator==(const L3ChannelMode& other) const { return 
mMode==other.mMode; }
+       bool operator!=(const L3ChannelMode& other) const { return 
mMode!=other.mMode; }
+
        void writeV(L3Frame& dest, size_t &wp) const;
+       void parseV(const L3Frame& src, size_t& wp);
        size_t lengthV() const { return 1; }
        void text(std::ostream&) const;
 

Modified: 
openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRMessages.cpp
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRMessages.cpp    
2008-11-29 06:19:30 UTC (rev 10086)
+++ openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRMessages.cpp    
2008-11-29 06:20:48 UTC (rev 10087)
@@ -121,6 +121,7 @@
                case L3RRMessage::AssignmentFailure: return new 
L3AssignmentFailure();
                case L3RRMessage::RRStatus: return new L3RRStatus();
                case L3RRMessage::PagingResponse: return new L3PagingResponse();
+               case L3RRMessage::ChannelModeModifyAcknowledge: return new 
L3ChannelModeModifyAcknowledge();
                default:
                        CERR("WARNING -- no L3 RR factory support for " << MTI);
                        return NULL;

Modified: openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRMessages.h
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRMessages.h      
2008-11-29 06:19:30 UTC (rev 10086)
+++ openbts/branches/developers/dburgess00/veryearly/GSM/GSML3RRMessages.h      
2008-11-29 06:20:48 UTC (rev 10087)
@@ -722,6 +722,9 @@
 
        public:
 
+       const L3ChannelDescription& description() const { return mDescription; }
+       const L3ChannelMode& mode() const { return mMode; }
+
        int MTI() const { return (int) ChannelModeModifyAcknowledge; }
 
        size_t bodyLength() const

Modified: openbts/branches/developers/dburgess00/veryearly/SIP/SIPInterface.cpp
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/SIP/SIPInterface.cpp       
2008-11-29 06:19:30 UTC (rev 10086)
+++ openbts/branches/developers/dburgess00/veryearly/SIP/SIPInterface.cpp       
2008-11-29 06:20:48 UTC (rev 10087)
@@ -43,9 +43,17 @@
 using namespace Control;
 
 
+/**
+       The channel type to request in paging.
+       Request SDCCHType for early assignment or
+       TCHFType for very early assignment.
+*/
+const GSM::ChannelType RequiredChannel = GSM::TCHFType;
+//const GSM::ChannelType RequiredChannel = GSM::SDCCHType;
 
 
 
+
 // SIPMessageMap method definitions.
 
 void SIPMessageMap::write(const std::string& call_id, osip_message_t * msg)
@@ -193,7 +201,7 @@
        if(msg->sip_method == NULL){ return false; }
        if( strcmp(msg->sip_method,"INVITE") != 0) {return false;}
 
-       // FIXME -- Check gBTS for TCH and SDCCH availability.  Bug #130.
+       // FIXME -- Check gBTS for TCH availability, bug #330.
        // Respond with a congestion message if none are available.
 
        // Get call_id from invite message.
@@ -219,18 +227,13 @@
                        return false;
                }
                DCOUT("SIPInterface::checkInvite: repeated SIP invite, 
repaging") 
-               gBTS.pager().addID(mobile_id,GSM::SDCCHType);   
+               gBTS.pager().addID(mobile_id,RequiredChannel);  
                transaction.T3113().set();
                gTransactionTable.update(transaction);
                osip_free(to_uri);
                return false;
        }
 
-       // FIXME -- At this point, check for the mobile_id in the transaction 
table.
-       // Bug #131.
-       // If it's there, it could mean the phone's already busy, depending on 
the state.
-       // Respond with Busy.
-
        // Add an entry to the SIP Map.
        mSIPMap.add(call_id_string);
 
@@ -254,7 +257,7 @@
        
        // Add to paging list.
        DCOUT("SIPInterface::checkInvite: new SIP invite, initial paging") 
-       gBTS.pager().addID(mobile_id,GSM::SDCCHType);   
+       gBTS.pager().addID(mobile_id,RequiredChannel);  
 
        osip_free(to_uri);
        return true;





reply via email to

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