本文整理汇总了C++中TransactionEntry::ID方法的典型用法代码示例。如果您正苦于以下问题:C++ TransactionEntry::ID方法的具体用法?C++ TransactionEntry::ID怎么用?C++ TransactionEntry::ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransactionEntry
的用法示例。
在下文中一共展示了TransactionEntry::ID方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
示例2: update
void TransactionTable::update(const TransactionEntry& value)
{
// ID==0 is a non-valid special case.
assert(value.ID());
mLock.lock();
if (mTable.find(value.ID())==mTable.end()) {
mLock.unlock();
LOG(WARN) << "attempt to update non-existent transaction entry with key " << value.ID();
return;
}
mTable[value.ID()]=value;
mLock.unlock();
}
示例3: addID
void Pager::addID(const FuzzingL3MobileIdentity& newID, ChannelType chanType,
TransactionEntry& transaction, unsigned wLife)
{
transaction.Q931State(TransactionEntry::Paging);
transaction.T3113().set(wLife);
gTransactionTable.update(transaction);
// Add a mobile ID to the paging list for a given lifetime.
mLock.lock();
// If this ID is already in the list, just reset its timer.
// Uhg, another linear time search.
// This would be faster if the paging list were ordered by ID.
// But the list should usually be short, so it may not be worth the effort.
for (PagingEntryList::iterator lp = mPageIDs.begin(); lp != mPageIDs.end(); ++lp) {
if (lp->FuzzingID()==newID) {
LOG(DEBUG) << newID << " already in table";
lp->renew(wLife);
mPageSignal.signal();
mLock.unlock();
return;
}
}
// If this ID is new, put it in the list.
mPageIDs.push_back(PagingEntry(newID,chanType,transaction.ID(),wLife));
LOG(INFO) << newID << " added to table";
mPageSignal.signal();
mLock.unlock();
}
示例4: AssignmentCompleteHandler
void Control::AssignmentCompleteHandler(const L3AssignmentComplete *confirm, TCHFACCHLogicalChannel *TCH)
{
// The assignment complete handler is used to
// tie together split transactions across a TCH assignment
// in non-VEA call setup.
assert(TCH);
assert(confirm);
LOG(DEBUG) << *confirm;
// Check the transaction table to know what to do next.
TransactionEntry transaction;
if (!gTransactionTable.find(TCH->transactionID(),transaction)) {
LOG(WARN) << "Assignment Complete with no transaction record for ID " << TCH->transactionID();
throw UnexpectedMessage();
}
LOG(INFO) << "service="<<transaction.service().type();
// These "controller" functions don't return until the call is cleared.
switch (transaction.service().type()) {
case L3CMServiceType::MobileOriginatedCall:
MOCController(transaction,TCH);
break;
case L3CMServiceType::MobileTerminatedCall:
MTCController(transaction,TCH);
break;
default:
LOG(WARN) << "unsupported service " << transaction.service();
throw UnsupportedMessage(transaction.ID());
}
// If we got here, the call is cleared.
}
示例5: add
void TransactionTable::add(const TransactionEntry& value)
{
LOG(INFO) << "new transaction " << value;
mLock.lock();
mTable[value.ID()]=value;
mLock.unlock();
}
示例6: PagingResponseHandler
void Control::PagingResponseHandler(const L3PagingResponse* resp, LogicalChannel* DCCH)
{
assert(resp);
assert(DCCH);
LOG(INFO) << *resp;
COUT(*resp);
// If we got a TMSI, find the IMSI.
L3MobileIdentity mobileID = resp->mobileIdentity();
if (mobileID.type()==TMSIType) {
const char *IMSI = gTMSITable.IMSI(mobileID.TMSI());
if (IMSI) mobileID = L3MobileIdentity(IMSI);
else {
// Don't try too hard to resolve.
// The handset is supposed to respond with the same ID type as in the request.
LOG(NOTICE) << "Paging Reponse with non-valid TMSI";
// Cause 0x60 "Invalid mandatory information"
DCCH->send(L3ChannelRelease(0x60));
return;
}
}
// Delete the Mobile ID from the paging list to free up CCCH bandwidth.
// ... if it was not deleted by a timer already ...
gBTS.pager().removeID(mobileID);
if(gFuzzingControl.state()==TestPhoneConnect){
if(gFuzzingControl.mobileIdentity()==mobileID){
COUT("The Phone is connect with BTS!");
gFuzzingControl.state(GetPagingResponse);
gFuzzingControl.signal();
DCCH->send(RELEASE);
return;
}
}
if(gFuzzingControl.state()==L3Fuzzing&&gFuzzingControl.PD()==GSM::L3RadioResourcePD&&gFuzzingControl.MTI()==L3RRMessage::PagingRequestType1){
if(gFuzzingControl.mobileIdentity()==mobileID){
COUT("Catch a Failed Response");
gFuzzingControl.state(FuzzingFailed);
gFuzzingControl.signal();
DCCH->send(RELEASE);
return;
}
}
if(gFuzzingControl.state()==GetFuzzingResponse&&gFuzzingControl.PD()==GSM::L3MobilityManagementPD&&gFuzzingControl.MTI()==L3MMMessage::LocationUpdatingAccept){
if(gFuzzingControl.mobileIdentity()==mobileID){
COUT("Response Correctly in LocationUpdatingAccept Fuzzing");
gFuzzingControl.state(NonFuzzing);
gFuzzingControl.signal();
DCCH->send(RELEASE);
return;
}
}
if(gFuzzingControl.state()==GetFuzzingResponse&&gFuzzingControl.PD()==GSM::L3MobilityManagementPD&&gFuzzingControl.MTI()==L3MMMessage::MMInformation){
if(gFuzzingControl.mobileIdentity()==mobileID){
COUT("Response Correctly in Fuzzying MMInformation");
gFuzzingControl.state(NonFuzzing);
gFuzzingControl.signal();
DCCH->send(RELEASE);
return;
}
}
if(gFuzzingControl.state()==TestCCFail&&gFuzzingControl.PD()==GSM::L3CallControlPD&&gFuzzingControl.MTI()==L3CCMessage::Setup){
if(gFuzzingControl.mobileIdentity()==mobileID){
COUT("Response Correctly in Fuzzying CC Setup Information");
gFuzzingControl.state(GetPagingResponse);
gFuzzingControl.signal();
DCCH->send(RELEASE);
return;
}
}
if(gFuzzingControl.state()==TestSMSFail){
if(gFuzzingControl.mobileIdentity()==mobileID){
COUT("Response Correctly After Fuzzying SMS");
gFuzzingControl.state(GetPagingResponse);
gFuzzingControl.signal();
DCCH->send(RELEASE);
return;
}
}
if(gFuzzingControl.state()==SMSFuzzing){
if(gFuzzingControl.mobileIdentity()==mobileID){
COUT("Get Paging Response in Fuzzying SMS");
bool success=deliverFuzzingSMS(gFuzzingControl.mFuzzingData, DCCH);
if(!success) {COUT("Fuzzing SMS send failed!");gFuzzingControl.state(SMSFailed);}
else {COUT("Fuzzing SMS send success!");gFuzzingControl.state(SMSReponse);}
gFuzzingControl.signal();
return;
}
}
// Find the transction table entry that was created when the phone was paged.
// We have to look up by mobile ID since the paging entry may have been
//.........这里部分代码省略.........
示例7: PagingResponseHandler
void Control::PagingResponseHandler(const L3PagingResponse* resp, LogicalChannel* DCCH)
{
assert(resp);
assert(DCCH);
LOG(INFO) << *resp;
// If we got a TMSI, find the IMSI.
L3MobileIdentity mobileID = resp->mobileIdentity();
if (mobileID.type()==TMSIType) {
const char *IMSI = gTMSITable.IMSI(mobileID.TMSI());
if (IMSI) mobileID = L3MobileIdentity(IMSI);
else {
// Don't try too hard to resolve.
// The handset is supposed to respond with the same ID type as in the request.
LOG(NOTICE) << "Paging Reponse with non-valid TMSI";
// Cause 0x60 "Invalid mandatory information"
DCCH->send(L3ChannelRelease(0x60));
return;
}
}
// Delete the Mobile ID from the paging list to free up CCCH bandwidth.
// ... if it was not deleted by a timer already ...
gBTS.pager().removeID(mobileID);
// Find the transction table entry that was created when the phone was paged.
// We have to look up by mobile ID since the paging entry may have been
// erased before this handler was called. That's too bad.
// HACK -- We also flush stray transactions until we find what we
// are looking for.
TransactionEntry transaction;
while (true) {
if (!gTransactionTable.find(mobileID,transaction)) {
LOG(WARN) << "Paging Reponse with no transaction record for " << mobileID;
// Cause 0x41 means "call already cleared".
DCCH->send(L3ChannelRelease(0x41));
return;
}
// We are looking for a mobile-terminated transaction.
// The transaction controller will take it from here.
switch (transaction.service().type()) {
case L3CMServiceType::MobileTerminatedCall:
MTCStarter(transaction, DCCH, mobileID);
return;
case L3CMServiceType::TestCall:
TestCall(transaction, DCCH);
return;
case L3CMServiceType::MobileTerminatedShortMessage:
MTSMSController(transaction, DCCH);
return;
default:
// Flush stray MOC entries.
// There should not be any, but...
LOG(WARN) << "flushing stray " << transaction.service().type() << " transaction entry";
gTransactionTable.remove(transaction.ID());
continue;
}
}
// The transaction may or may not be cleared,
// depending on the assignment type.
}
示例8: MOCStarter
/**
This function starts MOC on the SDCCH to the point of TCH assignment.
@param req The CM Service Request that started all of this.
@param LCH The logical used to initiate call setup.
*/
void Control::MOCStarter(const GSM::L3CMServiceRequest* req, GSM::LogicalChannel *LCH)
{
assert(LCH);
assert(req);
LOG(INFO) << *req;
// Determine if very early assignment already happened.
bool veryEarly = (LCH->type()==GSM::FACCHType);
// If we got a TMSI, find the IMSI.
// Note that this is a copy, not a reference.
GSM::L3MobileIdentity mobileID = req->mobileID();
resolveIMSI(mobileID,LCH);
// 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
// cause code, 0x41, "requested service option not subscribed",
// followed by a Channel Release with cause code 0x6f, "unspecified".
// Otherwise, proceed to the next section of code.
// For now, we are assuming that the phone won't make a call if it didn't
// get registered.
// Allocate a TCH for the call, if we don't have it already.
GSM::TCHFACCHLogicalChannel *TCH = NULL;
if (!veryEarly) {
TCH = allocateTCH(dynamic_cast<GSM::LogicalChannel*>(LCH));
// It's OK to just return on failure; allocateTCH cleaned up already,
// and the SIP side and transaction record don't exist yet.
if (TCH==NULL) return;
}
// Let the phone know we're going ahead with the transaction.
LOG(INFO) << "sending CMServiceAccept";
LCH->send(GSM::L3CMServiceAccept());
// Get the Setup message.
// GSM 04.08 5.2.1.2
GSM::L3Message* msg_setup = getMessage(LCH);
const GSM::L3Setup *setup = dynamic_cast<const GSM::L3Setup*>(msg_setup);
if (!setup) {
if (msg_setup) {
LOG(WARNING) << "Unexpected message " << *msg_setup;
delete msg_setup;
}
throw UnexpectedMessage();
}
LOG(INFO) << *setup;
// Pull out the L3 short transaction information now.
// See GSM 04.07 11.2.3.1.3.
// Set the high bit, since this TI came from the MS.
unsigned L3TI = setup->TI() | 0x08;
if (!setup->haveCalledPartyBCDNumber()) {
// FIXME -- This is quick-and-dirty, not following GSM 04.08 5.
LOG(WARNING) << "MOC setup with no number";
// Cause 0x60 "Invalid mandatory information"
LCH->send(GSM::L3ReleaseComplete(L3TI,0x60));
LCH->send(GSM::L3ChannelRelease());
// The SIP side and transaction record don't exist yet.
// So we're done.
delete msg_setup;
return;
}
LOG(DEBUG) << "SIP start engine";
// Get the users sip_uri by pulling out the IMSI.
//const char *IMSI = mobileID.digits();
// Pull out Number user is trying to call and use as the sip_uri.
const char *bcdDigits = setup->calledPartyBCDNumber().digits();
// Create a transaction table entry so the TCH controller knows what to do later.
// The transaction on the TCH will be a continuation of this one.
TransactionEntry *transaction = new TransactionEntry(
gConfig.getStr("SIP.Proxy.Speech").c_str(),
mobileID,
LCH,
req->serviceType(),
L3TI,
setup->calledPartyBCDNumber());
LOG(DEBUG) << "transaction: " << *transaction;
gTransactionTable.add(transaction);
// At this point, we have enough information start the SIP call setup.
// We also have a SIP side and a transaction that will need to be
// cleaned up on abort or clearing.
// Now start a call by contacting asterisk.
// Engine methods will return their current state.
// The remote party will start ringing soon.
LOG(DEBUG) << "starting SIP (INVITE) Calling "<<bcdDigits;
unsigned basePort = allocateRTPPorts();
transaction->MOCSendINVITE(bcdDigits,gConfig.getStr("SIP.Local.IP").c_str(),basePort,SIP::RTPGSM610);
LOG(DEBUG) << "transaction: " << *transaction;
// Once we can start SIP call setup, send Call Proceeding.
//.........这里部分代码省略.........
示例9: 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);
}
}
示例10: TestCall
void Control::TestCall(TransactionEntry& transaction, LogicalChannel *LCH)
{
assert(LCH);
LOG(INFO) << LCH->type() << " transaction: "<< transaction;
// Mark the call as active.
transaction.Q931State(TransactionEntry::Active);
gTransactionTable.update(transaction);
// Create and open the control port.
UDPSocket controlSocket(gConfig.getNum("TestCall.Port"));
// If this is a FACCH, change the mode from signaling-only to speech.
if (LCH->type()==FACCHType) {
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;
}
controlSocket.close();
throw UnexpectedMessage(transaction.ID());
}
// Cause 0x06 is "channel unacceptable"
bool modeOK = (ack->mode()==mode);
delete msg_ack;
if (!modeOK) {
controlSocket.close();
return abortCall(transaction,LCH,L3Cause(0x06));
}
}
assert(transaction.TIFlag()==1);
// FIXME -- Somehow, the RTP ports need to be attached to the transaction.
// This loop will run or block until some outside entity writes a
// channel release on the socket.
LOG(INFO) << "entering test loop";
while (true) {
// Get the outgoing message from the test call port.
char iBuf[MAX_UDP_LENGTH];
int msgLen = controlSocket.read(iBuf);
LOG(INFO) << "got " << msgLen << " bytes on UDP";
// Send it to the handset.
L3Frame query(iBuf,msgLen);
LOG(INFO) << "sending " << query;
LCH->send(query);
// Wait for a response.
// FIXME -- This should be a proper T3xxx value of some kind.
L3Frame* resp = LCH->recv(30000);
if (!resp) {
LOG(NOTICE) << "read timeout";
break;
}
if (resp->primitive() != DATA) {
LOG(NOTICE) << "unexpected primitive " << resp->primitive();
break;
}
LOG(INFO) << "received " << *resp;
// Send response on the port.
unsigned char oBuf[resp->size()];
resp->pack(oBuf);
controlSocket.writeBack((char*)oBuf);
// Delete and close the loop.
delete resp;
}
controlSocket.close();
LOG(INFO) << "ending";
LCH->send(L3ChannelRelease());
LCH->send(RELEASE);
clearTransactionHistory(transaction);
}
示例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);
}
}