本文整理汇总了C++中TransactionEntry::messageType方法的典型用法代码示例。如果您正苦于以下问题:C++ TransactionEntry::messageType方法的具体用法?C++ TransactionEntry::messageType怎么用?C++ TransactionEntry::messageType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransactionEntry
的用法示例。
在下文中一共展示了TransactionEntry::messageType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkInvite
//.........这里部分代码省略.........
// Delete the bogus FIFO.
mSIPMap.remove(callIDNum);
return false;
}
// There is transaction already. Send trying, if appropriate.
if (serviceType!=L3CMServiceType::MobileTerminatedShortMessage) transaction->MTCSendTrying();
// And if no channel is established yet, page again.
if (!chan) {
LOG(INFO) << "repeated SIP INVITE/MESSAGE, repaging for transaction " << *transaction;
gBTS.pager().addID(mobileID,requiredChannel,*transaction);
}
return false;
}
// So we will need a new channel.
// Check gBTS for channel availability.
if (!chan && !channelAvailable) {
// FIXME -- Send 503 "Service Unavailable" response on SIP interface.
// Don't forget the retry-after header.
LOG(NOTICE) << "MTC CONGESTION, no " << requiredChannel << " availble for assignment";
return false;
}
if (chan) { LOG(INFO) << "using existing channel " << chan->descriptiveString(); }
else { LOG(INFO) << "set up MTC paging for channel=" << requiredChannel; }
// Add an entry to the SIP Map to route inbound SIP messages.
addCall(callIDNum);
LOG(DEBUG) << "callIDNum " << callIDNum << " IMSI " << IMSI;
// Get the caller ID if it's available.
const char *callerID = "";
const char *callerHost = "";
osip_from_t *from = osip_message_get_from(msg);
if (from) {
osip_uri_t* url = osip_contact_get_url(from);
if (url) {
if (url->username) callerID = url->username;
if (url->host) callerHost = url->host;
}
} else {
LOG(NOTICE) << "INVITE with no From: username for " << mobileID;
}
LOG(DEBUG) << "callerID " << callerID << "@" << callerHost;
// Build the transaction table entry.
// This constructor sets TI automatically for an MT transaction.
TransactionEntry *transaction = new TransactionEntry(proxy.c_str(),mobileID,chan,serviceType,callerID);
// FIXME -- These parameters should be arguments to the constructor above.
transaction->SIPUser(callIDNum,IMSI,callerID,callerHost);
transaction->saveINVITE(msg,false);
// Tell the sender we are trying.
if (serviceType!=L3CMServiceType::MobileTerminatedShortMessage) transaction->MTCSendTrying();
// SMS? Get the text message body to deliver.
if (serviceType == L3CMServiceType::MobileTerminatedShortMessage) {
osip_body_t *body;
osip_content_type_t *contentType;
osip_message_get_body(msg,0,&body);
contentType = osip_message_get_content_type(msg);
const char *text = NULL;
char *type = NULL;
if (body) text = body->body;
if (text) transaction->message(text, body->length);
else LOG(NOTICE) << "MTSMS incoming MESSAGE method with no message body for " << mobileID;
/* Ok, so osip does some funny stuff here. The MIME type is split into type and subType.
Basically, text/plain becomes type=text, subType=plain. We need to put those together...
*/
if (contentType) {
type = (char *)malloc(strlen(contentType->type)+strlen(contentType->subtype)+2);
}
if (type) {
strcpy(type,contentType->type);
strcat(type,"/");
strcat(type,contentType->subtype);
transaction->messageType(type);
free(type);
}
else LOG(NOTICE) << "MTSMS incoming MESSAGE method with no content type (or memory error) for " << mobileID;
}
LOG(INFO) << "MTC MTSMS make transaction and add to transaction table: "<< *transaction;
gTransactionTable.add(transaction);
// If there's an existing channel, skip the paging step.
if (!chan) {
// Add to paging list.
LOG(DEBUG) << "MTC MTSMS new SIP invite, initial paging for mobile ID " << mobileID;
gBTS.pager().addID(mobileID,requiredChannel,*transaction);
} else {
// Add a transaction to an existing channel.
chan->addTransaction(transaction);
// FIXME -- We need to write something into the channel to trigger the new transaction.
// We need to send a message into the chan's dispatch loop,
// becasue we can't block this thread to run the transaction.
}
return true;
}