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

Re: [reSIProcate] Bug in error handling / reSUBSCRIBE case for ClientSubscription


Hi Aron,

Can you try this fix out?

Index: ClientSubscription.cxx
===================================================================
--- ClientSubscription.cxx (revision 8806)
+++ ClientSubscription.cxx (working copy)
@@ -170,7 +170,9 @@
       InfoLog (<< "Received 481 to SUBSCRIBE, reSUBSCRIBEing (presence server probably restarted) "
                << mLastRequest->header(h_To));
 
-      SharedPtr<SipMessage> sub = mDum.makeSubscription(mLastRequest->header(h_To), getUserProfile(), getEventType(), getAppDialogSet()->reuse());
+  NameAddr target(mLastRequest->header(h_To));
+  target.remove(p_tag);  // ensure To tag is removed
+      SharedPtr<SipMessage> sub = mDum.makeSubscription(target, getUserProfile(), getEventType(), getAppDialogSet()->reuse());
       mDum.send(sub);
 
       delete this;
@@ -221,7 +223,9 @@
          }
          else
          {
-            SharedPtr<SipMessage> sub = mDum.makeSubscription(mLastRequest->header(h_To), getUserProfile(), getEventType(), getAppDialogSet()->reuse());
+            NameAddr target(mLastRequest->header(h_To));
+        target.remove(p_tag);  // ensure To tag is removed
+            SharedPtr<SipMessage> sub = mDum.makeSubscription(target, getUserProfile(), getEventType(), getAppDialogSet()->reuse());
             mDum.send(sub);
             delete this;
             return;
@@ -450,7 +454,9 @@
          {
             InfoLog(<< "ClientSubscription: application retry new request");
   
-            SharedPtr<SipMessage> sub = mDum.makeSubscription(mLastRequest->header(h_To), getUserProfile(), getEventType(), getAppDialogSet()->reuse());
+            NameAddr target(mLastRequest->header(h_To));
+        target.remove(p_tag);  // ensure To tag is removed
+            SharedPtr<SipMessage> sub = mDum.makeSubscription(target, getUserProfile(), getEventType(), getAppDialogSet()->reuse());
             mDum.send(sub);            
             delete this;
          }

Thanks,
Scott

On Wed, Sep 15, 2010 at 6:14 PM, <aron_rosenberg@xxxxxxxxxxxx> wrote:

In a number of places in ClientSubscription.cxx, the class will automatically invoke dum.makeSubscription to create a new subscription if the current one is failed. One such place is

else if (!mEnded &&
msg.header(h_StatusLine).statusCode() == 481 &&
msg.exists(h_Expires) && msg.header(h_Expires).value() > 0)
{
InfoLog (<< "Received 481 to SUBSCRIBE, reSUBSCRIBEing (presence server probably restarted) "
<< mLastRequest->header(h_To));

SharedPtr<SipMessage> sub = mDum.makeSubscription(mLastRequest->header(h_To), getUserProfile(), getEventType(), getAppDialogSet()->reuse());
mDum.send(sub);

delete this;
return;
}

This is the 481 dialog doesn't exist case. In this case, dum is properly building a new SUBSCRIBE message, but the new SUBSCRIBE message/dialog starts out with a populated ToTag. The presence server then rejects this new dialog since a ToTag must start empty. The new request has a different Call-Id, from tag, branch tag/via, but the ToTag is the same as the previous failed request

My hunch is that passing in h_To is causing the old ToTag to get copied to the new request, but I am not sure what the proper fix is... I already tried removing the getAppDialogSet()->reuse() param but it didn't have any affect.

I have a test case setup for this with our presence server so I can try various patches.

-Aron

Aron Rosenberg
Logitech Inc, (SightSpeed Group)


_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxx
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel