mirror of
https://github.com/fairwaves/openbts-2.8.git
synced 2025-11-02 04:53:13 +00:00
Fixes #34 in public release. We now have different states for the MTDCanceling and canceled calls now end in a canceled state. Also a few other hardening bug fixes.
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@3018 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
@@ -118,7 +118,8 @@ void forceSIPClearing(TransactionEntry *transaction)
|
||||
{
|
||||
SIP::SIPState state = transaction->SIPState();
|
||||
LOG(INFO) << "SIP state " << state;
|
||||
if (state==SIP::Cleared) return;
|
||||
//why aren't we checking for failed here? -kurtis
|
||||
if (transaction->SIPFinished()) return;
|
||||
if (state==SIP::Active){
|
||||
//Changes state to clearing
|
||||
transaction->MODSendBYE();
|
||||
@@ -325,7 +326,7 @@ bool callManagementDispatchGSM(TransactionEntry *transaction, GSM::LogicalChanne
|
||||
LCH->send(GSM::L3ReleaseComplete(transaction->L3TI()));
|
||||
LCH->send(GSM::L3ChannelRelease());
|
||||
transaction->GSMState(GSM::NullState);
|
||||
transaction->MTDSendOK();
|
||||
transaction->MTDSendBYEOK();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -514,10 +515,9 @@ bool updateSIPSignalling(TransactionEntry *transaction, GSM::LogicalChannel *LCH
|
||||
|
||||
// The main purpose of this code is to initiate disconnects from the SIP side.
|
||||
|
||||
if (transaction->SIPState()==SIP::Cleared) return true;
|
||||
if (transaction->SIPFinished()) return true;
|
||||
|
||||
bool GSMClearedOrClearing = GSMCleared || transaction->clearingGSM();
|
||||
|
||||
if (transaction->MTDCheckBYE() == SIP::MTDClearing) {
|
||||
LOG(DEBUG) << "got SIP BYE " << *transaction;
|
||||
if (!GSMClearedOrClearing) {
|
||||
@@ -528,11 +528,11 @@ bool updateSIPSignalling(TransactionEntry *transaction, GSM::LogicalChannel *LCH
|
||||
} else {
|
||||
// GSM already cleared?
|
||||
// Ack the BYE and end the call.
|
||||
transaction->MTDSendOK();
|
||||
transaction->MTDSendBYEOK();
|
||||
}
|
||||
}
|
||||
|
||||
return transaction->SIPState()==SIP::Cleared;
|
||||
return (transaction->SIPFinished());
|
||||
}
|
||||
|
||||
|
||||
@@ -548,8 +548,8 @@ bool updateSignalling(TransactionEntry *transaction, GSM::LogicalChannel *LCH, u
|
||||
{
|
||||
|
||||
bool GSMCleared = (updateGSMSignalling(transaction,LCH,timeout));
|
||||
bool SIPCleared = updateSIPSignalling(transaction,LCH,GSMCleared);
|
||||
return GSMCleared && SIPCleared;
|
||||
bool SIPFinished = updateSIPSignalling(transaction,LCH,GSMCleared);
|
||||
return GSMCleared && SIPFinished;
|
||||
}
|
||||
|
||||
|
||||
@@ -628,7 +628,7 @@ bool waitInCall(TransactionEntry *transaction, GSM::TCHFACCHLogicalChannel *TCH,
|
||||
void callManagementLoop(TransactionEntry *transaction, GSM::TCHFACCHLogicalChannel* TCH)
|
||||
{
|
||||
LOG(INFO) << " call connected " << *transaction;
|
||||
// poll everything until the call is cleared
|
||||
// poll everything until the call is finished
|
||||
while (!pollInCall(transaction,TCH)) { }
|
||||
gTransactionTable.remove(transaction);
|
||||
}
|
||||
@@ -948,11 +948,17 @@ void Control::MTCStarter(TransactionEntry *transaction, GSM::LogicalChannel *LCH
|
||||
return;
|
||||
}
|
||||
// Check for SIP cancel, too.
|
||||
if (transaction->MTCCheckForCancel()==SIP::Fail) {
|
||||
LOG(NOTICE) << "call cancelled or failed on SIP side";
|
||||
if (transaction->MTCCheckForCancel()==SIP::MTDCanceling) {
|
||||
LOG(INFO) << "call cancelled on SIP side";
|
||||
transaction->MTDSendCANCELOK();
|
||||
// Cause 0x15 is "rejected"
|
||||
return abortAndRemoveCall(transaction,LCH,GSM::L3Cause(0x15));
|
||||
}
|
||||
//lastly check if we're toast
|
||||
if(transaction->SIPState()==SIP::Fail) {
|
||||
LOG(DEBUG) << "Call failed";
|
||||
return abortAndRemoveCall(transaction,LCH,GSM::L3Cause(0x7F));
|
||||
}
|
||||
}
|
||||
|
||||
// The transaction is moving to the MTCController.
|
||||
@@ -1006,8 +1012,15 @@ void Control::MTCController(TransactionEntry *transaction, GSM::TCHFACCHLogicalC
|
||||
transaction->MTCSendRinging();
|
||||
}
|
||||
// Check for SIP cancel, too.
|
||||
if (transaction->MTCCheckForCancel()==SIP::Fail) {
|
||||
LOG(DEBUG) << "MTCCheckForCancel return Fail";
|
||||
if (transaction->MTCCheckForCancel()==SIP::MTDCanceling) {
|
||||
LOG(INFO) << "MTCCheckForCancel return Canceling";
|
||||
transaction->MTDSendCANCELOK();
|
||||
// Cause 0x15 is "rejected"
|
||||
return abortAndRemoveCall(transaction,TCH,GSM::L3Cause(0x15));
|
||||
}
|
||||
//check if we're toast
|
||||
if (transaction->SIPState()==SIP::Fail){
|
||||
LOG(DEBUG) << "Call failed";
|
||||
return abortAndRemoveCall(transaction,TCH,GSM::L3Cause(0x7F));
|
||||
}
|
||||
}
|
||||
@@ -1031,6 +1044,10 @@ void Control::MTCController(TransactionEntry *transaction, GSM::TCHFACCHLogicalC
|
||||
break;
|
||||
case SIP::Connecting:
|
||||
break;
|
||||
case SIP::MTDCanceling:
|
||||
state = transaction->MTDSendCANCELOK();
|
||||
// Cause 0x15 is "rejected"
|
||||
return abortAndRemoveCall(transaction,TCH,GSM::L3Cause(0x15));
|
||||
default:
|
||||
LOG(NOTICE) << "SIP unexpected state " << state;
|
||||
break;
|
||||
|
||||
@@ -460,10 +460,18 @@ SIP::SIPState TransactionEntry::MTDCheckBYE()
|
||||
return state;
|
||||
}
|
||||
|
||||
SIP::SIPState TransactionEntry::MTDSendOK()
|
||||
SIP::SIPState TransactionEntry::MTDSendBYEOK()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
SIP::SIPState state = mSIP.MTDSendOK();
|
||||
SIP::SIPState state = mSIP.MTDSendBYEOK();
|
||||
echoSIPState(state);
|
||||
return state;
|
||||
}
|
||||
|
||||
SIP::SIPState TransactionEntry::MTDSendCANCELOK()
|
||||
{
|
||||
ScopedLock lock(mLock);
|
||||
SIP::SIPState state = mSIP.MTDSendCANCELOK();
|
||||
echoSIPState(state);
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -177,6 +177,8 @@ class TransactionEntry {
|
||||
|
||||
SIP::SIPState SIPState() { ScopedLock lock(mLock); return mSIP.state(); }
|
||||
|
||||
bool SIPFinished() { ScopedLock lock(mLock); return mSIP.finished(); }
|
||||
|
||||
SIP::SIPState MOCSendINVITE(const char* calledUser, const char* calledDomain, short rtpPort, unsigned codec);
|
||||
SIP::SIPState MOCResendINVITE();
|
||||
SIP::SIPState MOCWaitForOK();
|
||||
@@ -204,7 +206,8 @@ class TransactionEntry {
|
||||
SIP::SIPState MODWaitForOK();
|
||||
|
||||
SIP::SIPState MTDCheckBYE();
|
||||
SIP::SIPState MTDSendOK();
|
||||
SIP::SIPState MTDSendBYEOK();
|
||||
SIP::SIPState MTDSendCANCELOK();
|
||||
|
||||
// TODO: Remove contentType from here and use the setter above.
|
||||
SIP::SIPState MOSMSSendMESSAGE(const char* calledUser, const char* calledDomain, const char* contentType);
|
||||
|
||||
Reference in New Issue
Block a user