本文整理汇总了C++中TransactionEntry::MOCSendINVITE方法的典型用法代码示例。如果您正苦于以下问题:C++ TransactionEntry::MOCSendINVITE方法的具体用法?C++ TransactionEntry::MOCSendINVITE怎么用?C++ TransactionEntry::MOCSendINVITE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransactionEntry
的用法示例。
在下文中一共展示了TransactionEntry::MOCSendINVITE方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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.
//.........这里部分代码省略.........