コード例 #1
0
void SipImpliedSubscriptions::takeAction(
    const SipMessage&   registerMessage  ///< the successful registration
   ,const unsigned int  registrationDuration /**< the actual allowed
                                              * registration time (note
                                              * that this may be < the
                                              * requested time). */
   ,SipUserAgent*       sipUserAgent     /**< to be used if the plugin
                                          *   wants to send any SIP msg */
                                         )
{

   if ( needsImpliedSubscription( registerMessage ) )
   {
      OsSysLog::add( FAC_SIP, PRI_DEBUG
                    ,"%s requesting mwi subscription duration=%d"
                    ,mLogName.data(), registrationDuration
                    );

      // This phone - accepts message waiting notifies,
      // but don't subscribe to them, so we'll do it for them.
      SipMessage subscribeRequest;
      UtlString  callId;
      UtlString  fromTag;
      UtlString  fromUri;

      buildSubscribeRequest( registerMessage, registrationDuration
                            ,subscribeRequest, callId, fromTag, fromUri
                            );

      authenticate( registerMessage, subscribeRequest, callId, fromTag, fromUri );

      sipUserAgent->send( subscribeRequest, NULL, NULL );
   }
}
コード例 #2
0
void SipImpliedSubscriptions::takeAction(
    const SipMessage&   registerMessage  ///< the successful registration
   ,const unsigned int  registrationDuration /**< the actual allowed
                                              * registration time (note
                                              * that this may be < the
                                              * requested time). */
   ,SipUserAgent*       sipUserAgent     /**< to be used if the plugin
                                          *   wants to send any SIP msg */
                                         )
{

   if ( needsImpliedSubscription( registerMessage ) )
   {
      Os::Logger::instance().log( FAC_SIP, PRI_DEBUG
                    ,"%s requesting mwi subscription duration=%d"
                    ,mLogName.data(), registrationDuration
                    );

      // This phone - accepts message waiting notifies,
      // but doesn't subscribe to them, so we'll do it for them.
      SipMessage subscribeRequest;
      UtlString  callId;
      UtlString  fromTag;
      UtlString  fromUri;

      buildSubscribeRequest( registerMessage, registrationDuration
                            ,subscribeRequest, callId, fromTag, fromUri
                            );

      // If credentials aren't found, Authorization header won't be added
      addAuthorization( registerMessage, subscribeRequest, callId, fromTag, fromUri );

      // send SUBSCRIBE with or without Authorization header
      sipUserAgent->send( subscribeRequest, NULL, NULL );
   }
}