From f2fc9a09d99722a7f1bff317502ac0719bf0434c Mon Sep 17 00:00:00 2001 From: "kurtis.heimerl" Date: Fri, 26 Oct 2012 06:26:15 +0000 Subject: [PATCH] r4216 and 4217 in private: Make multiple attempts at TCH channel assignment. (Yes, I saw this do something useful during one test.) Log abmormal Disconnect and Release at NOTICE level. Accessors for Cause element in L3 CC Release. git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4350 19bc5d8c-e614-43d4-8b26-e1612bc8e597 --- Control/CallControl.cpp | 57 +++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/Control/CallControl.cpp b/Control/CallControl.cpp index ce5fbba..ca386f1 100644 --- a/Control/CallControl.cpp +++ b/Control/CallControl.cpp @@ -64,6 +64,9 @@ using namespace Control; +// Forward refs. + +bool callManagementDispatchGSM(TransactionEntry *transaction, GSM::LogicalChannel* LCH, const GSM::L3Message *message); @@ -207,34 +210,47 @@ bool assignTCHF(TransactionEntry *transaction, GSM::LogicalChannel *DCCH, GSM::T TCH->open(); TCH->setPhy(*DCCH); - // Send the assignment. - transaction->channel(TCH); - LOG(DEBUG) << "updated transaction " << *transaction; - LOG(INFO) << "sending AssignmentCommand for " << *TCH << " on " << *DCCH; - DCCH->send(GSM::L3AssignmentCommand(TCH->channelDescription(),GSM::L3ChannelMode(GSM::L3ChannelMode::SpeechV1))); + // We retry this loop in case there are stray messages in the channel. + // On some phones, we see repeated Call Confirmed messages on MTC. - // This read is SUPPOSED to time out if the assignment was successful. - // Pad the timeout just in case there's a large latency somewhere. - GSM::L3Frame *result = DCCH->recv(GSM::T3107ms+2000); - if (result==NULL) { - LOG(INFO) << "sucessful assignment; exiting normally"; - DCCH->send(GSM::HARDRELEASE); - return true; + GSM::Z100Timer retry(GSM::T3101ms-1000); + retry.set(); + while (!retry.expired()) { + + // Send the assignment. + transaction->channel(TCH); + LOG(DEBUG) << "updated transaction " << *transaction; + LOG(INFO) << "sending AssignmentCommand for " << *TCH << " on " << *DCCH; + DCCH->send(GSM::L3AssignmentCommand(TCH->channelDescription(),GSM::L3ChannelMode(GSM::L3ChannelMode::SpeechV1))); + + // This read is SUPPOSED to time out if the assignment was successful. + // Pad the timeout just in case there's a large latency somewhere. + GSM::L3Frame *result = DCCH->recv(GSM::T3107ms+2000); + if (!result) { + LOG(INFO) << "sucessful assignment; exiting normally"; + DCCH->send(GSM::HARDRELEASE); + return true; + } + + // If we got here, the assignment failed, or there was a message backlog in L3. + GSM::L3Message *msg = parseL3(*result); + if (!msg) { LOG(NOTICE) << "waiting for assignment complete, received unparsed L3 frame " << *result; } + delete result; + if (!msg) continue; + LOG(NOTICE) << "waiting for assignment complete, received " << *msg; + callManagementDispatchGSM(transaction,DCCH,msg); } - // If we got here, the assignment failed. - LOG(NOTICE) << "received " << *result; - delete result; - // Turn off the TCH. TCH->send(GSM::RELEASE); + // RR Cause 0x04 -- "abnormal release, no activity on the radio path" + DCCH->send(GSM::L3ChannelRelease(0x04)); + // Dissociate channel from the transaction. // The tranaction no longer has a channel. transaction->channel(NULL); - // RR Cause 0x04 -- "abnormal release, no activity on the radio path" - DCCH->send(GSM::L3ChannelRelease(0x04)); // Shut down the SIP side of the call. forceSIPClearing(transaction); // Indicate failure. @@ -310,8 +326,11 @@ bool callManagementDispatchGSM(TransactionEntry *transaction, GSM::LogicalChanne // Disconnect (1st step of MOD) // GSM 04.08 5.4.3.2 - if (dynamic_cast(message)) { + if (const GSM::L3Release *rls = dynamic_cast(message)) { LOG(INFO) << "GSM Disconnect " << *transaction; + if (rls->haveCause() && (rls->cause().cause() > 0x10)) { + LOG(NOTICE) << "abnormal terminatation: " << *rls; + } /* late RLLP request */ if (gConfig.defines("Control.Call.QueryRRLP.Late")) { // Query for RRLP