예제 #1
0
void Appearance::subscriptionEventCallback(
   const UtlString* earlyDialogHandle,
   const UtlString* dialogHandle,
   SipSubscribeClient::SubscriptionState newState,
   const UtlString* subscriptionState)
{
   Os::Logger::instance().log(FAC_SAA, PRI_DEBUG,
                 "Appearance::subscriptionEventCallback this = %p, "
                 "uri = '%s', newState = %d, earlyDialogHandle = '%s', dialogHandle = '%s', subscriptionState = '%s'",
                 this, mUri.data(), newState, mSubscriptionEarlyDialogHandle.data(),
                 dialogHandle->data(), subscriptionState->data());

   switch (newState)
   {
   case SipSubscribeClient::SUBSCRIPTION_INITIATED:
      break;
   case SipSubscribeClient::SUBSCRIPTION_SETUP:
   {
      Os::Logger::instance().log(FAC_SAA, PRI_INFO,
                    "Appearance::subscriptionEventCallback "
                    "subscription setup for uri = '%s', dialogHandle = '%s'",
                    mUri.data(), dialogHandle->data());
      mDialogHandle = *dialogHandle;
      // Add this Appearance to mNotifyMap for the subscription.
      getAppearanceGroupSet().addNotifyMapping(dialogHandle, this);
   }
   break;
   case SipSubscribeClient::SUBSCRIPTION_TERMINATED:
   {
      mDialogHandle.remove(0);
      // Remove this dialogHandle from mNotifyMap for the subscription.
      getAppearanceGroupSet().deleteNotifyMapping(dialogHandle);
      bool bContentChanged = terminateDialogs(false); // terminate only non-held dialogs
      if ( bContentChanged)
      {
         Os::Logger::instance().log(FAC_SAA, PRI_INFO,
                    "Appearance::subscriptionEventCallback "
                    "terminated dialogs held by uri = '%s'",
                    mUri.data());
         SipDialogEvent* lPartialContent = new SipDialogEvent("partial", mAppearanceGroup->getUser().data());
         getDialogs(lPartialContent);
         getAppearanceGroup()->publish(true, true, lPartialContent);
         delete lPartialContent;
      }

      // our subscription might be refreshed, but any outstanding dialogs have been terminated,
      // so reset to default
      mbShortTimeout = false;

      Os::Logger::instance().log(FAC_SAA, PRI_INFO,
                    "Appearance::subscriptionEventCallback "
                    "subscription terminated for uri = '%s', dialogHandle = '%s'",
                    mUri.data(), dialogHandle->data());
   }
   break;
   }
}
예제 #2
0
void Appearance::subscriptionEventCallback(
   const UtlString* earlyDialogHandle,
   const UtlString* dialogHandle,
   SipSubscribeClient::SubscriptionState newState,
   const UtlString* subscriptionState)
{
   OsSysLog::add(FAC_SAA, PRI_DEBUG,
                 "Appearance::subscriptionEventCallback "
                 "uri = '%s', newState = %d, earlyDialogHandle = '%s', dialogHandle = '%s', subscriptionState = '%s'",
                 mUri.data(), newState, mSubscriptionEarlyDialogHandle.data(),
                 dialogHandle->data(), subscriptionState->data());

   switch (newState)
   {
   case SipSubscribeClient::SUBSCRIPTION_INITIATED:
      break;
   case SipSubscribeClient::SUBSCRIPTION_SETUP:
   {
      OsSysLog::add(FAC_SAA, PRI_INFO,
                    "Appearance::subscriptionEventCallback "
                    "subscription setup for uri = '%s', dialogHandle = '%s'",
                    mUri.data(), dialogHandle->data());
   }
   break;
   case SipSubscribeClient::SUBSCRIPTION_TERMINATED:
   {
      bool bContentChanged = terminateDialogs(false); // terminate only non-held dialogs
      if ( bContentChanged)
      {
         SipDialogEvent* lPartialContent = new SipDialogEvent("partial", mUri.data());
         getDialogs(lPartialContent);
         getAppearanceGroup()->publish(true, true, lPartialContent);
         delete lPartialContent;
      }
      OsSysLog::add(FAC_SAA, PRI_INFO,
                    "Appearance::subscriptionEventCallback "
                    "subscription terminated for uri = '%s', dialogHandle = '%s'",
                    mUri.data(), dialogHandle->data());
   }
   break;
   }
}