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

Re: [reSIProcate] Question about outbound decorator


Dario,

onReadyToSend was implemented before outbound decorators.  onReadyToSend can be sufficient in many scenarios, but there are situations when using outbound decorators is much more powerful.  ie.:
- onReadyToSend is only called for established dialogs, so logic to decorate an initial outbound request must be done after the DialogUsageManager::makeXXXX fns.  Outbound decorators are invoked for every message sent out the stack.
- Outbound decorators are invoked after the transport selector is run, and the Contact and Via headers are populated by the stack.  The application may require this information in order to do it's decoration.

Note:  outbound decorators were always intended to be used to decorate both requests and responses (this is how it was documented), however previous version of resip only called the decorators for requests.  This was fixed.

Hope this helps!

Scott

On Tue, Dec 22, 2009 at 12:36 PM, Dario Bozzali <Dario.Bozzali@xxxxxxxxxxxxxxxxx> wrote:
Hi,
I have a question about outbound decorator.
 
I noticed that in Resiprocate 1.4.1 outbound decorator was added to SipMessage if it was a request, while to "give app an chance to adorn the message" (as written in comment) onReadyToSend() method is called in DialogUsage::send().
As a consequence onReadyToSend() method is called for InviteSession, ClientSubscription and ServerSubscription (this is true also for Resiprocate 1.5).
 
See the following excerpt taken from DialogUsageManager::send() method:
 
   if (msg->isRequest())
   {
      [...]
      // !bwc! This is to avoid leaving extra copies of the decorator in msg,
      // when the caller of this function holds onto the reference (and this
      // happens quite often in DUM). I would prefer to refactor such that we
      // are operating on a copy in this function, but this would require a lot
      // of work on the DumFeatureChain stuff (or, require an extra copy on top
      // of the one we're doing when we send the message to the stack, which
      // would chew up a lot of extra cycles).
      msg->clearOutboundDecorators();
 
      // Add outbound decorator from userprofile
      SharedPtr<MessageDecorator> outboundDecorator = userProfile->getOutboundDecorator();
      if (outboundDecorator.get())
      {
         msg->addOutboundDecorator(std::auto_ptr<MessageDecorator>(outboundDecorator->clone()));
      }
      [...]
   }
 
In Resiprocate 1.5 the reported block has been moved outside if statement, so outbound decorator is called for every SipMessage (request or response).
 
This change has modified behaviour of my application when I have updated Resiprocete release from 1.4.1 to 1.5, but this is my concern.
Anyway, could anyone tell me why that block has been moved since onReadyToSend() could possibly be used to add outbound decorator to SipMessage?
What onReadyToSend() method is used for?
 
Thank you in advance and best regards.
 
Dario.

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