reSIProcate/repro  9694
Public Member Functions | Private Attributes
repro::OutboundTargetHandler Class Reference

#include <OutboundTargetHandler.hxx>

Inheritance diagram for repro::OutboundTargetHandler:
Inheritance graph
[legend]
Collaboration diagram for repro::OutboundTargetHandler:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 OutboundTargetHandler (resip::RegistrationPersistenceManager &store)
virtual ~OutboundTargetHandler ()
virtual processor_action_t process (RequestContext &)

Private Attributes

resip::RegistrationPersistenceManagermRegStore

Detailed Description

Definition at line 10 of file OutboundTargetHandler.hxx.


Constructor & Destructor Documentation

repro::OutboundTargetHandler::OutboundTargetHandler ( resip::RegistrationPersistenceManager store)

Definition at line 15 of file OutboundTargetHandler.cxx.

                                                                                       : 
   Processor("OutboundTargetHandler"),
   mRegStore(store)
{
}
repro::OutboundTargetHandler::~OutboundTargetHandler ( ) [virtual]

Definition at line 21 of file OutboundTargetHandler.cxx.

{
}

Member Function Documentation

Processor::processor_action_t repro::OutboundTargetHandler::process ( RequestContext rc) [virtual]

RjS! This doesn't look exception safe - need guards

Implements repro::Processor.

Definition at line 26 of file OutboundTargetHandler.cxx.

{
   resip::Message* msg = rc.getCurrentEvent();
   ResponseContext& rsp = rc.getResponseContext();
   if(!msg)
   {
      return Processor::Continue;
   }

   // !bwc! Check to see whether we need to move on to another reg-id
   resip::SipMessage* sip = dynamic_cast<resip::SipMessage*>(msg);
   if(sip && sip->isResponse() && sip->header(resip::h_StatusLine).responseCode() > 299)
   {
      const resip::Data& tid=sip->getTransactionId();
      DebugLog(<<"Looking for tid " << tid);
      Target* target = rsp.getTarget(tid);
      assert(target);
      OutboundTarget* ot = dynamic_cast<OutboundTarget*>(target);
      if(ot)
      {
         int flowDeadCode;
         if(resip::InteropHelper::getOutboundVersion() >= 5)
         {
            flowDeadCode=430;
         }
         else
         {
            flowDeadCode=410;
         }
         if(sip->header(resip::h_StatusLine).responseCode()==flowDeadCode ||  // Remote or locally(stack) generate 430
            (sip->getReceivedTransport() == 0 &&
             (sip->header(resip::h_StatusLine).responseCode()==408 ||         // Locally (stack) generated 408 or 503
              sip->header(resip::h_StatusLine).responseCode()==503)))
         {
            // Flow is dead remove contact from Location Database
            resip::Uri inputUri(ot->getAor());

            //!RjS! This doesn't look exception safe - need guards
            mRegStore.lockRecord(inputUri);
            mRegStore.removeContact(inputUri,ot->rec());
            mRegStore.unlockRecord(inputUri);

            std::auto_ptr<Target> newTarget(ot->nextInstance());
            if(newTarget.get())
            {
               // Try next reg-id
               rsp.addTarget(newTarget);
               return Processor::SkipAllChains;
            }
         }
      }
   }

   return Processor::Continue;
}

Member Data Documentation

Definition at line 19 of file OutboundTargetHandler.hxx.


The documentation for this class was generated from the following files: