本文整理汇总了C++中sipmessage::Ptr::getProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::getProperty方法的具体用法?C++ Ptr::getProperty怎么用?C++ Ptr::getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sipmessage::Ptr
的用法示例。
在下文中一共展示了Ptr::getProperty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSendMessage
bool SIPNict::onSendMessage(SIPMessage::Ptr pMsg)
{
SIPTransaction::Ptr pTransaction = static_cast<SIPTransaction::WeakPtr*>(_owner)->lock();
if (!pTransaction)
return false;
if (pTransaction->getState() == SIPTransaction::TRN_STATE_IDLE)
{
startTimerMaxLifetime(300000); /// five minutes
_pRequest = pMsg;
pTransaction->setState(TRYING);
std::string sTimeout;
if (pMsg->getProperty(OSS::PropertyMap::PROP_TransactionTimeout, sTimeout) && !sTimeout.empty())
{
_timerEValue = OSS::string_to_number<unsigned long>(sTimeout.c_str()) / 64;
}
else
{
_timerEValue = _timerProps.timerE();
}
if (!pTransaction->transport()->isReliableTransport())
{
startTimerE(_timerEValue);
startTimerF(_timerEValue*64);
}
else
{
startTimerF(RELIABLE_TIMER_F_VALUE);
}
return true;
}
return false;
}
示例2: sendRequestDirect
void OSSSIP::sendRequestDirect(const SIPMessage::Ptr& pRequest,
const OSS::IPAddress& localAddress,
const OSS::IPAddress& remoteAddress)
{
std::string transport;
if (SIPVia::msgGetTopViaTransport(pRequest.get(), transport))
{
std::string transportId;
pRequest->getProperty("transport-id", transportId);
if (transportId.empty())
transportId="0";
OSS_LOG_DEBUG("Sending request directly protocol=" << transport << " id=" << transportId);
SIPTransportSession::Ptr client = _fsmDispatch.transport().createClientTransport(localAddress, remoteAddress, transport, transportId);
if (client)
client->writeMessage(pRequest, remoteAddress.toString(), OSS::string_from_number(remoteAddress.getPort()));
else
OSS_LOG_ERROR("OSSSIP::sendRequestDirect failed - Unable to create client transport");
}
else
{
OSS_LOG_ERROR("OSSSIP::sendRequestDirect failed - Unable to determine transport protocol.")
}
}
示例3: sendRequest
void SIPTransaction::sendRequest(
const SIPMessage::Ptr& pRequest,
const OSS::IPAddress& localAddress,
const OSS::IPAddress& remoteAddress,
SIPTransaction::Callback callback)
{
OSS::mutex_lock lock(_mutex);
if (!pRequest->isRequest())
{
throw OSS::SIP::SIPException("Sending a REQUEST using sendRequest() is illegal!");
}
if (!_pInitialRequest)
{
_pInitialRequest = pRequest;
if (_logId.empty())
_logId = pRequest->createContextId(true);
if (SIPXOR::isEnabled() && !_isXOREncrypted)
{
std::string isXOR;
_isXOREncrypted = pRequest->getProperty("xor", isXOR) && isXOR == "1";
}
}
if (!_responseTU)
_responseTU = callback;
if (_localAddress.getPort() == 0)
_localAddress = localAddress;
if (_remoteAddress.getPort() == 0)
_remoteAddress = remoteAddress;
if (!_transport)
{
if (!_transportService)
throw OSS::SIP::SIPException("Transport Not Ready!");
std::string transport;
if (pRequest->getProperty("target-transport", transport))
{
std::string transportId;
pRequest->getProperty("transport-id", transportId);
_transport = _transportService->createClientTransport(localAddress, remoteAddress, transport, transportId);
}else if (SIPVia::msgGetTopViaTransport(pRequest.get(), transport))
{
_transport = _transportService->createClientTransport(localAddress, remoteAddress, transport);
}
if (!_transport)
throw OSS::SIP::SIPException("Unable to create transport!");
}
if (_transport->isReliableTransport())
{
writeMessage(pRequest);
}
else
{
writeMessage(pRequest, remoteAddress);
}
}
示例4: onReceivedMessage
void SIPTransaction::onReceivedMessage(SIPMessage::Ptr pMsg, SIPTransportSession::Ptr pTransport)
{
OSS::mutex_lock lock(_mutex);
bool isAck = pMsg->isRequest("ACK");
if (pMsg->isRequest() && !_pInitialRequest && !isAck)
_pInitialRequest = pMsg;
if (_logId.empty())
_logId = pMsg->createContextId(true);
if (!_transport)
_transport = pTransport;
if (!_localAddress.isValid())
_localAddress = pTransport->getLocalAddress();
if (!_remoteAddress.isValid())
_remoteAddress = pTransport->getRemoteAddress();
if (SIPXOR::isEnabled() && !_isXOREncrypted)
{
std::string isXOR;
_isXOREncrypted = pMsg->getProperty("xor", isXOR) && isXOR == "1";
}
if (isParent())
{
std::ostringstream logMsg;
logMsg << _logId << "<<< " << pMsg->startLine()
<< " LEN: " << pTransport->getLastReadCount()
<< " SRC: " << _remoteAddress.toIpPortString()
<< " DST: " << _localAddress.toIpPortString()
<< " EXT: " << "[" << pTransport->getExternalAddress() << "]"
<< " FURI: " << pMsg->hdrGet("from")
<< " ENC: " << _isXOREncrypted
<< " PROT: " << pTransport->getTransportScheme();
OSS::log_information(logMsg.str());
if (OSS::log_get_level() >= OSS::PRIO_DEBUG)
OSS::log_debug(pMsg->createLoggerData());
}
//
// If this is a request and is not an ACK, then the parent IST fsm must always handle it
//
if (isParent() && pMsg->isRequest() && !isAck)
{
_fsm->onReceivedMessage(pMsg, pTransport);
}
else if (!pMsg->isRequest() || isAck)
{
//
// This is a response or an ACK and the transaction could have branched out
//
if (!isParent())
{
_fsm->onReceivedMessage(pMsg, pTransport);
}
else
{
SIPTransaction::Ptr pBranch = findBranch(pMsg);
if (pBranch)
pBranch->onReceivedMessage(pMsg, pTransport);
else
_fsm->onReceivedMessage(pMsg, pTransport);
}
}
}