reSIProcate/DialogUsageManager  9694
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends
resip::DialogEventStateManager Class Reference

Implements the FSM for dialog state as spec'd in RFC 4235. More...

#include <DialogEventStateManager.hxx>

Collaboration diagram for resip::DialogEventStateManager:
Collaboration graph
[legend]

List of all members.

Classes

class  DialogIdComparator

Public Types

typedef std::vector
< DialogEventInfo
DialogEventInfos

Public Member Functions

DialogEventInfos getDialogEventInfo () const
virtual ~DialogEventStateManager ()

Private Member Functions

 DialogEventStateManager ()
void onTryingUas (Dialog &dialog, const SipMessage &invite)
void onTryingUac (DialogSet &dialogSet, const SipMessage &invite)
void onProceedingUac (const DialogSet &dialogSet, const SipMessage &response)
void onEarly (const Dialog &dialog, InviteSessionHandle is)
void onConfirmed (const Dialog &dialog, InviteSessionHandle is)
void onTerminated (const Dialog &dialog, const SipMessage &msg, InviteSessionHandler::TerminatedReason reason)
void onTerminated (const DialogSet &dialogSet, const SipMessage &msg, InviteSessionHandler::TerminatedReason reason)
DialogEventInfofindOrCreateDialogInfo (const Dialog &dialog)
void onDialogSetTerminatedImpl (const DialogSetId &dialogSetId, const SipMessage &msg, InviteSessionHandler::TerminatedReason reason)
TerminatedDialogEventonDialogTerminatedImpl (DialogEventInfo *eventInfo, InviteSessionHandler::TerminatedReason reason, int responseCode=0, Uri *remoteTarget=NULL)
 DialogEventStateManager (const DialogEventStateManager &orig)

Static Private Member Functions

static int getResponseCode (const SipMessage &msg)
static UrigetFrontContact (const SipMessage &msg)

Private Attributes

std::map< DialogId,
DialogEventInfo
*, DialogIdComparator
mDialogIdToEventInfo
DialogEventHandlermDialogEventHandler

Friends

class DialogUsageManager
class ServerInviteSession
class ClientInviteSession
class InviteSession
class DialogSet

Detailed Description

Implements the FSM for dialog state as spec'd in RFC 4235.

Called from DialogSet, ClientInviteSession, and ServerInviteSession.

Definition at line 17 of file DialogEventStateManager.hxx.


Member Typedef Documentation

Definition at line 20 of file DialogEventStateManager.hxx.


Constructor & Destructor Documentation

resip::DialogEventStateManager::~DialogEventStateManager ( ) [virtual]

Definition at line 15 of file DialogEventStateManager.cxx.

{
}
resip::DialogEventStateManager::DialogEventStateManager ( ) [private]

Definition at line 10 of file DialogEventStateManager.cxx.

resip::DialogEventStateManager::DialogEventStateManager ( const DialogEventStateManager orig) [private]

Member Function Documentation

DialogEventInfo * resip::DialogEventStateManager::findOrCreateDialogInfo ( const Dialog dialog) [private]

cases: 1) INVITE/180 (no tag)/183 (tag) 2) INVITE/180 (tag) 3) INVITE/180 (tag #1)/180 (tag #2)

Definition at line 363 of file DialogEventStateManager.cxx.

References DebugLog, resip::Data::Empty, resip::DialogId::getDialogSetId(), resip::Dialog::getId(), resip::Dialog::getRemoteNameAddr(), resip::Dialog::getRemoteTarget(), resip::Dialog::getRouteSet(), resip::Timer::getTimeSecs(), resip::Random::getVersion4UuidUrn(), resip::DialogEventInfo::mCreationTimeSeconds, resip::DialogEventInfo::mDialogEventId, resip::DialogEventInfo::mDialogId, mDialogIdToEventInfo, resip::DialogEventInfo::mRemoteIdentity, resip::DialogEventInfo::mRemoteTarget, resip::DialogEventInfo::mRouteSet, and resip::NameAddr::uri().

Referenced by onConfirmed(), and onEarly().

{
   DialogEventInfo* eventInfo = NULL;

   std::map<DialogId, DialogEventInfo*, DialogIdComparator>::iterator it = mDialogIdToEventInfo.find(dialog.getId());

   if (it != mDialogIdToEventInfo.end())
   {
      return it->second;
   }
   else
   {
      // either we have a dialog set id with an empty remote tag, or we have other dialog(s) with different
      // remote tag(s)
      DialogId fakeId(dialog.getId().getDialogSetId(), Data::Empty);
      it = mDialogIdToEventInfo.lower_bound(fakeId);

      if (it != mDialogIdToEventInfo.end() && 
            it->first.getDialogSetId() == dialog.getId().getDialogSetId())
      {
         if (it->first.getRemoteTag().empty())
         {
            // convert this bad boy into a full on Dialog
            eventInfo = it->second;
            mDialogIdToEventInfo.erase(it);
            eventInfo->mDialogId = dialog.getId();
         }
         else
         {
            // clone this fellow member dialog, initializing it with a new id and creation time 
            DialogEventInfo* newForkInfo = new DialogEventInfo(*(it->second));
            newForkInfo->mDialogEventId = Random::getVersion4UuidUrn();
               newForkInfo->mCreationTimeSeconds = Timer::getTimeSecs();
            newForkInfo->mDialogId = dialog.getId();
            newForkInfo->mRemoteIdentity = dialog.getRemoteNameAddr();
            newForkInfo->mRemoteTarget = std::auto_ptr<Uri>(new Uri(dialog.getRemoteTarget().uri()));
            newForkInfo->mRouteSet = dialog.getRouteSet();
            eventInfo = newForkInfo;
         }
      }
      else
      {
         // .jjg. this can happen if onTryingUax(..) wasn't called yet for this dialog (set) id
         DebugLog(<< "DialogSetId " << fakeId << " was not found! This indicates a bug; onTryingUax() should have been called first!");
         return 0;
      }
   }

   mDialogIdToEventInfo[dialog.getId()] = eventInfo;

   return eventInfo;
}

Here is the call graph for this function:

DialogEventStateManager::DialogEventInfos resip::DialogEventStateManager::getDialogEventInfo ( ) const

Definition at line 351 of file DialogEventStateManager.cxx.

References mDialogIdToEventInfo.

{
   DialogEventStateManager::DialogEventInfos infos;
   std::map<DialogId, DialogEventInfo*, DialogIdComparator>::const_iterator it = mDialogIdToEventInfo.begin();
   for (; it != mDialogIdToEventInfo.end(); it++)
   {
      infos.push_back(*(it->second));
   }
   return infos;
}
Uri * resip::DialogEventStateManager::getFrontContact ( const SipMessage msg) [static, private]

Definition at line 334 of file DialogEventStateManager.cxx.

References resip::SipMessage::empty(), resip::SipMessage::header(), resip::SipMessage::isResponse(), resip::LazyParser::isWellFormed(), and resip::RequestLine::uri().

Referenced by onDialogSetTerminatedImpl(), and onTerminated().

{
   Uri* pContact = NULL;
   if (msg.isResponse())
   {
      if (!msg.empty(h_Contacts))
      {
         // ?bwc? Has something already checked for well-formedness here? 
         // Maybe DialogSet? Assert for now.
         assert(msg.header(h_Contacts).front().isWellFormed());
         pContact = new Uri(msg.header(h_Contacts).front().uri());
      }
   }
   return pContact;
}

Here is the call graph for this function:

int resip::DialogEventStateManager::getResponseCode ( const SipMessage msg) [static, private]

Definition at line 323 of file DialogEventStateManager.cxx.

References h_StatusLine, resip::SipMessage::header(), and resip::SipMessage::isResponse().

Referenced by onDialogSetTerminatedImpl(), and onTerminated().

{
   int respCode = 0;
   if (msg.isResponse())
   {
      respCode = msg.header(h_StatusLine).responseCode();
   }
   return respCode;
}

Here is the call graph for this function:

void resip::DialogEventStateManager::onConfirmed ( const Dialog dialog,
InviteSessionHandle  is 
) [private]

Definition at line 173 of file DialogEventStateManager.cxx.

References resip::DialogEventInfo::Confirmed, resip::DialogEventInfo::Early, resip::Data::Empty, findOrCreateDialogInfo(), resip::DialogId::getDialogSetId(), resip::Dialog::getId(), resip::Dialog::getLocalContact(), resip::Dialog::getRemoteTarget(), resip::Dialog::getRouteSet(), mDialogEventHandler, mDialogIdToEventInfo, resip::DialogEventInfo::mInviteSession, resip::DialogEventInfo::mLocalTarget, resip::DialogEventInfo::mRemoteTarget, resip::DialogEventInfo::mRouteSet, resip::DialogEventInfo::mState, resip::DialogEventHandler::onConfirmed(), onDialogTerminatedImpl(), resip::DialogEventHandler::onMultipleEvents(), resip::DialogEventInfo::Proceeding, resip::InviteSessionHandler::RemoteCancel, and resip::NameAddr::uri().

Referenced by resip::ClientInviteSession::onConnectedAspect(), resip::DialogUsageManager::send(), and resip::ServerInviteSession::sendAccept().

{
   DialogEventInfo* eventInfo = findOrCreateDialogInfo(dialog);

   if (eventInfo)
   {
      eventInfo->mInviteSession = is;
      eventInfo->mRouteSet = dialog.getRouteSet(); // won't change due to re-INVITEs, but is
                                                   // needed for the Trying --> Confirmed transition
      eventInfo->mState = DialogEventInfo::Confirmed;

      // local or remote target might change due to an UPDATE or re-INVITE
      eventInfo->mLocalTarget = dialog.getLocalContact().uri();   // !slg! TODO - fix me - the Dialog stored local contact has an empty hostname so that the stack will fill it in
      eventInfo->mRemoteTarget = std::auto_ptr<Uri>(new Uri(dialog.getRemoteTarget().uri()));

      // for the dialog that got the 200 OK
      SharedPtr<ConfirmedDialogEvent> confirmedEvt(new ConfirmedDialogEvent(*eventInfo));
      
      //mDialogEventHandler->onConfirmed(confirmedEvt);
      MultipleEventDialogEvent::EventVector events;

      // kill off any other dialogs in this dialog set, since certain proxy/registrars (like SER and sipX)
      // won't bother giving us updates on their status anyways!
      const DialogSetId& dialogSetId = dialog.getId().getDialogSetId();
      DialogId fakeId(dialogSetId, Data::Empty);
      std::map<DialogId, DialogEventInfo*, DialogIdComparator>::iterator it = mDialogIdToEventInfo.lower_bound(fakeId);
      while (it != mDialogIdToEventInfo.end() && 
            it->first.getDialogSetId() == dialogSetId)
      {
         DialogEventInfo::State dialogState = it->second->getState();
         if (dialogState == DialogEventInfo::Proceeding || dialogState == DialogEventInfo::Early)
         {
            // .jjg. we're killing a *specific* dialog *after* the successful completion of the initial INVITE transaction;
            // so just elminate this dialog, not the entire dialogset
            SharedPtr<TerminatedDialogEvent> evt(onDialogTerminatedImpl(it->second, InviteSessionHandler::RemoteCancel));
            events.push_back(evt);
            delete it->second;
            mDialogIdToEventInfo.erase(it++);
         }
         else
         {
            it++;
         }
      }

      if (events.size() > 0)
      {
         events.push_back(confirmedEvt);
         MultipleEventDialogEvent multipleEvt(events);
         mDialogEventHandler->onMultipleEvents(multipleEvt);
      }
      else
      {
         mDialogEventHandler->onConfirmed(*confirmedEvt);
      }
   }
}

Here is the call graph for this function:

void resip::DialogEventStateManager::onDialogSetTerminatedImpl ( const DialogSetId dialogSetId,
const SipMessage msg,
InviteSessionHandler::TerminatedReason  reason 
) [private]

cases: 1) UAC: INVITE/180 (tag #1)/180 (tag #2)/486 (tag #2) 2) UAS: INVITE/100/486 (tag #1) 3) UAS: INVITE/100/180 (tag #1)/486 (tag #1)

Definition at line 265 of file DialogEventStateManager.cxx.

References resip::Data::Empty, getFrontContact(), getResponseCode(), mDialogEventHandler, mDialogIdToEventInfo, onDialogTerminatedImpl(), and resip::DialogEventHandler::onTerminated().

Referenced by onTerminated().

{
   DialogEventInfo* eventInfo = NULL;

   //find dialogSet.  All non-confirmed dialogs are destroyed by this event.
   //Confirmed dialogs are only destroyed by an exact match.

   DialogId fakeId(dialogSetId, Data::Empty);
   std::map<DialogId, DialogEventInfo*, DialogIdComparator>::iterator it = mDialogIdToEventInfo.lower_bound(fakeId);

   while (it != mDialogIdToEventInfo.end() && 
          it->first.getDialogSetId() == dialogSetId)
   {
      eventInfo = it->second;
      std::auto_ptr<TerminatedDialogEvent> evt(onDialogTerminatedImpl(eventInfo, reason, getResponseCode(msg), getFrontContact(msg)));
      mDialogEventHandler->onTerminated(*evt);
      delete it->second;
      mDialogIdToEventInfo.erase(it++);
   }
}

Here is the call graph for this function:

TerminatedDialogEvent * resip::DialogEventStateManager::onDialogTerminatedImpl ( DialogEventInfo eventInfo,
InviteSessionHandler::TerminatedReason  reason,
int  responseCode = 0,
Uri remoteTarget = NULL 
) [private]

Definition at line 294 of file DialogEventStateManager.cxx.

References resip::DialogEventInfo::mRemoteTarget, resip::DialogEventInfo::mReplaced, resip::DialogEventInfo::mState, resip::InviteSessionHandler::Replaced, and resip::DialogEventInfo::Terminated.

Referenced by onConfirmed(), onDialogSetTerminatedImpl(), and onTerminated().

{
   eventInfo->mState = DialogEventInfo::Terminated;

   // .jjg. when we get an INVITE w/Replaces, we mark the replaced dialog event info 
   // as 'replaced' (see onTryingUas);
   // when the replaced dialog is ended, it will be ended normally with a BYE or CANCEL, 
   // but since we've marked it as 'replaced' we can update the termination reason
   InviteSessionHandler::TerminatedReason actualReason = reason;

   if (eventInfo->mReplaced)
   {
      actualReason = InviteSessionHandler::Replaced;
   }

   if (remoteTarget)
   {
      eventInfo->mRemoteTarget = std::auto_ptr<Uri>(remoteTarget);
   }

   TerminatedDialogEvent* evt = new TerminatedDialogEvent(*eventInfo, actualReason, responseCode);
   return evt;
   //mDialogEventHandler->onTerminated(evt);
}
void resip::DialogEventStateManager::onEarly ( const Dialog dialog,
InviteSessionHandle  is 
) [private]

Definition at line 153 of file DialogEventStateManager.cxx.

References resip::DialogEventInfo::Early, findOrCreateDialogInfo(), resip::Dialog::getLocalContact(), resip::Dialog::getRemoteTarget(), resip::Dialog::getRouteSet(), mDialogEventHandler, resip::DialogEventInfo::mInviteSession, resip::DialogEventInfo::mLocalTarget, resip::DialogEventInfo::mRemoteTarget, resip::DialogEventInfo::mRouteSet, resip::DialogEventInfo::mState, resip::DialogEventHandler::onEarly(), and resip::NameAddr::uri().

Referenced by resip::ClientInviteSession::onProvisionalAspect(), and resip::ServerInviteSession::sendProvisional().

{
   DialogEventInfo* eventInfo = findOrCreateDialogInfo(dialog);

   if (eventInfo)
   {
      eventInfo->mState = DialogEventInfo::Early;
      eventInfo->mRouteSet = dialog.getRouteSet();
      eventInfo->mInviteSession = is;

      // local or remote target might change due to an UPDATE or re-INVITE
      eventInfo->mLocalTarget = dialog.getLocalContact().uri();   // !slg! TODO - fix me - the Dialog stored local contact has an empty hostname so that the stack will fill it in
      eventInfo->mRemoteTarget = std::auto_ptr<Uri>(new Uri(dialog.getRemoteTarget().uri()));

      EarlyDialogEvent evt(*eventInfo);
      mDialogEventHandler->onEarly(evt);
   }
}

Here is the call graph for this function:

void resip::DialogEventStateManager::onProceedingUac ( const DialogSet dialogSet,
const SipMessage response 
) [private]

Definition at line 118 of file DialogEventStateManager.cxx.

References resip::Data::Empty, resip::SipMessage::empty(), resip::DialogSet::getId(), resip::SipMessage::header(), resip::LazyParser::isWellFormed(), mDialogEventHandler, mDialogIdToEventInfo, resip::DialogEventInfo::mRemoteTarget, resip::DialogEventInfo::mState, resip::DialogEventHandler::onProceeding(), resip::DialogEventInfo::Proceeding, and resip::RequestLine::uri().

Referenced by resip::DialogSet::dispatch().

{
   DialogId fakeId(dialogSet.getId(), Data::Empty);
   std::map<DialogId, DialogEventInfo*, DialogIdComparator>::iterator it = mDialogIdToEventInfo.lower_bound(fakeId);
   if (it != mDialogIdToEventInfo.end() &&
      it->first.getDialogSetId() == dialogSet.getId())
   {
      if (it->first.getRemoteTag().empty())
      {
         // happy day case; no forks yet; e.g INVITE/1xx (no tag)/1xx (no tag)
         DialogEventInfo* eventInfo = it->second;
         eventInfo->mState = DialogEventInfo::Proceeding;
         if (!response.empty(h_Contacts))
         {
            // ?bwc? Has something already checked for well-formedness here? 
            // Maybe DialogSet? Assert for now.
            assert(response.header(h_Contacts).front().isWellFormed());
            eventInfo->mRemoteTarget = std::auto_ptr<Uri>(new Uri(response.header(h_Contacts).front().uri()));
         }
         ProceedingDialogEvent evt(*eventInfo);
         mDialogEventHandler->onProceeding(evt);
      }
      else
      {
         // forking; e.g. INVITE/180 (tag #1)/180 (no tag)

         // .jjg. The remote sender of the 180 (no tag) should either 'put up or shut up' as Byron put it
         // so we'll just ignore this...
      }
   }
}

Here is the call graph for this function:

void resip::DialogEventStateManager::onTerminated ( const Dialog dialog,
const SipMessage msg,
InviteSessionHandler::TerminatedReason  reason 
) [private]

Definition at line 232 of file DialogEventStateManager.cxx.

References resip::DialogEventInfo::Confirmed, resip::DialogId::getDialogSetId(), getFrontContact(), resip::Dialog::getId(), getResponseCode(), mDialogEventHandler, mDialogIdToEventInfo, onDialogSetTerminatedImpl(), onDialogTerminatedImpl(), and resip::DialogEventHandler::onTerminated().

Referenced by resip::DialogSet::dispatch(), resip::InviteSession::dispatchBye(), resip::ServerInviteSession::dispatchCancel(), resip::DialogSet::end(), resip::DialogSet::handledByAuthOrRedirect(), resip::ClientInviteSession::handleRedirect(), resip::ClientInviteSession::onFailureAspect(), resip::ServerInviteSession::redirect(), and resip::InviteSession::sendBye().

{
   std::map<DialogId, DialogEventInfo*, DialogIdComparator>::iterator it = mDialogIdToEventInfo.find(dialog.getId());
   if (it != mDialogIdToEventInfo.end())
   {
      DialogEventInfo::State dialogState = it->second->getState();
      if (dialogState == DialogEventInfo::Confirmed)
      {
         // .jjg. we're killing a *specific* dialog *after* the successful completion of the initial INVITE transaction;
         // so just elminate this dialog, not the entire dialogset
         std::auto_ptr<TerminatedDialogEvent> evt(onDialogTerminatedImpl(it->second, reason, getResponseCode(msg), getFrontContact(msg)));
         mDialogEventHandler->onTerminated(*evt);
         delete it->second;
         mDialogIdToEventInfo.erase(it++);
      }
      else
      {
         onDialogSetTerminatedImpl(dialog.getId().getDialogSetId(), msg, reason);
      }
   }
   else
   {
      onDialogSetTerminatedImpl(dialog.getId().getDialogSetId(), msg, reason);
   }
}

Here is the call graph for this function:

void resip::DialogEventStateManager::onTerminated ( const DialogSet dialogSet,
const SipMessage msg,
InviteSessionHandler::TerminatedReason  reason 
) [private]

Definition at line 259 of file DialogEventStateManager.cxx.

References resip::DialogSet::getId(), and onDialogSetTerminatedImpl().

{
   onDialogSetTerminatedImpl(dialogSet.getId(), msg, reason);
}

Here is the call graph for this function:

void resip::DialogEventStateManager::onTryingUac ( DialogSet dialogSet,
const SipMessage invite 
) [private]

Definition at line 67 of file DialogEventStateManager.cxx.

References resip::Contents::clone(), resip::SipMessage::empty(), resip::Data::Empty, resip::SipMessage::exists(), resip::SipMessage::getContents(), resip::DialogSet::getId(), resip::Timer::getTimeSecs(), resip::Random::getVersion4UuidUrn(), resip::SipMessage::header(), resip::DialogEventInfo::Initiator, resip::LazyParser::isWellFormed(), resip::DialogEventInfo::mCreationTimeSeconds, mDialogEventHandler, resip::DialogEventInfo::mDialogEventId, resip::DialogEventInfo::mDialogId, mDialogIdToEventInfo, resip::DialogEventInfo::mDirection, resip::DialogEventInfo::mInviteSession, resip::DialogEventInfo::mLocalIdentity, resip::DialogEventInfo::mLocalOfferAnswer, resip::DialogEventInfo::mLocalTarget, resip::DialogEventInfo::mReferredBy, resip::DialogEventInfo::mRemoteIdentity, resip::DialogEventInfo::mState, resip::Handle< InviteSession >::NotValid(), resip::DialogEventHandler::onTrying(), resip::DialogEventInfo::Trying, and resip::RequestLine::uri().

Referenced by resip::DialogUsageManager::send().

{
   DialogId fakeId(dialogSet.getId(), Data::Empty);
   std::map<DialogId, DialogEventInfo*, DialogIdComparator>::iterator it = mDialogIdToEventInfo.find(fakeId);

   DialogEventInfo* eventInfo = 0;

   if (it != mDialogIdToEventInfo.end())
   {
      // .jjg. we will get in here if our INVITE gets challenged; just swallow the onTrying event in this case
      eventInfo = it->second;
      if (eventInfo->mState == DialogEventInfo::Trying)
      {
         return;
      }
   }
   else
   {
      eventInfo = new DialogEventInfo();
   }

   eventInfo->mDialogEventId = Random::getVersion4UuidUrn();
   eventInfo->mDialogId = DialogId(dialogSet.getId(), Data::Empty);
   eventInfo->mDirection = DialogEventInfo::Initiator;
   eventInfo->mCreationTimeSeconds = Timer::getTimeSecs();
   eventInfo->mInviteSession = InviteSessionHandle::NotValid();
   eventInfo->mLocalIdentity = invite.header(h_From);
   // ?bwc? Has something already checked for well-formedness here? 
   // Maybe DialogSet? We need to be absolutely certain that this exists and is
   // well-formed. Assert for now.
   assert(!invite.empty(h_Contacts));
   assert(invite.header(h_Contacts).front().isWellFormed());
   eventInfo->mLocalTarget = invite.header(h_Contacts).front().uri();
   eventInfo->mRemoteIdentity = invite.header(h_To);
   eventInfo->mLocalOfferAnswer = (invite.getContents() != NULL ? std::auto_ptr<Contents>(invite.getContents()->clone()) : std::auto_ptr<Contents>());
   eventInfo->mState = DialogEventInfo::Trying;

   if (invite.exists(h_ReferredBy) &&
         invite.header(h_ReferredBy).isWellFormed())
   {
      eventInfo->mReferredBy = std::auto_ptr<NameAddr>(new NameAddr(invite.header(h_ReferredBy)));
   }

   mDialogIdToEventInfo[eventInfo->mDialogId] = eventInfo;

   TryingDialogEvent evt(*eventInfo, invite);
   mDialogEventHandler->onTrying(evt);
}

Here is the call graph for this function:

void resip::DialogEventStateManager::onTryingUas ( Dialog dialog,
const SipMessage invite 
) [private]

Definition at line 21 of file DialogEventStateManager.cxx.

References resip::Contents::clone(), resip::Data::Empty, resip::SipMessage::exists(), resip::SipMessage::getContents(), resip::Dialog::getId(), resip::Dialog::getLocalContact(), resip::Dialog::getLocalNameAddr(), resip::Dialog::getRemoteNameAddr(), resip::Dialog::getRemoteTarget(), resip::Dialog::getRouteSet(), resip::Timer::getTimeSecs(), resip::Random::getVersion4UuidUrn(), resip::SipMessage::header(), resip::LazyParser::isWellFormed(), resip::DialogEventInfo::mCreationTimeSeconds, mDialogEventHandler, resip::DialogEventInfo::mDialogEventId, resip::DialogEventInfo::mDialogId, mDialogIdToEventInfo, resip::DialogEventInfo::mDirection, resip::DialogEventInfo::mInviteSession, resip::DialogEventInfo::mLocalIdentity, resip::DialogEventInfo::mLocalTarget, resip::DialogEventInfo::mReferredBy, resip::DialogEventInfo::mRemoteIdentity, resip::DialogEventInfo::mRemoteOfferAnswer, resip::DialogEventInfo::mRemoteTarget, resip::DialogEventInfo::mReplacesId, resip::DialogEventInfo::mRouteSet, resip::DialogEventInfo::mState, resip::Handle< InviteSession >::NotValid(), resip::DialogEventHandler::onTrying(), resip::DialogEventInfo::Recipient, resip::DialogEventInfo::Trying, and resip::NameAddr::uri().

Referenced by resip::ServerInviteSession::dispatchStart().

{
   DialogEventInfo* eventInfo = new DialogEventInfo();
   eventInfo->mDialogEventId = Random::getVersion4UuidUrn(); // !jjg! is this right?
   eventInfo->mDialogId = dialog.getId();
   eventInfo->mDirection = DialogEventInfo::Recipient;
   eventInfo->mCreationTimeSeconds = Timer::getTimeSecs();
   eventInfo->mInviteSession = InviteSessionHandle::NotValid();
   eventInfo->mRemoteOfferAnswer = (invite.getContents() != NULL ? std::auto_ptr<Contents>(invite.getContents()->clone()) : std::auto_ptr<Contents>());
   eventInfo->mLocalIdentity = dialog.getLocalNameAddr();
   eventInfo->mLocalTarget = dialog.getLocalContact().uri();  // !slg! TODO - fix me - the Dialog stored local contact has an empty hostname so that the stack will fill it in
   eventInfo->mRemoteIdentity = dialog.getRemoteNameAddr();
   eventInfo->mRemoteTarget = std::auto_ptr<Uri>(new Uri(dialog.getRemoteTarget().uri()));
   eventInfo->mRouteSet = dialog.getRouteSet();
   eventInfo->mState = DialogEventInfo::Trying;

   if (invite.exists(h_Replaces) &&
         invite.header(h_Replaces).isWellFormed())
   {
      Data replacesToTag = invite.header(h_Replaces).exists(p_toTag) ? invite.header(h_Replaces).param(p_toTag) : Data::Empty;
      Data replacesFromTag = invite.header(h_Replaces).exists(p_fromTag) ? invite.header(h_Replaces).param(p_fromTag) : Data::Empty;

      eventInfo->mReplacesId = std::auto_ptr<DialogId>(new DialogId(invite.header(h_Replaces).value(), 
         replacesToTag,
         replacesFromTag));

      std::map<DialogId, DialogEventInfo*, DialogIdComparator>::iterator it = mDialogIdToEventInfo.find(*(eventInfo->mReplacesId));
      if (it != mDialogIdToEventInfo.end())
      {
         it->second->mReplaced = true;
      }
   }
   if (invite.exists(h_ReferredBy) && 
         invite.header(h_ReferredBy).isWellFormed())
   {
      eventInfo->mReferredBy = std::auto_ptr<NameAddr>(new NameAddr(invite.header(h_ReferredBy)));
   }

   mDialogIdToEventInfo[dialog.getId()] = eventInfo;

   TryingDialogEvent evt(*eventInfo, invite);
   mDialogEventHandler->onTrying(evt);
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class ClientInviteSession [friend]

Definition at line 75 of file DialogEventStateManager.hxx.

friend class DialogSet [friend]

Definition at line 77 of file DialogEventStateManager.hxx.

friend class DialogUsageManager [friend]

Definition at line 73 of file DialogEventStateManager.hxx.

friend class InviteSession [friend]

Definition at line 76 of file DialogEventStateManager.hxx.

friend class ServerInviteSession [friend]

Definition at line 74 of file DialogEventStateManager.hxx.


Member Data Documentation


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