// Callback routine for subscription state events. // Called by ResourceListTask. void ResourceListSet::subscriptionEventCallbackSync( const UtlString* earlyDialogHandle, const UtlString* dialogHandle, SipSubscribeClient::SubscriptionState newState, const UtlString* subscriptionState ) { Os::Logger::instance().log(FAC_RLS, PRI_DEBUG, "ResourceListSet::subscriptionEventCallbackSync earlyDialogHandle = '%s', dialogHandle = '%s', newState = %d, subscriptionState = '%s'", earlyDialogHandle->data(), dialogHandle->data(), newState, subscriptionState->data()); // Serialize access to the ResourceListSet. mutex_read_lock lock(_listMutex); Os::Logger::instance().log(FAC_RLS, PRI_DEBUG, "ResourceListSet::subscriptionEventCallbackSync after mutex_read_lock on semaphore"); // Look up the ResourceSubscriptionReceiver to notify based on the // earlyDialogHandle. /* To call the handler, we dynamic_cast the object to * (ResourceSubscriptionReceiver*). Whether this is strictly * conformant C++ I'm not sure, since UtlContainanble and * ResourceSubscriptionReceiver are not base/derived classes of * each other. But it seems to work in GCC as long as the dynamic * type of the object is a subclass of both UtlContainable and * ResourceSubscriptionReceiver. */ ResourceSubscriptionReceiver* receiver = dynamic_cast <ResourceSubscriptionReceiver*> (mSubscribeMap.findValue(earlyDialogHandle)); if (receiver) { Os::Logger::instance().log(FAC_RLS, PRI_DEBUG, "ResourceListSet::subscriptionEventCallbackSync calling receiver->subscriptionEventCallback"); receiver->subscriptionEventCallback(earlyDialogHandle, dialogHandle, newState, subscriptionState); Os::Logger::instance().log(FAC_RLS, PRI_DEBUG, "ResourceListSet::subscriptionEventCallbackSync exiting receiver->subscriptionEventCallback"); } else { Os::Logger::instance().log(FAC_RLS, PRI_WARNING, "ResourceListSet::subscriptionEventCallbackSync this = %p, no ResourceSubscriptionReceiver found for earlyDialogHandle '%s'", this, earlyDialogHandle->data()); } Os::Logger::instance().log(FAC_RLS, PRI_DEBUG, "ResourceListSet::subscriptionEventCallbackSync exit function"); }
// Callback routine for subscription state events. // Called by AppearanceGroupTask. void AppearanceGroupSet::subscriptionEventCallbackSync( const UtlString* earlyDialogHandle, const UtlString* dialogHandle, SipSubscribeClient::SubscriptionState newState, const UtlString* subscriptionState ) { OsSysLog::add(FAC_SAA, PRI_DEBUG, "AppearanceGroupSet::subscriptionEventCallbackSync earlyDialogHandle = '%s', dialogHandle = '%s', newState = %d, subscriptionState = '%s'", earlyDialogHandle->data(), dialogHandle->data(), newState, subscriptionState->data()); // Serialize access to the appearance group set. OsLock lock(mSemaphore); // Look up the ResourceSubscriptionReceiver to notify based on the // earlyDialogHandle. /* To call the handler, we dynamic_cast the object to * (ResourceSubscriptionReceiver*). Whether this is strictly * conformant C++ I'm not sure, since UtlContainable and * ResourceSubscriptionReceiver are not base/derived classes of * each other. But it seems to work in GCC as long as the dynamic * type of the object is a subclass of both UtlContainable and * ResourceSubscriptionReceiver. */ ResourceSubscriptionReceiver* receiver = dynamic_cast <ResourceSubscriptionReceiver*> (mSubscribeMap.findValue(earlyDialogHandle)); if (receiver) { receiver->subscriptionEventCallback(earlyDialogHandle, dialogHandle, newState, subscriptionState); } else { OsSysLog::add(FAC_SAA, PRI_DEBUG, "AppearanceGroupSet::subscriptionEventCallbackSync this = %p, no ResourceSubscriptionReceiver found for earlyDialogHandle '%s'", this, earlyDialogHandle->data()); } }