当前位置: 首页>>代码示例>>C++>>正文


C++ TransactionEntry::SIP方法代码示例

本文整理汇总了C++中TransactionEntry::SIP方法的典型用法代码示例。如果您正苦于以下问题:C++ TransactionEntry::SIP方法的具体用法?C++ TransactionEntry::SIP怎么用?C++ TransactionEntry::SIP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TransactionEntry的用法示例。


在下文中一共展示了TransactionEntry::SIP方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: forceSIPClearing

/**
	Force clearing on the SIP side.
	@param transaction The call transaction record.
*/
void forceSIPClearing(TransactionEntry& transaction)
{
	LOG(INFO) << "SIP state " << transaction.SIP().state();
	if (transaction.SIP().state()==SIP::Cleared) return;
	if (transaction.SIP().state()!=SIP::Clearing) {
		// This also changes the SIP state to "clearing".
		transaction.SIP().MODSendBYE();
	} else {
		transaction.SIP().MODResendBYE();
	}
	transaction.SIP().MODWaitForOK();
	gTransactionTable.update(transaction);
}
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:17,代码来源:CallControl.cpp

示例2: updateCallTraffic

/**
	Update vocoder data transfers in both directions.
	@param transaction The transaction object for this call.
	@param TCH The traffic channel for this call.
	@return True if anything was transferred.
*/
bool updateCallTraffic(TransactionEntry &transaction, TCHFACCHLogicalChannel *TCH)
{
	bool activity = false;

	SIPEngine& engine = transaction.SIP();


	// Transfer in the downlink direction (RTP->GSM).
	// Blocking call.  On average returns 1 time per 20 ms.
	// Returns non-zero if anything really happened.
	// Make the rxFrame buffer big enough for G.711.
	unsigned char rxFrame[160];
	if (engine.RxFrame(rxFrame)) {
		activity = true;
		TCH->sendTCH(rxFrame);
	}

	// Transfer in the uplink direction (GSM->RTP).
	// Flush FIFO to limit latency.
	unsigned maxQ = gConfig.getNum("GSM.MaxSpeechLatency");
	while (TCH->queueSize()>maxQ) delete[] TCH->recvTCH();
	if (unsigned char *txFrame = TCH->recvTCH()) {
		activity = true;
		// Send on RTP.
		engine.TxFrame(txFrame);
		delete[] txFrame;
	}

	// Return a flag so the caller will know if anything transferred.
	return activity;
}
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:37,代码来源:CallControl.cpp

示例3: clearTransactionHistory

void Control::clearTransactionHistory( TransactionEntry& transaction )
{
	SIP::SIPEngine& engine = transaction.SIP();
	LOG(DEBUG) << engine.callID()<<" "<< transaction.ID();
	gSIPInterface.removeCall(engine.callID());
	gTransactionTable.remove(transaction.ID());
}
开发者ID:EricYoel,项目名称:openbts-2.6,代码行数:7,代码来源:ControlCommon.cpp

示例4: callManagementLoop

/**
	This is the standard call manangement loop, regardless of the origination type.
	This function returns when the call is cleared and the channel is released.
	@param transaction The transaction record for this call, will be cleared on exit.
	@param TCH The TCH+FACCH for the call.
*/
void callManagementLoop(TransactionEntry &transaction, TCHFACCHLogicalChannel* TCH)
{
	LOG(INFO) << transaction.subscriber() << " call connected";
	transaction.SIP().FlushRTP();
	// poll everything until the call is cleared
	while (!pollInCall(transaction,TCH)) { }
	clearTransactionHistory(transaction);
}
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:14,代码来源:CallControl.cpp

示例5: updateSignalling

/**
	Check SIP and GSM signalling.
	Can block for up to 52 GSM L1 frames (240 ms) because LCH::send is blocking.
	@param transaction The call's TransactionEntry.
	@param LCH The call's logical channel (TCH/FACCH or SDCCH).
	@return true If the call is cleared in both domains.
*/
bool updateSignalling(TransactionEntry &transaction, LogicalChannel *LCH, unsigned timeout=0)
{

	bool GSMCleared = (updateGSMSignalling(transaction,LCH,timeout));

	// Look for a SIP message.
	SIPEngine& engine = transaction.SIP();
	if (engine.MTDCheckBYE() == SIP::Clearing) {
		if (!transaction.clearing()) {
			LOG(DEBUG) << "got BYE";
			LCH->send(L3Disconnect(1-transaction.TIFlag(),transaction.TIValue()));
			transaction.T305().set();
			transaction.Q931State(TransactionEntry::DisconnectIndication);
			// Return false, because it the call is not yet cleared.
			return false;
		} else {
			// If we're already clearing, send BYE again.
			//engine.MODSendBYE();
		}
	}
	bool SIPCleared = (engine.state()==SIP::Cleared);

	return GSMCleared && SIPCleared;
}
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:31,代码来源:CallControl.cpp

示例6: checkInvite

bool SIPInterface::checkInvite( osip_message_t * msg )
{
	LOG(DEBUG);

	// Is there even a method?
	const char *method = msg->sip_method;
	if (!method) return false;

	// Check for INVITE or MESSAGE methods.
	GSM::ChannelType requiredChannel;
	bool channelAvailable = false;
	bool shouldPage = true;
	GSM::L3CMServiceType serviceType;
	if (strcmp(method,"INVITE") == 0) {
		// INVITE is for MTC.
		// Set the required channel type to match the assignment style.
		if (gConfig.defines("GSM.VEA")) {
			// Very early assignment.
			requiredChannel = GSM::TCHFType;
			channelAvailable = gBTS.TCHAvailable();
		} else {
			// Early assignment
			requiredChannel = GSM::SDCCHType;
			channelAvailable = gBTS.SDCCHAvailable() && gBTS.TCHAvailable();
		}
		serviceType = L3CMServiceType::MobileTerminatedCall;
	}
	else if (strcmp(method,"MESSAGE") == 0) {
		// MESSAGE is for MTSMS or USSD
      if (  strcmp(gConfig.getStr("USSD.SIP.user"), msg->from->url->username)==0
         && strcmp(gConfig.getStr("USSD.SIP.domain"), msg->from->url->host)==0)
      {
         LOG(INFO) << "received MESSAGE is USSD from: "
                   << msg->from->url->username << "@" << msg->from->url->host;
         requiredChannel = GSM::SDCCHType;
			// TODO:: Understand how to behave when we need to page?
         channelAvailable = true; //gBTS.SDCCHAvailable();
         serviceType = L3CMServiceType::SupplementaryService;
      }
      else
      {
         LOG(INFO) << "received MESSAGE is SMS from: "
                   << msg->from->url->username << "@" << msg->from->url->host;
         requiredChannel = GSM::SDCCHType;
         channelAvailable = gBTS.SDCCHAvailable();
         serviceType = L3CMServiceType::MobileTerminatedShortMessage;
      }
	}
	else {
		// We must not handle this method.
		LOG(DEBUG) << "non-initiating SIP method " << method;
		return false;
	}

	// Check gBTS for channel availability.
	if (!channelAvailable) {
		// FIXME -- Send 503 "Service Unavailable" response on SIP interface.
		LOG(NOTICE) << "MTC CONGESTION, no " << requiredChannel << " availble for assignment";
		return false;
	}
	LOG(INFO) << "set up MTC paging for channel=" << requiredChannel;

	// Get call_id from invite message.
	if (!msg->call_id) {
		// FIXME -- Send appropriate error on SIP interface.
		LOG(WARN) << "Incoming INVITE/MESSAGE with no call ID";
		return false;
	}

	// Don't free call_id_num.  It points into msg->call_id.
	const char * call_id_num = osip_call_id_get_number(msg->call_id);	

	// Get request username (IMSI) from invite. 
	// Form of the name is IMSI<digits>, and it should always be 19 char.
	const char * IMSI = msg->req_uri->username;
	LOG(INFO) << msg->sip_method << " to "<< IMSI;
	// IMSIs are 14 or 15 char + "IMSI" prefix
	unsigned namelen = strlen(IMSI);
	if ((namelen>19)||(namelen<18)) {
		LOG(WARN) << "INVITE/MESSAGE with malformed username \"" << IMSI << "\"";
		return false;
	}
	// Skip first 4 char "IMSI".
	IMSI+=4;
	// Make the mobile id we need for transaction and paging entries.
	L3MobileIdentity mobile_id(IMSI);

	// Check SIP map.  Repeated entry?  Page again.
	// Skip this for USSD.
	if (  mSIPMap.map().readNoBlock(call_id_num) != NULL) {
		TransactionEntry transaction;
		if (!gTransactionTable.find(mobile_id,transaction)) {
			// FIXME -- Send "call leg non-existent" response on SIP interface.
			LOG(WARN) << "repeated INVITE/MESSAGE with no transaction record";
			// Delete the bogus FIFO.
			mSIPMap.remove(call_id_num);
			return false;
		}
		LOG(INFO) << "repeated SIP INVITE/MESSAGE, repaging for transaction " << transaction; 
		gBTS.pager().addID(mobile_id,requiredChannel,transaction);	
//.........这里部分代码省略.........
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:101,代码来源:SIPInterface.cpp

示例7: MTCController

void Control::MTCController(TransactionEntry& transaction, TCHFACCHLogicalChannel* TCH)
{
	// Early Assignment Mobile Terminated Call. 
	// Transaction table in 04.08 7.3.3 figure 7.10a

	LOG(DEBUG) << "transaction: " << transaction;
	unsigned L3TI = transaction.TIValue();
	assert(transaction.TIFlag()==1);
	assert(TCH);

	// Get the alerting message.
	LOG(INFO) << "waiting for GSM Alerting and Connect";
	while (transaction.Q931State()!=TransactionEntry::Active) {
		if (updateGSMSignalling(transaction,TCH,1000)) return;
		if (transaction.Q931State()==TransactionEntry::Active) break;
		if (transaction.Q931State()==TransactionEntry::CallReceived) {
			LOG(DEBUG) << "sending SIP Ringing";
			transaction.SIP().MTCSendRinging();
		}
		// Check for SIP cancel, too.
		if (transaction.SIP().MTCWaitForACK()==SIP::Fail) {
			return abortCall(transaction,TCH,L3Cause(0x7F));
		}
	}
	gTransactionTable.update(transaction);

	LOG(INFO) << "allocating port and sending SIP OKAY";
	unsigned RTPPorts = allocateRTPPorts();
	SIPState state = transaction.SIP().MTCSendOK(RTPPorts,SIP::RTPGSM610);
	while (state!=SIP::Active) {
		LOG(DEBUG) << "wait for SIP OKAY-ACK";
		if (updateGSMSignalling(transaction,TCH)) return;
		state = transaction.SIP().MTCWaitForACK();
		LOG(DEBUG) << "SIP call state "<< state;
		switch (state) {
			case SIP::Active:
				break;
			case SIP::Fail:
				return abortCall(transaction,TCH,L3Cause(0x7F));
			case SIP::Timeout:
				state = transaction.SIP().MTCSendOK(RTPPorts,SIP::RTPGSM610);
				break;
			case SIP::Connecting:
				break;
			default:
				LOG(NOTICE) << "SIP unexpected state " << state;
				break;
		}
	}
	transaction.SIP().MTCInitRTP();
	gTransactionTable.update(transaction);

	// Send Connect Ack to make it all official.
	LOG(DEBUG) << "MTC send GSM Connect Acknowledge";
	TCH->send(L3ConnectAcknowledge(0,L3TI));

	// At this point, everything is ready to run for the call.
	// The radio link should have been cleared with the call.
	gTransactionTable.update(transaction);
	callManagementLoop(transaction,TCH);
}
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:61,代码来源:CallControl.cpp

示例8: MTCStarter

void Control::MTCStarter(TransactionEntry& transaction, LogicalChannel *LCH)
{
	assert(LCH);
	LOG(INFO) << "MTC on " << LCH->type() << " transaction: "<< transaction;

	// Determine if very early assigment already happened.
	bool veryEarly = false;
	if (LCH->type()==FACCHType) veryEarly=true;

	// Allocate a TCH for the call.
	TCHFACCHLogicalChannel *TCH = NULL;
	if (!veryEarly) {
		TCH = allocateTCH(dynamic_cast<SDCCHLogicalChannel*>(LCH));
		// It's OK to just return on failure; allocateTCH cleaned up already.
		// The orphaned transaction will be cleared automatically later.
		if (TCH==NULL) return;
	}


	// Get transaction identifiers.
	// This transaction was created by the SIPInterface when it
	// processed the INVITE that started this call.
	if (!veryEarly) TCH->transactionID(transaction.ID());	
	LCH->transactionID(transaction.ID());	
	unsigned L3TI = transaction.TIValue();
	assert(transaction.TIFlag()==1);

	// GSM 04.08 5.2.2.1
	LOG(INFO) << "sending GSM Setup to call " << transaction.calling();
	LCH->send(L3Setup(0,L3TI,L3CallingPartyBCDNumber(transaction.calling())));
	transaction.T303().set();
	transaction.Q931State(TransactionEntry::CallPresent);
	gTransactionTable.update(transaction);

	// Wait for Call Confirmed message.
	LOG(DEBUG) << "wait for GSM Call Confirmed";
	while (transaction.Q931State()!=TransactionEntry::MTCConfirmed) {
		if (transaction.SIP().MTCSendTrying()==SIP::Fail) {
			LOG(NOTICE) << "call failed on SIP side";
			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)) {
			LOG(INFO) << "Release from GSM side";
			LCH->send(RELEASE);
			return;
		}
		// Check for SIP cancel, too.
		if (transaction.SIP().MTCWaitForACK()==SIP::Fail) {
			LOG(NOTICE) << "call failed on SIP side";
			LCH->send(RELEASE);
			// Cause 0x10 is "normal clearing"
			return abortCall(transaction,LCH,L3Cause(0x10));
		}
	}

	// The transaction is moving to the MTCController.
	// Once this update happens, don't change the transaction object again in this function.
	gTransactionTable.update(transaction);
	LOG(DEBUG) << "transaction: " << transaction;
	if (veryEarly) {
		// For very early assignment, we need a mode change.
		static const L3ChannelMode mode(L3ChannelMode::SpeechV1);
		LCH->send(L3ChannelModeModify(LCH->channelDescription(),mode));
		L3Message* msg_ack = getMessage(LCH);
		const L3ChannelModeModifyAcknowledge *ack =
			dynamic_cast<L3ChannelModeModifyAcknowledge*>(msg_ack);
		if (!ack) {
			if (msg_ack) {
				LOG(WARN) << "Unexpected message " << *msg_ack;
				delete msg_ack;
			}
			throw UnexpectedMessage(transaction.ID());
		}
		// Cause 0x06 is "channel unacceptable"
		bool modeOK = (ack->mode()==mode);
		delete msg_ack;
		if (!modeOK) 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(transaction,dynamic_cast<SDCCHLogicalChannel*>(LCH),TCH);
	}
}
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:89,代码来源:CallControl.cpp

示例9: MOCController

/**
	Continue MOC process on the TCH.
	@param transaction The call state and SIP interface.
	@param TCH The traffic channel to be used.
*/
void Control::MOCController(TransactionEntry& transaction, TCHFACCHLogicalChannel* TCH)
{
	LOG(INFO) << "transaction: " << transaction;
	unsigned L3TI = transaction.TIValue();
	assert(transaction.TIFlag()==0);
	assert(TCH);


	// Look for RINGING or OK from the SIP side.
	// There's a T310 running on the phone now.
	// The phone will initiate clearing if it expires.
	while (transaction.Q931State()!=TransactionEntry::CallReceived) {

		if (updateGSMSignalling(transaction,TCH)) return;
		if (transaction.clearing()) return abortCall(transaction,TCH,L3Cause(0x7F));

		LOG(INFO) << "MOC A: wait for Ringing or OK";
		SIPState state = transaction.SIP().MOCWaitForOK();
		LOG(DEBUG) << "MOC A: SIP state="<<state;
		switch (state) {
			case SIP::Busy:
				LOG(INFO) << "MOC A: SIP:Busy, abort";
				return abortCall(transaction,TCH,L3Cause(0x11));
			case SIP::Fail:
				LOG(NOTICE) << "MOC A: SIP:Fail, abort";
				return abortCall(transaction,TCH,L3Cause(0x7F));
			case SIP::Ringing:
				LOG(INFO) << "MOC A: SIP:Ringing, send Alerting and move on";
				TCH->send(L3Alerting(1,L3TI));
				transaction.Q931State(TransactionEntry::CallReceived);
				break;
			case SIP::Active:
				LOG(DEBUG) << "MOC A: SIP:Active, move on";
				transaction.Q931State(TransactionEntry::CallReceived);
				break;
			case SIP::Proceeding:
				LOG(DEBUG) << "MOC A: SIP:Proceeding, send progress";
				TCH->send(L3Progress(1,L3TI));
				break;
			case SIP::Timeout:
				LOG(NOTICE) << "MOC A: SIP:Timeout, reinvite";
				state = transaction.SIP().MOCResendINVITE();
				break;
			default:
				LOG(NOTICE) << "MOC A: SIP unexpected state " << state;
				break;
		}
	}
	gTransactionTable.update(transaction);

	// There's a question here of what entity is generating the "patterns"
	// (ringing, busy signal, etc.) during call set-up.  For now, we're ignoring 
	// that question and hoping the phone will make its own ringing pattern.


	// Wait for the SIP session to start.
	// There's a timer on the phone that will initiate clearing if it expires.
	LOG(INFO) << "wait for SIP OKAY";
	SIPState state = transaction.SIP().state();
	while (state!=SIP::Active) {

		LOG(DEBUG) << "wait for SIP session start";
		state = transaction.SIP().MOCWaitForOK();
		LOG(DEBUG) << "SIP state "<< state;

		// check GSM state
		if (updateGSMSignalling(transaction,TCH)) return;
		if (transaction.clearing()) return abortCall(transaction,TCH,L3Cause(0x7F));

		// parse out SIP state
		switch (state) {
			case SIP::Busy:
				// Should this be possible at this point?
				LOG(INFO) << "MOC B: SIP:Busy, abort";
				return abortCall(transaction,TCH,L3Cause(0x11));
			case SIP::Fail:
				LOG(INFO) << "MOC B: SIP:Fail, abort";
				return abortCall(transaction,TCH,L3Cause(0x7F));
			case SIP::Proceeding:
				LOG(DEBUG) << "MOC B: SIP:Proceeding, NOT sending progress";
				//TCH->send(L3Progress(1,L3TI));
				break;
			// For these cases, do nothing.
			case SIP::Timeout:
				// FIXME We should abort if this happens too often.
				// For now, we are relying on the phone, which may have bugs of its own.
			case SIP::Active:
			default:
				break;
		}
	} 
	gTransactionTable.update(transaction);
	
	// Let the phone know the call is connected.
	LOG(INFO) << "sending Connect to handset";
//.........这里部分代码省略.........
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:101,代码来源:CallControl.cpp

示例10: callManagementDispatchGSM

/**
	Process a message received from the phone during a call.
	This function processes all deviations from the "call connected" state.
	For now, we handle call clearing and politely reject everything else.
	@param transaction The transaction record for this call.
	@param LCH The logical channel for the transaction.
	@param message A pointer to the receiver message.
	@return true If the call has been cleared and the channel released.
*/
bool callManagementDispatchGSM(TransactionEntry& transaction, LogicalChannel* LCH, const L3Message *message)
{
	LOG(DEBUG) << "from " << transaction.subscriber() << " message " << *message;

	// FIXME -- This dispatch section should be something more efficient with PD and MTI swtiches.

	// Actually check state before taking action.
	//if (transaction.SIP().state()==SIP::Cleared) return true;
	//if (transaction.Q931State()==TransactionEntry::NullState) return true;

	// Call connection steps.

	// Connect Acknowledge
	if (dynamic_cast<const L3ConnectAcknowledge*>(message)) {
		LOG(INFO) << "GSM Connect Acknowledge " << transaction.subscriber();
		transaction.resetTimers();
		transaction.Q931State(TransactionEntry::Active);
		gTransactionTable.update(transaction);
		return false;
	}

	// Connect
	// GSM 04.08 5.2.2.5 and 5.2.2.6
	if (dynamic_cast<const L3Connect*>(message)) {
		LOG(INFO) << "GSM Connect " << transaction.subscriber();
		transaction.resetTimers();
		transaction.Q931State(TransactionEntry::Active);
		gTransactionTable.update(transaction);
		return false;
	}

	// Call Confirmed
	// GSM 04.08 5.2.2.3.2
	// "Call Confirmed" is the GSM MTC counterpart to "Call Proceeding"
	if (dynamic_cast<const L3CallConfirmed*>(message)) {
		LOG(INFO) << "GSM Call Confirmed " << transaction.subscriber();
		transaction.T303().reset();
		transaction.T310().set();
		transaction.Q931State(TransactionEntry::MTCConfirmed);
		gTransactionTable.update(transaction);
		return false;
	}

	// Alerting
	// GSM 04.08 5.2.2.3.2
	if (dynamic_cast<const L3Alerting*>(message)) {
		LOG(INFO) << "GSM Alerting " << transaction.subscriber();
		transaction.T310().reset();
		transaction.T301().set();
		transaction.Q931State(TransactionEntry::CallReceived);
		gTransactionTable.update(transaction);
		return false;
	}

	// 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 (dynamic_cast<const L3Disconnect*>(message)) {
		LOG(INFO) << "GSM Disconnect " << transaction.subscriber();
		transaction.resetTimers();
		LCH->send(L3Release(1-transaction.TIFlag(),transaction.TIValue()));
		transaction.T308().set();
		transaction.Q931State(TransactionEntry::ReleaseRequest);
		transaction.SIP().MODSendBYE();
		gTransactionTable.update(transaction);
		return false;
	}

	// Release (2nd step of MTD)
	if (dynamic_cast<const L3Release*>(message)) {
		LOG(INFO) << "GSM Release " << transaction.subscriber();
		transaction.resetTimers();
		LCH->send(L3ReleaseComplete(1-transaction.TIFlag(),transaction.TIValue()));
		LCH->send(L3ChannelRelease());
		transaction.Q931State(TransactionEntry::NullState);
		transaction.SIP().MTDSendOK();
		gTransactionTable.update(transaction);
		return true;
	}

	// Release Complete (3nd step of MOD)
	// GSM 04.08 5.4.3.4
	if (dynamic_cast<const L3ReleaseComplete*>(message)) {
		LOG(INFO) << "GSM Release Complete " << transaction.subscriber();
		transaction.resetTimers();
		LCH->send(L3ChannelRelease());
		transaction.Q931State(TransactionEntry::NullState);
//.........这里部分代码省略.........
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:101,代码来源:CallControl.cpp

示例11: MTSMSController

void Control::MTSMSController(TransactionEntry& transaction, 
						LogicalChannel *LCH)
{
	assert(LCH);

	// HACK: At this point if the message starts with "RRLP" then we don't do SMS at all,
	// but instead to an RRLP transaction over the already allocated LogicalChannel.
	const char* m = transaction.message(); // NOTE - not very nice, my way of checking.
	if ((strlen(m) > 4) && (std::string("RRLP") == std::string(m, m+4))) {
		const char *transaction_hex = transaction.message() + 4;
		BitVector rrlp_position_request(strlen(transaction_hex)*4);
		rrlp_position_request.unhex(transaction_hex);
		LOG(INFO) << "MTSMS: Sending RRLP";
		// TODO - how to get mobID here?
		L3MobileIdentity mobID = L3MobileIdentity("000000000000000");
		RRLP::PositionResult pr = GSM::RRLP::doRRLPQuery(mobID, LCH, rrlp_position_request);
		if (pr.mValid) // in this case we only want to log the results which contain lat/lon
			logMSInfo(LCH, pr, mobID);
		LOG(INFO) << "MTSMS: Closing channel after RRLP";
		LCH->send(L3ChannelRelease());
		clearTransactionHistory(transaction);
		return;
	}

	// See GSM 04.11 Arrow Diagram A5 for the transaction
	// Step 1	Network->MS	CP-DATA containing RP-DATA
	// Step 2	MS->Network	CP-ACK
	// Step 3	MS->Network	CP-DATA containing RP-ACK
	// Step 4	Network->MS	CP-ACK

	// LAPDm operation, from GSM 04.11, Annex F:
	// """
	// Case B: Mobile terminating short message transfer, no parallel call:
	// The network side, i.e. the BSS will initiate SAPI3 establishment by a
	// SABM command on the SDCCH when the first CP-Data message is received
	// from the MSC. If no hand over occurs, the link will stay up until the
	// MSC has given the last CP-ack and invokes the clearing procedure. 
	// """

	LOG(INFO) << "MTSMS: transaction: "<< transaction;
	LCH->transactionID(transaction.ID());	
	SIPEngine& engine = transaction.SIP();

	// Update transaction state.
	transaction.Q931State(TransactionEntry::SMSDelivering);
	gTransactionTable.update(transaction);

	try {
		bool success = deliverSMSToMS(transaction.calling().digits(),transaction.message(),random()%7,LCH);

		// Close the Dm channel.
		LOG(INFO) << "MTSMS: closing";
		LCH->send(L3ChannelRelease());

		// Ack in SIP domain and update transaction state.
		if (success) {
			engine.MTSMSSendOK();
			clearTransactionHistory(transaction);
		}
	}
	catch (UnexpectedMessage) {
		// TODO -- MUST SEND PERMANENT ERROR HERE!!!!!!!!!
		engine.MTSMSSendOK();
		LCH->send(L3ChannelRelease());
		clearTransactionHistory(transaction);
	}
	catch (UnsupportedMessage) {
		// TODO -- MUST SEND PERMANENT ERROR HERE!!!!!!!!!
		engine.MTSMSSendOK();
		LCH->send(L3ChannelRelease());
		clearTransactionHistory(transaction);
	}
}
开发者ID:0x7678,项目名称:openbts-uhd,代码行数:73,代码来源:SMSControl.cpp


注:本文中的TransactionEntry::SIP方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。