// Callback routine for NOTIFY events. // Called by ResourceListTask. void ResourceListSet::notifyEventCallbackSync(const UtlString* dialogHandle, const UtlString* content) { Os::Logger::instance().log(FAC_RLS, PRI_DEBUG, "ResourceListSet::notifyEventCallbackSync dialogHandle = '%s'", dialogHandle->data()); // Serialize access to the ResourceListSet. OsLock lock(mSemaphore); // Look up the ResourceNotifyReceiver to notify based on the dialogHandle. /* To call the handler, we dynamic_cast the object to * (ResourceNotifyReceiver*). Whether this is strictly * conformant C++ I'm not sure, since UtlContainanble and * ResourceNotifyReceiver 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 * ResourceNotifyReceiver. */ ResourceNotifyReceiver* receiver = dynamic_cast <ResourceNotifyReceiver*> (mNotifyMap.findValue(dialogHandle)); if (receiver) { receiver->notifyEventCallback(dialogHandle, content); } else { Os::Logger::instance().log(FAC_RLS, PRI_WARNING, "ResourceListSet::notifyEventCallbackSync this = %p, no ResourceNotifyReceiver found for dialogHandle '%s'", this, dialogHandle->data()); } }
// Callback routine for NOTIFY events. // Called by AppearanceGroupTask. // This callback MUST send a response, as we told the SipSubscribeClient not to. void AppearanceGroupSet::notifyEventCallbackSync(const UtlString* dialogHandle, const SipMessage* msg) { OsSysLog::add(FAC_SAA, PRI_DEBUG, "AppearanceGroupSet::notifyEventCallbackSync dialogHandle = '%s'", dialogHandle->data()); // Serialize access to the appearance group set. OsLock lock(mSemaphore); // Look up the ResourceNotifyReceiver to notify based on the dialogHandle. /* To call the handler, we dynamic_cast the object to * (ResourceNotifyReceiver*). Whether this is strictly * conformant C++ I'm not sure, since UtlContainanble and * ResourceNotifyReceiver 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 * ResourceNotifyReceiver. */ ResourceNotifyReceiver* receiver = dynamic_cast <ResourceNotifyReceiver*> (mNotifyMap.findValue(dialogHandle)); if (receiver) { // the callback MUST respond to the NOTIFY receiver->notifyEventCallback(dialogHandle, msg); } else { OsSysLog::add(FAC_SAA, PRI_DEBUG, "AppearanceGroupSet::notifyEventCallbackSync this = %p, no ResourceNotifyReceiver found for dialogHandle '%s'", this, dialogHandle->data()); // Acknowledge the NOTIFY, even though we won't process it. SipMessage response; response.setOkResponseData(msg, NULL); getAppearanceAgent()->getServerUserAgent().send(response); } delete msg; }