コード例 #1
0
void SIPTransaction::writeMessage(SIPMessage::Ptr pMsg, const OSS::IPAddress& remoteAddress)
{
  OSS::mutex_lock lock(_mutex);

  if (!_transport)
  {
    OSS_LOG_ERROR("SIPTransaction::writeMessage does not have a transport to use");
    return;
  }

  if (SIPXOR::isEnabled() && _isXOREncrypted)
  {
    pMsg->setProperty("xor", "1");
  }

  if (_fsm->onSendMessage(pMsg))
  {
    std::ostringstream logMsg;
    logMsg << _logId << ">>> " << pMsg->startLine()
    << " LEN: " << pMsg->data().size()
    << " SRC: " << _transport->getLocalAddress().toIpPortString()
    << " DST: " << remoteAddress.toIpPortString()
    << " ENC: " << _isXOREncrypted
    << " PROT: " << _transport->getTransportScheme();
    OSS::log_information(logMsg.str());
    if (OSS::log_get_level() >= OSS::PRIO_DEBUG)
      OSS::log_debug(pMsg->createLoggerData());

    _transport->writeMessage(pMsg,
    remoteAddress.toString(),
    OSS::string_from_number<unsigned short>(remoteAddress.getPort()));
  }
}
コード例 #2
0
void SIPTransaction::writeMessage(SIPMessage::Ptr pMsg)
{
  OSS::mutex_lock lock(_mutex);

  if (!_transport)
  {
    OSS_LOG_ERROR("SIPTransaction::writeMessage - Transport is NULL while attempting to send a request.");
    return;
  }

  if (SIPXOR::isEnabled() && _isXOREncrypted)
  {
    pMsg->setProperty("xor", "1");
  }

  std::ostringstream logMsg;
  logMsg << _logId << ">>> " << pMsg->startLine()
  << " LEN: " << pMsg->data().size()
  << " SRC: " << _transport->getLocalAddress().toIpPortString()
  << " DST: " << _transport->getRemoteAddress().toIpPortString()
  << " ENC: " << _isXOREncrypted
  << " PROT: " << _transport->getTransportScheme();
  OSS::log_information(logMsg.str());

  if (OSS::log_get_level() >= OSS::PRIO_DEBUG)
    OSS::log_debug(pMsg->createLoggerData());

  if (_fsm->onSendMessage(pMsg))
  {
    _transport->writeMessage(pMsg);
  }
}
コード例 #3
0
void SIPWebSocketConnection::writeMessage(SIPMessage::Ptr msg)
/// Send a SIP message using this session.
{
    if (_pServerConnection)
    {
        _pServerConnection->send(msg->data(), websocketpp::frame::opcode::BINARY);
    }
}