本文整理汇总了C++中SipMessage::getDateField方法的典型用法代码示例。如果您正苦于以下问题:C++ SipMessage::getDateField方法的具体用法?C++ SipMessage::getDateField怎么用?C++ SipMessage::getDateField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SipMessage
的用法示例。
在下文中一共展示了SipMessage::getDateField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: preprocessMessage
// Do preliminary processing of message to log it,
// clean up its data, and extract any needed source address.
void SipClient::preprocessMessage(SipMessage& msg,
const UtlString& msgText,
int msgLength)
{
// Canonicalize short field names.
msg.replaceShortFieldNames();
// Get the send address.
UtlString fromIpAddress;
int fromPort;
msg.getSendAddress(&fromIpAddress, &fromPort);
// Log the message.
// Only bother processing if the logs are enabled
if ( mpSipUserAgent->isMessageLoggingEnabled()
|| Os::Logger::instance().willLog(FAC_SIP_INCOMING, PRI_INFO)
)
{
UtlString logMessage;
logMessage.append("Read SIP message:\n");
logMessage.append("----Local Host:");
logMessage.append(mLocalHostAddress);
logMessage.append("---- Port: ");
logMessage.appendNumber(
portIsValid(mLocalHostPort) ? mLocalHostPort : defaultPort());
logMessage.append("----\n");
logMessage.append("----Remote Host:");
logMessage.append(fromIpAddress);
logMessage.append("---- Port: ");
logMessage.appendNumber(
portIsValid(fromPort) ? fromPort : defaultPort());
logMessage.append("----\n");
logMessage.append(msgText.data(), msgLength);
UtlString messageString;
logMessage.append(messageString);
logMessage.append("====================END====================\n");
// Send the message to the SipUserAgent for its internal log.
mpSipUserAgent->logMessage(logMessage.data(), logMessage.length());
// Write the message to the syslog.
Os::Logger::instance().log(FAC_SIP_INCOMING, PRI_INFO, "%s", logMessage.data());
}
// Set the date field if not present
long epochDate;
if (!msg.getDateField(&epochDate))
{
msg.setDateField();
}
// Set the protocol and time.
msg.setSendProtocol(mSocketType);
msg.setTransportTime(touchedTime);
// Keep track of where this message came from
msg.setSendAddress(fromIpAddress.data(), fromPort);
// Keep track of the interface on which this message was
// received.
msg.setInterfaceIpPort(mClientSocket->getLocalIp(), mClientSocket->getLocalHostPort());
if (mReceivedAddress.isNull())
{
mReceivedAddress = fromIpAddress;
mRemoteReceivedPort = fromPort;
}
// If this is a request...
if (!msg.isResponse())
{
UtlString lastAddress;
int lastPort;
UtlString lastProtocol;
int receivedPort;
UtlBoolean receivedSet;
UtlBoolean maddrSet;
UtlBoolean receivedPortSet;
// Fill in 'received' and 'rport' in top Via if needed.
msg.setReceivedViaParams(fromIpAddress, fromPort);
// Derive information about the other end of the connection
// from the Via that the other end provided.
// Get the addresses from the topmost Via.
msg.getTopVia(&lastAddress, &lastPort, &lastProtocol,
&receivedPort, &receivedSet, &maddrSet,
&receivedPortSet);
// :QUERY: Should this test be mClientSocket->isConnected()?
if ( ( mSocketType == OsSocket::TCP
|| mSocketType == OsSocket::SSL_SOCKET
)
&& !receivedPortSet
)
{
// we can use this socket as if it were
//.........这里部分代码省略.........