< Previous by Date Date Index Next by Date >
  Thread Index  

[reSIProcate] Some bugs on SUBSCRIBE/NOTIFY processing


Hi,

Caught some bugs on SUBSCRIBE/NOTIFY processing:

1) In Dialog::dispatch()

         case SUBSCRIBE:
         {
            ServerSubscription* server =
findMatchingServerSub(request);
            if (server)
            {
               server->dispatch(request);
            }
            else
            {
               if (request.header(h_Event).value() ==
"refer")
               {
                  InfoLog (<< "Received a subscribe to
a non-existent refer subscription: " <<
request.brief());
                  SipMessage failure;
                  makeResponse(failure, request, 403);
                  mDum.sendResponse(failure);
                  return;
               }
               else
               {
                  server =
makeServerSubscription(request);
                 
mServerSubscriptions.push_back(server);
                  server->dispatch(request);
               }
            }
           
//mDum.mInviteSessionHandler->onRefer(mInviteSession->getSessionHandle(),
server->getHandle(), msg); xkd-2004-9-22
         }
         break;

For incoming SUBSCIRBE, this is not a REFER message,
so should not call onRefer().

2) In ServerSubscription::dispatch(const SipMessage&
msg), we should record each SUBSCRIBE to mLastRequest.

   if (msg.isRequest())
   {
   // Set mLastRequest to the msg, xkd-2004-9-22
      mLastRequest = msg;

so we can send back 200 to each SUBSCRIBE in
ServerSubscriptionHandler::onRefresh().

3)  In ServerSubscription::dispatch(const SipMessage&
msg), if the Expires in the SUBSCIRE is zero, it is
better to send 200 immediately.

      if (mExpires == 0)
      {
        // First send 200, xkd-2004-9-22
        mDialog.makeResponse(mLastResponse, mLastRequest,
200);
        LastResponse.header(h_Expires).value() = 0;
        send(mLastResponse);
        // end xkd

4) It is better to make onExpiredByClient() and
onExpired() in ServerSubscriptionHandler as virtual,
so that the application can define some behavior, such
as delete the user from its watcher (subscriber) list.


Any comments are welcome.

kaiduan

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca