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


C++ SipMessage类代码示例

本文整理汇总了C++中SipMessage的典型用法代码示例。如果您正苦于以下问题:C++ SipMessage类的具体用法?C++ SipMessage怎么用?C++ SipMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: FailureResponse

void Negotiating::FailureResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const
{
   int seqNum;
   UtlString seqMethod;
   
   if( response.getCSeqField( &seqNum, &seqMethod ) )
   {
      if( seqMethod.compareTo( SIP_INVITE_METHOD ) == 0 )
      {
         // session negotiation failed.  Deallocate all the tentative
         // media relays tentatively allocated to handle the media
         // sessions that just failed.
         impl.deallocateAndClearAllMediaRelaySessions( true, true, false );         

         if( !impl.getDialogEstablishedFlag() )
         {
            // this is a final failure response to a dialog-forming INVITE.  That 
            // event marks the end of the dialog hence, we do not need to continue
            // to track it.
            ChangeState( impl, impl.pMoribund );
         }
         else
         {
            // the renegotiation failed but the dialog is still active. Go back to state where
            // we wait for an incoming INVITE.
            ChangeState( impl, impl.pWaitingForInvite );
         }
      }
      else
      {
         OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Received unexpected successful response for %s request",
               impl.name(), impl.GetCurrentState()->name(), seqMethod.data() );    
      }
   }   
}
开发者ID:mranga,项目名称:sipxecs,代码行数:35,代码来源:DialogTrackerStates.cpp

示例2: handleOutgoing

void HomerProxyPlugin::handleOutgoing(SipMessage& message, const char* address, int port)
{
  struct timeval now;
  gettimeofday(&now, NULL);

  std::string data = message.getString();

  //OS_LOG_ERROR(FAC_SIP, "LENGTH: " << data.size() << " - " << data);

  StateQueueMessage msg;
  msg.setType(StateQueueMessage::Data);
  msg.set("Outgoing", 1);
  msg.set("IpProtoId", (int)HEPMessage::TCP);
  msg.set("Ip4SrcAddress", _localHost.c_str());
  msg.set("Ip4DestAddress", address);
  msg.set("SrcPort", _localPort);
  msg.set("DestPort", port);
  msg.set("TimeStamp", (double)now.tv_sec);
  msg.set("TimeStampMicroOffset", (double)now.tv_usec);
  msg.set("Data", data.c_str());

  std::string msgData = msg.data();
  bool noresponse = true;
  _sqa.publish("CAP", msgData.c_str(), noresponse);
}
开发者ID:SIPfoundry,项目名称:sipXhomer,代码行数:25,代码来源:ProxyPlugin.cpp

示例3: onConnected

void MyInviteSessionHandler::onConnected(ClientInviteSessionHandle cis, const SipMessage& msg) 
{
   mDialInstance.onConnected(cis);

   SdpContents *sdp = (SdpContents*)msg.getContents();
   cis->provideAnswer(*sdp);
}
开发者ID:SergeStinckwich,项目名称:openqwaq,代码行数:7,代码来源:MyInviteSessionHandler.cpp

示例4: insert

/// Add identity info to a message.
bool SipXauthIdentity::insert(SipMessage & message,
                              HeaderName headerName,
                              const OsDateTime * timestamp)
{
   // Don't proceed if the encapsulated identity is invalid
   if (!mIsValidIdentity)
   {
      Os::Logger::instance().log(FAC_SIP, PRI_CRIT,
                    "SipXauthIdentity::insert: "
                    "encapsulated SipXauthIdentity is invalid");
   }
   else
   {
      // make sure no existing identity in the message
      remove(message, headerName);

      // set Call-Id and from-tag for the signature calculation
      UtlString callId;
      UtlString fromTag;
      Url fromUrl;
      message.getCallIdField(&callId);
      message.getFromUrl(fromUrl);
      fromUrl.getFieldParameter("tag", fromTag);

      OsDateTime now;
      OsDateTime::getCurTime(now);
      if (NULL==timestamp)
      {
         timestamp = &now;
      }

      UtlString value;
      encode(value, callId, fromTag, *timestamp);

      // Insert displayName if it is an P-Asserted-Identity header.
      if (headerName == SipXauthIdentity::PAssertedIdentityHeaderName)
      {
          UtlString displayName;
          fromUrl.getDisplayName(displayName);
          value.prepend(displayName.data());
      }

      message.addHeaderField(headerName, value.data());
   }

   return mIsValidIdentity;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:48,代码来源:SipXauthIdentity.cpp

示例5: remove

/// Remove identity info from a message.
void SipXauthIdentity::remove(SipMessage & message, HeaderName headerName)
{
   int idHeaderCount = message.getCountHeaderFields(headerName);
   if (idHeaderCount>0)
   {
      UtlString rUri;
      message.getRequestUri(&rUri);
      Os::Logger::instance().log(FAC_SIP, PRI_WARNING,
                    "SipXauthIdentity::remove"
                    ": '%d' occurrances of %s in request to '%s'",
                    idHeaderCount, headerName, rUri.data());
      for (int i = idHeaderCount - 1;i>=0;i--)
      {
         message.removeHeader(headerName, i);
      }
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:18,代码来源:SipXauthIdentity.cpp

示例6: send

UtlBoolean SipUserAgentStateless::send(SipMessage& message,
                                       OsMsgQ* responseListener,
                                       void* responseListenerData)
{
    UtlString sendAddress;
    UtlString sendProtocol;
    int sendPort;

    if(message.isResponse())
    {
        int receivedPort;
        UtlBoolean receivedSet;
        UtlBoolean maddrSet;
        UtlBoolean receivedPortSet;
        message.getLastVia(&sendAddress, &sendPort, &sendProtocol, &receivedPort,
                           &receivedSet, &maddrSet, &receivedPortSet);
        if(receivedPortSet && portIsValid(receivedPort))
        {
            sendPort = receivedPort;
        }
    }
    else
    {
        UtlString uriString;
        message.getRequestUri(&uriString);
        Url uri(uriString);
        uri.getHostAddress(sendAddress);

        // Check for maddr
        UtlString maddr;
        uri.getUrlParameter("maddr", maddr);
        if(!maddr.isNull())
        {
            // Use maddr if present
            sendAddress = maddr;
        }

        uri.getUrlParameter("transport", sendProtocol);
        sendPort = uri.getHostPort();
    }

    UtlBoolean sendOk =
        sendTo(message, sendAddress.data(), sendProtocol.data(), sendPort);

    return(sendOk);
}
开发者ID:,项目名称:,代码行数:46,代码来源:

示例7: removeErrorSubscription

int SubscribeServerThread::removeErrorSubscription (const SipMessage& sipMessage )
{
    int returnStatus = STATUS_SUCCESS;
    UtlString callId;
    UtlString to;
    UtlString from;
    sipMessage.getToField(&to);
    sipMessage.getFromField(&from);
    sipMessage.getCallIdField(&callId);

    OsSysLog::add(FAC_SIP, PRI_WARNING,
                  "SubscribeServerThread::removeErrorSubscription %s",
                  callId.data());

    removeErrorRow(from, to, callId);
    return returnStatus;
}
开发者ID:astubbs,项目名称:sipxecs,代码行数:17,代码来源:SubscribeServerThread.cpp

示例8: handleMessageRequest

// Process a MESSAGE request, which is used to trigger debugging actions.
void AppearanceAgentTask::handleMessageRequest(const SipMessage& msg)
{
   // Extract the user-part of the request-URI, which should tell us what
   // to do.
   UtlString user;
   msg.getUri(NULL, NULL, NULL, &user);

   // Construct the response.
   SipMessage response;

   if (user.compareTo(dumpStateUri) == 0)
   {
      // dumpStateUri is used to request to dump the Appearance Agent state into the log.
      debugDumpState(msg);
      response.setOkResponseData(&msg, NULL);
   }
   else
   {
      response.setInterfaceIpPort(msg.getInterfaceIp(), msg.getInterfacePort());
      response.setResponseData(&msg, SIP_NOT_FOUND_CODE, SIP_NOT_FOUND_TEXT);
   }

   // Send the response.
   getAppearanceAgent()->getServerUserAgent().send(response);
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:26,代码来源:AppAgentTask.cpp

示例9: sendTo

// Queue a message to be sent to the specified address and port.
UtlBoolean SipClient::sendTo(SipMessage& message,
                             const char* address,
                             int port)
{
   UtlBoolean sendOk;

   if (mClientSocket)
   {
      // If port == PORT_NONE, get the correct default port for this
      // transport method.
      int portToSendTo = ( port == PORT_NONE ? defaultPort() : port );

      // We are about to post a message that will cause the
      // SIP message to be sent.  Notify the user agent so
      // that it can offer the message to all its registered
      // output processors.

      ssize_t msgLength = 0;
      UtlString msgText;
      message.getBytes(&msgText, &msgLength, true);
      if (msgLength)
      {
        system_tap_sip_tx(
             mLocalHostAddress.data(), portIsValid(mLocalHostPort) ? mLocalHostPort : defaultPort(),
             address, portToSendTo,
             msgText.data(), msgLength);

        mpSipUserAgent->executeAllSipOutputProcessors( message, address, portToSendTo );
      }

      // Create message to queue.
      SipClientSendMsg sendMsg(OsMsg::OS_EVENT,
                               SipClientSendMsg::SIP_CLIENT_SEND,
                               message, address,
                               portToSendTo );

      // Post the message to the task's queue.
      OsStatus status = postMessage(sendMsg, OsTime::NO_WAIT);
      sendOk = status == OS_SUCCESS;
      if (!sendOk)
      {
         Os::Logger::instance().log(FAC_SIP, PRI_ERR,
                       "SipClient[%s]::sendTo attempt to post message failed",
                       mName.data());
      }
   }
   else
   {
      Os::Logger::instance().log(FAC_SIP, PRI_CRIT,
                    "SipClient[%s]::sendTo called for client without socket",
                    mName.data()
         );
      sendOk = FALSE;
   }

   return sendOk;
}
开发者ID:ossapp,项目名称:sipxecs,代码行数:58,代码来源:SipClient.cpp

示例10: getDiscriminatingTagValue

UtlString SessionContext::getDiscriminatingTagValue( const SipMessage& message, bool bFromCallerToCallee ) const
{
   UtlString discriminatingTag;
   Url tempUrl;

   if( bFromCallerToCallee )
   {
      // caller-to-callee uses To-tag to distinguish between dialogs
      message.getToUrl( tempUrl );
   }
   else
   {
      // callee-to-caller uses From-tag to distinguish between dialogs
      message.getFromUrl( tempUrl );
   }
   tempUrl.getFieldParameter( "tag", discriminatingTag );
   return discriminatingTag;
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:18,代码来源:SessionContext.cpp

示例11:

AuthPlugin::AuthResult
SubscriptionAuth::authorizeAndModify(const UtlString& id,    /**< The authenticated identity of the
                                                              *   request originator, if any (the null
                                                              *   string if not).
                                                              *   This is in the form of a SIP uri
                                                              *   identity value as used in the
                                                              *   credentials database ([email protected])
                                                              *   without the scheme or any parameters.
                                                              */
                                    const Url&  requestUri, ///< parsed target Uri
                                    RouteState& routeState, ///< the state for this request.
                                    const UtlString& method,///< the request method
                                    AuthResult  priorResult,///< results from earlier plugins.
                                    SipMessage& request,    ///< see AuthPlugin wrt modifying
                                    bool bSpiralingRequest, ///< request spiraling indication
                                    UtlString&  reason      ///< rejection reason
                                    )
{
   AuthResult result = CONTINUE;
   UtlString eventField;
   UtlString targetUser;
   requestUri.getUserId(targetUser);

   if (CONTINUE == priorResult &&
       id.isNull() &&
       method.compareTo(SIP_SUBSCRIBE_METHOD) == 0 &&
       request.getEventField(eventField) &&
       mEventPackagesRequiringAuthentication.contains( &eventField ) &&
       !isTargetExemptedFromAuthentication(targetUser))
   {
      // we do not have an authenticated ID for the request - challenge it.
      // get the call-id to use in logging
      UtlString callId;
      request.getCallIdField(&callId);

      OsSysLog::add(FAC_AUTH, PRI_INFO, "SubscriptionAuth[%s]::authorizeAndModify "
                    "challenging subscription for dialog event package '%s' (call id = '%s')",
                    mInstanceName.data(), eventField.data(), callId.data()
                    );
      result = DENY;
      reason = "Authentication Required to Subscribe to " + eventField;
   }
   return result;
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:44,代码来源:SubscriptionAuth.cpp

示例12: setNextLocalTransactionInfo

UtlBoolean SipDialogMgr::setNextLocalTransactionInfo(SipMessage& request,
                                                     const char* method,
                                                     const char* dialogHandle)
{
    UtlBoolean requestSet = FALSE;
    UtlString dialogHandleString(dialogHandle ? dialogHandle : "");
    if(dialogHandleString.isNull())
    {
        request.getDialogHandle(dialogHandleString);
    }

    lock();
    SipDialog* dialog = findDialog(dialogHandleString,
                                   FALSE, // If established only want exact match dialogs
                                   TRUE); // If message is from a prior transaction
                                          // when the dialog was in an early state
                                          // allow it to match an established
                                          // dialog
    if(dialog)
    {
        dialog->setRequestData(request, method);
        requestSet = TRUE;

#ifdef TEST_PRINT
        UtlString dialogDump;
        dialog->toString(dialogDump);
        OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipDialogMgr::setNextLocalTransactionInfo dialog: '%s'",
                      dialogDump.data());
#endif
    }
    else
    {
       OsSysLog::add(FAC_SIP, PRI_ERR, "SipDialogMgr::setNextLocalTransactionInfo dialog not found for handle '%s'",
                     dialogHandle);

       if (OsSysLog::willLog(FAC_SIP, PRI_DEBUG))
       {
          SipDialog* dialog;
          UtlHashBagIterator iterator(mDialogs);
          
          while ((dialog = (SipDialog*) iterator()))
          {
             UtlString callId, localTag, remoteTag;
             dialog->getCallId(callId);
             dialog->getLocalTag(localTag);
             dialog->getRemoteTag(remoteTag);
             OsSysLog::add(FAC_SIP, PRI_DEBUG, "SipDialogMgr::setNextLocalTransactionInfo dialog call-id = '%s', local tag = '%s', remote tag = '%s'",
                           callId.data(), localTag.data(), remoteTag.data());
          }
       }
    }

    unlock();

    return(requestSet);
}
开发者ID:mranga,项目名称:sipxecs,代码行数:56,代码来源:SipDialogMgr.cpp

示例13: isAuthorized

UtlBoolean RlsSubscribePolicy::isAuthorized(const SipMessage& subscribeRequest,
                                            SipMessage& subscribeResponse)
{
   // SUBSCRIBE is authorized if "eventlist" is supported.
   UtlBoolean ret = subscribeRequest.isInSupportedField(SIP_EVENTLIST_EXTENSION);

   // If we return false, we must construct a failure response.
   if (!ret)
   {
      // 421 Extension Required
      // Require: eventlist"
      subscribeResponse.setResponseData(&subscribeRequest,
                                        SIP_EXTENSION_REQUIRED_CODE,
                                        SIP_EXTENSION_REQUIRED_TEXT);
      subscribeResponse.addRequireExtension(SIP_EVENTLIST_EXTENSION);
   }

   return ret;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:19,代码来源:RlsSubscribePolicy.cpp

示例14: normalize

/// Normalize identity info in a message.
void SipXauthIdentity::normalize(SipMessage & message,  HeaderName headerName)
{
   int idHeaderCount = message.getCountHeaderFields(headerName);
   if (idHeaderCount>1)
   {
      UtlString rUri;
      message.getRequestUri(&rUri);
      Os::Logger::instance().log(FAC_SIP, PRI_WARNING,
                    "SipXauthIdentity::remove"
                    ": '%d' occurrances of SipXauthIdentity in request to '%s'",
                    idHeaderCount, rUri.data());
      // Remove all BUT the last header
      for (int i = idHeaderCount - 2;i>=0;i--)
      {
         //message.removeHeader(SipXauthIdentity::AuthIdentityHeaderName, i);
         message.removeHeader(headerName, i);
      }
   }
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:20,代码来源:SipXauthIdentity.cpp

示例15: lock

enum SipDialogMgr::transactionSequence
    SipDialogMgr::isNewRemoteTransaction(const SipMessage& message)
{
    enum transactionSequence ordering;
    UtlString handle;
    message.getDialogHandle(handle);

    UtlString callId;
    UtlString fromTag;
    UtlString toTag;
    SipDialog::parseHandle(handle, callId, fromTag, toTag);

    lock();
    // Looking for any dialog that matches this handle
    SipDialog* dialog = findDialog(handle,
                                   TRUE, // if established, match early dialog
                                   TRUE); // if early, match established dialog

    if (dialog && 
        dialog->isTransactionRemotelyInitiated(callId, fromTag, toTag))
    {
       int messageCSeq;
       message.getCSeqField(&messageCSeq, NULL);
       int lastRemoteCSeq = dialog->getLastRemoteCseq();
       ordering =
          messageCSeq < lastRemoteCSeq ? OUT_OF_ORDER :
          /** If this message was an exact duplicate of a previous message
           *  (with the same CSeq and branch parameter), it would have been
           *  absorbed earlier in processing.  So we know the branch parameter
           *  is different without having to remember the previous value.
           */
          messageCSeq == lastRemoteCSeq ? LOOPED :
          IN_ORDER;
    }
    else
    {
       ordering = NO_DIALOG;
    }

    unlock();
    
    return ordering;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:43,代码来源:SipDialogMgr.cpp


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