本文整理汇总了C++中SipMessage::getBody方法的典型用法代码示例。如果您正苦于以下问题:C++ SipMessage::getBody方法的具体用法?C++ SipMessage::getBody怎么用?C++ SipMessage::getBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SipMessage
的用法示例。
在下文中一共展示了SipMessage::getBody方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: standardVersionCallback
// Static callback routine used to find and replace variable string values in
// subscription content.
// For example the NOTIFY message in the SIP stack contains "&version;" rather
// than an actual version number [like "22"].
// The content provided by publish() provides the "context
// independent" part of the content, and the SIP stack keeps knowledge
// of the version number sequence for each subscription. This
// callback combines these sources of information.
UtlBoolean SipSubscribeServer::standardVersionCallback(SipMessage& notifyRequest,
int version)
{
// Search and replace the version number in the Notify.
UtlBoolean result = FALSE;
if (notifyRequest.getBody() != NULL)
{
UtlString msgBytes;
ssize_t msgLength;
// Extract the NOTIFY body as a UtlString.
notifyRequest.getBody()->getBytes(&msgBytes, &msgLength);
const char* contentType = notifyRequest.getBody()->getContentType();
// Look for the placeholder for the version number, "&version;".
ssize_t msgIndex = msgBytes.index(VERSION_PLACEHOLDER);
if (msgIndex != UTL_NOT_FOUND)
{
char buffer[20];
sprintf(buffer, "%d", version);
msgBytes.replace(msgIndex, sizeof (VERSION_PLACEHOLDER) - 1, buffer);
HttpBody* tempBody =
new HttpBody(msgBytes.data(), msgBytes.length(), contentType);
// Write the new message contents (this deletes the old body)
notifyRequest.setBody(tempBody);
result = TRUE;
}
}
return result;
}