当前位置: 首页>>代码示例>>C++>>正文


C++ Ptr::isRequest方法代码示例

本文整理汇总了C++中sipmessage::Ptr::isRequest方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::isRequest方法的具体用法?C++ Ptr::isRequest怎么用?C++ Ptr::isRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sipmessage::Ptr的用法示例。


在下文中一共展示了Ptr::isRequest方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createClientTransaction

SIPTransaction::Ptr SIPFSMDispatch::createClientTransaction(const SIPMessage::Ptr& pRequest)
{
  if (!pRequest->isRequest())
    throw OSS::SIP::SIPException("Sending a response using sendRequest() method is illegal");

  std::string id;
  if (!pRequest->getTransactionId(id))
    throw OSS::SIP::SIPException("Unable to determine transaction identifier");

  SIPTransaction::Ptr trn;
  SIPTransportSession::Ptr nullTransport;
  bool isAck = false;
  if (OSS::string_caseless_starts_with(pRequest->startLine(), "invite"))
  {
    //
    // This is an ICT
    //
    trn = _ict.findTransaction(pRequest, nullTransport);
  }
  else
  {
    //
    // This is an NICT
    //
    isAck = pRequest->isRequest(OSS::SIP::REQ_ACK);
    if (!isAck)
    {
      trn = _nict.findTransaction(pRequest, nullTransport);
    }
  }
  
  return trn;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: if

static SIPB2BHandler::MessageType getMessageType(const SIPMessage::Ptr& pRequest)
{
  std::string cseq = pRequest->hdrGet("cseq");
  if (cseq.empty())
    return SIPB2BHandler::TYPE_INVALID;
  OSS::string_to_upper(cseq);

  if (OSS::string_ends_with(cseq, "INVITE"))
    return SIPB2BHandler::TYPE_INVITE;
  else if (OSS::string_ends_with(cseq, "REGISTER"))
    return SIPB2BHandler::TYPE_REGISTER;
  else if (OSS::string_ends_with(cseq, "BYE"))
    return SIPB2BHandler::TYPE_BYE;
  else if (OSS::string_ends_with(cseq, "CANCEL"))
    return SIPB2BHandler::TYPE_CANCEL;
  else if (OSS::string_ends_with(cseq, "EXEC"))
    return SIPB2BHandler::TYPE_EXEC;
  else if (OSS::string_ends_with(cseq, "INFO"))
    return SIPB2BHandler::TYPE_INFO;
  else if (OSS::string_ends_with(cseq, "OPTIONS"))
    return SIPB2BHandler::TYPE_OPTIONS;
  else if (OSS::string_ends_with(cseq, "PRACK"))
    return SIPB2BHandler::TYPE_PRACK;
  else if (OSS::string_ends_with(cseq, "PUBLISH"))
    return SIPB2BHandler::TYPE_PUBLISH;
  else if (OSS::string_ends_with(cseq, "SUBSCRIBE"))
    return SIPB2BHandler::TYPE_SUBSCRIBE;
  else if (OSS::string_ends_with(cseq, "MESSAGE"))
    return SIPB2BHandler::TYPE_MESSAGE;
  else if (OSS::string_ends_with(cseq, "NOTIFY"))
    return SIPB2BHandler::TYPE_NOTIFY;
  else if (OSS::string_ends_with(cseq, "REFER"))
    return SIPB2BHandler::TYPE_REFER;
  else if (OSS::string_ends_with(cseq, "UPDATE"))
    return SIPB2BHandler::TYPE_UPDATE;
  else if (pRequest->isRequest())
    return SIPB2BHandler::TYPE_ANY;

  return SIPB2BHandler::TYPE_INVALID;
}
开发者ID:ezuce,项目名称:oss_core,代码行数:40,代码来源:SIPB2BTransactionManager.cpp

示例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);
  }
}
开发者ID:arnaudcoquelet,项目名称:oss_core,代码行数:64,代码来源:SIPTransaction.cpp

示例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);
    }
  }
}
开发者ID:arnaudcoquelet,项目名称:oss_core,代码行数:70,代码来源:SIPTransaction.cpp

示例5: onReceivedMessage

void SIPFSMDispatch::onReceivedMessage(SIPMessage::Ptr pMsg, SIPTransportSession::Ptr pTransport)
{
  if (!pTransport->isEndpoint() && pTransport->getLastReadCount() < MIN_DATAGRAM_SIZE && !pTransport->isReliableTransport())
  {
    //
    // datagram is too short to be a SIP Message
    // Bailing out.  Take note that streamed connection
    // can split SIP messages to smaller frames
    // and the last frame can be smaller than MIN_DATAGRAM_SIZE
    // so we do not impose a limit for streams
    //
    return;
  }

  try
  {
    pMsg->parse();
  }
  catch(OSS::Exception e)
  {
    std::ostringstream logMsg;
    logMsg << "Incoming message failed to be parsed - " << e.message()
      << " LEN: " << pTransport->getLastReadCount()
      << " SRC: " << pTransport->getRemoteAddress().toIpPortString();
    OSS::log_warning(logMsg.str());
    return;
  }

  std::string id;
  if (!pMsg->getTransactionId(id))
    return;  // don't throw here
             // we don't have control over what we receive from the transport

  SIPTransaction::Ptr trn;
  SIPTransaction::Type transactionType = SIPTransaction::TYPE_UNKNOWN;
  if (pMsg->isRequest())
  {
    if (OSS::string_caseless_starts_with(pMsg->startLine(), "invite"))
    {
      transactionType = SIPTransaction::TYPE_IST;
      if (_istBlocker.has(id))
      {
        OSS_LOG_WARNING("Blocked request retransmission - " <<  pMsg->startLine());
        return;
      }
      
      trn = _ist.findTransaction(pMsg, pTransport);
    }
    else if (OSS::string_caseless_starts_with(pMsg->startLine(), "ack"))
    {
      //
      // ACK for error responses will get matched to a transaction
      //
      transactionType = SIPTransaction::TYPE_IST;
      trn = _ist.findTransaction(pMsg, pTransport, false);
    }
    else
    {
      transactionType = SIPTransaction::TYPE_NIST;
      trn = _nist.findTransaction(pMsg, pTransport);
    }
  }
  else if (!pMsg->isRequest())
  {
    std::string cseq;
    cseq = pMsg->hdrGet(OSS::SIP::HDR_CSEQ);
    if (OSS::string_caseless_ends_with(cseq, "invite"))
    {
      transactionType = SIPTransaction::TYPE_ICT;
      trn = _ict.findTransaction(pMsg, pTransport, false);
    }
    else
    {
      transactionType = SIPTransaction::TYPE_NICT;
      trn = _nict.findTransaction(pMsg, pTransport, false);
    }
  }
  if (trn)
  {
    std::ostringstream logMsg;
    if (!trn->getLogId().empty())
    {
      logMsg << trn->getLogId() << "Found Transaction " << trn->getId();
      OSS::log_debug(logMsg.str());
    }
    else
    {
      trn->setLogId(pMsg->createContextId(true));
      logMsg << trn->getLogId() << "Transaction " << trn->getId() << " CREATED";
      OSS::log_information(logMsg.str());
    }
  }

  if (!trn)
  {
    //
    // We did not get a transaction, check if this is an ack and find the IST ACK transaction
    //
    if (transactionType == SIPTransaction::TYPE_IST && pMsg->isRequest("ACK"))
    {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的sipmessage::Ptr::isRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。