reSIProcate/stack  9694
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends
resip::DeprecatedDialog Class Reference

#include <DeprecatedDialog.hxx>

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

List of all members.

Classes

class  Exception

Public Member Functions

 DeprecatedDialog (const NameAddr &localContact)
SipMessagemakeResponse (const SipMessage &request, int code=200)
void createDialogAsUAC (const SipMessage &response)
void targetRefreshResponse (const SipMessage &response)
int targetRefreshRequest (const SipMessage &request)
void updateRequest (SipMessage &msg)
void makeResponse (const SipMessage &request, SipMessage &response, int code=200)
bool isCreated () const
bool isEarly () const
const Data dialogId () const
const CallIDgetCallId () const
const NameAddrgetRemoteTarget () const
const DatagetRemoteTag () const
SipMessagemakeInitialRegister (const NameAddr &registrar, const NameAddr &from)
SipMessagemakeInitialSubscribe (const NameAddr &target, const NameAddr &from)
SipMessagemakeInitialPublish (const NameAddr &target, const NameAddr &from)
SipMessagemakeInitialInvite (const NameAddr &target, const NameAddr &from)
SipMessagemakeInitialMessage (const NameAddr &target, const NameAddr &from)
SipMessagemakeInvite ()
SipMessagemakeUpdate ()
SipMessagemakeRegister ()
SipMessagemakeSubscribe ()
SipMessagemakeBye ()
SipMessagemakeRefer (const NameAddr &referTo)
SipMessagemakeNotify ()
SipMessagemakeOptions ()
SipMessagemakePublish ()
SipMessagemakeAck ()
SipMessagemakeAck (const SipMessage &request)
SipMessagemakeCancel (const SipMessage &request)
SipMessagemakeRequest (MethodTypes method)
CallID makeReplaces ()
void clear ()
void setExpirySeconds (int secondsInFuture)
int getExpirySeconds ()

Static Public Member Functions

static Data dialogId (const SipMessage &msg)

Private Member Functions

SipMessagemakeRequestInternal (MethodTypes method)
void incrementCSeq (SipMessage &request)
void copyCSeq (SipMessage &request)

Private Attributes

NameAddr mContact
bool mCreated
bool mEarly
Uri mRequestUri
NameAddrs mRouteSet
NameAddr mRemoteTarget
unsigned long mRemoteSequence
bool mRemoteEmpty
unsigned long mLocalSequence
bool mLocalEmpty
CallID mCallId
Data mLocalTag
Data mRemoteTag
CallID mDialogId
NameAddr mRemoteUri
NameAddr mLocalUri
bool secure
UInt64 expireyTimeAbsoluteMs

Friends

EncodeStreamoperator<< (EncodeStream &, const DeprecatedDialog &)

Detailed Description

Definition at line 19 of file DeprecatedDialog.hxx.


Constructor & Destructor Documentation

DeprecatedDialog::DeprecatedDialog ( const NameAddr localContact)

Definition at line 20 of file DeprecatedDialog.cxx.

   : mContact(localContact),
     mCreated(false),
     mEarly(false),
     mRouteSet(),
     mRemoteTarget(),
     mRemoteSequence(0),
     mRemoteEmpty(true),
     mLocalSequence(0),
     mLocalEmpty(true),
     mCallId(),
     mLocalTag(),
     mRemoteTag(),
     mRemoteUri(),
     mLocalUri()
{
    // .kw. members "secure" and "expireyTimeAbsoluteMs" are not initialized!
}

Member Function Documentation

void DeprecatedDialog::clear ( void  )
void DeprecatedDialog::copyCSeq ( SipMessage request) [private]

Definition at line 673 of file DeprecatedDialog.cxx.

References resip::SipMessage::header(), mLocalEmpty, and mLocalSequence.

Referenced by makeAck(), makeRequestInternal(), and updateRequest().

{
   if (mLocalEmpty)
   {
      mLocalSequence = 1;
      mLocalEmpty = false;
   }
   request.header(h_CSeq).sequence() = mLocalSequence;
}

Here is the call graph for this function:

void DeprecatedDialog::createDialogAsUAC ( const SipMessage response)

Definition at line 108 of file DeprecatedDialog.cxx.

References DebugLog, resip::SipMessage::exists(), resip::SipMessage::header(), InfoLog, resip::SipMessage::isRequest(), resip::SipMessage::isResponse(), mCallId, mCreated, mDialogId, mEarly, resip::RequestLine::method(), mLocalEmpty, mLocalSequence, mLocalTag, mLocalUri, mRemoteEmpty, mRemoteSequence, mRemoteTag, mRemoteTarget, mRemoteUri, mRouteSet, resip::ParserCategory::param(), and targetRefreshResponse().

Referenced by Loadgen::InviteClient::go(), performTest(), Client::process(), resip::TuIM::processRegisterResponse(), resip::TuIM::processSubscribeResponse(), and Client::thread().

{
   if (!mCreated)
   {
      if(msg.isResponse())
      {
         const SipMessage& response = msg;

         int code = response.header(h_StatusLine).statusCode();
         mEarly = (code > 100 && code < 200);
         
         if (code >= 200 && code < 300)
         {
            if (!response.exists(h_Contacts) || response.header(h_Contacts).size() != 1)
            {
               InfoLog (<< "Response doesn't have a contact header or more than one contact, so can't create dialog");
               DebugLog (<< response);
               throw Exception("Invalid or missing contact header in message", __FILE__,__LINE__);
            }
         }
         
         // reverse order from response
         if (response.exists(h_RecordRoutes))
         {
            mRouteSet = response.header(h_RecordRoutes).reverse();
         }
         
         if (response.exists(h_Contacts) && !response.header(h_Contacts).empty())
         {
            mRemoteTarget = response.header(h_Contacts).front();
         }
         
         mRemoteSequence = 0;
         mRemoteEmpty = true;
         mLocalSequence = response.header(h_CSeq).sequence();
         mLocalEmpty = false;
         mCallId = response.header(h_CallId);
         if ( response.header(h_From).exists(p_tag) ) // 2543 compat
         {
            mLocalTag = response.header(h_From).param(p_tag);  
         }
         if ( response.header(h_To).exists(p_tag) )  // 2543 compat
         {
            mRemoteTag = response.header(h_To).param(p_tag); 
         }
         mRemoteUri = response.header(h_To);
         mLocalUri = response.header(h_From);

         mDialogId = mCallId;
         mDialogId.param(p_toTag) = mLocalTag;
         mDialogId.param(p_fromTag) = mRemoteTag;

         mCreated = true;
      }
      else if (msg.isRequest() && msg.header(h_CSeq).method() == NOTIFY)
      {
         const SipMessage& notify = msg;
         if (notify.exists(h_RecordRoutes))
         {
            mRouteSet = notify.header(h_RecordRoutes);
         }
      
         if (!notify.exists(h_Contacts) && notify.header(h_Contacts).size() != 1)
         {
            InfoLog (<< "Notify doesn't have a contact header or more than one contact, so can't create dialog");
            DebugLog (<< notify);
            throw Exception("Invalid or missing contact header in notify", __FILE__,__LINE__);
         }

         mRemoteTarget = notify.header(h_Contacts).front();
         mRemoteSequence = notify.header(h_CSeq).sequence();
         mRemoteEmpty = false;
         mLocalSequence = 0;
         mLocalEmpty = true;
         mCallId = notify.header(h_CallId);
         if (notify.header(h_To).exists(p_tag))
         {
            mLocalTag = notify.header(h_To).param(p_tag); 
         }
         if (notify.header(h_From).exists(p_tag))  // 2543 compat
         {
            mRemoteTag = notify.header(h_From).param(p_tag); 
         }
      
         mRemoteUri = notify.header(h_From);
         mLocalUri = notify.header(h_To);

         mDialogId = mCallId;
         mDialogId.param(p_toTag) = mLocalTag;
         mDialogId.param(p_fromTag) = mRemoteTag;

         mCreated = true;
         mEarly = false;
      }
   }
   else if (msg.isResponse())
   {
      mEarly = (msg.header(h_StatusLine).statusCode() < 200 && 
                msg.header(h_StatusLine).statusCode() > 100);

      // don't update target for register since contact is not a target
      if ( msg.header(h_CSeq).method() != REGISTER )
      {
         targetRefreshResponse(msg);
      }
   }
}

Here is the call graph for this function:

Data DeprecatedDialog::dialogId ( const SipMessage msg) [static]

Definition at line 713 of file DeprecatedDialog.cxx.

References resip::Data::from(), resip::SipMessage::header(), resip::SipMessage::isExternal(), resip::SipMessage::isRequest(), resip::SipMessage::isResponse(), and resip::ParserCategory::param().

{
   CallID id(msg.header(h_CallId));
   if ((msg.isRequest() && msg.isExternal()) ||
       (msg.isResponse() && !msg.isExternal()))
   {
      if (msg.header(h_To).exists(p_tag))
      {
         id.param(p_toTag) = msg.header(h_To).param(p_tag);
      }
      if (msg.header(h_From).exists(p_tag))
      {
         id.param(p_fromTag) = msg.header(h_From).param(p_tag);
      }
   }
   else
   {
      if (msg.header(h_From).exists(p_tag))
      {
         id.param(p_toTag) = msg.header(h_From).param(p_tag);
      }
      if (msg.header(h_To).exists(p_tag))
      {
         id.param(p_fromTag) = msg.header(h_To).param(p_tag);
      }
   }
   return Data::from(id);
}

Here is the call graph for this function:

const Data DeprecatedDialog::dialogId ( ) const

Definition at line 744 of file DeprecatedDialog.cxx.

References resip::Data::from(), and mDialogId.

{
   return Data::from(mDialogId);
}

Here is the call graph for this function:

const CallID& resip::DeprecatedDialog::getCallId ( ) const [inline]

Definition at line 67 of file DeprecatedDialog.hxx.

References mCallId.

Referenced by resip::TuIM::processResponse(), and resip::TuIM::processSubscribeRequest().

{ return mCallId; }
int DeprecatedDialog::getExpirySeconds ( )

Definition at line 758 of file DeprecatedDialog.cxx.

References expireyTimeAbsoluteMs, and resip::Timer::getTimeMs().

Referenced by resip::TuIM::sendNotify().

{
        // !cj! TODO - may be bugs here when result is negative 
   UInt64 delta = ( expireyTimeAbsoluteMs - Timer::getTimeMs() )/1000;

   int ret = (int)delta;
   return ret;
}

Here is the call graph for this function:

const Data& resip::DeprecatedDialog::getRemoteTag ( ) const [inline]

Definition at line 70 of file DeprecatedDialog.hxx.

References mRemoteTag.

{ return mRemoteTag; }
const NameAddr& resip::DeprecatedDialog::getRemoteTarget ( ) const [inline]

Definition at line 68 of file DeprecatedDialog.hxx.

References mRemoteTarget.

{ return mRemoteTarget; }
void DeprecatedDialog::incrementCSeq ( SipMessage request) [private]

Definition at line 684 of file DeprecatedDialog.cxx.

References resip::SipMessage::header(), mLocalEmpty, and mLocalSequence.

Referenced by makeBye(), makeInvite(), makeNotify(), makeOptions(), makePublish(), makeRefer(), makeRegister(), makeRequest(), makeSubscribe(), makeUpdate(), and updateRequest().

{
   if (mLocalEmpty)
   {
      mLocalSequence = 1;
      mLocalEmpty = false;
   }
   //DebugLog ( << "mLocalSequence: " << mLocalSequence);
   request.header(h_CSeq).sequence() = ++mLocalSequence;
}

Here is the call graph for this function:

bool resip::DeprecatedDialog::isCreated ( ) const [inline]

Definition at line 62 of file DeprecatedDialog.hxx.

References mCreated.

Referenced by resip::TuIM::process().

{ return mCreated; }
bool resip::DeprecatedDialog::isEarly ( ) const [inline]

Definition at line 63 of file DeprecatedDialog.hxx.

References mEarly.

{ return mEarly; }
SipMessage * DeprecatedDialog::makeAck ( )

Definition at line 577 of file DeprecatedDialog.cxx.

References copyCSeq(), and makeRequestInternal().

Referenced by Loadgen::InviteClient::go(), performTest(), Client::process(), and Client::thread().

{
   SipMessage* request = makeRequestInternal(ACK);
   copyCSeq(*request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeAck ( const SipMessage request)

Definition at line 555 of file DeprecatedDialog.cxx.

References copyCSeq(), resip::SipMessage::exists(), resip::SipMessage::header(), and makeRequestInternal().

{
   SipMessage* request = makeRequestInternal(ACK);
   copyCSeq(*request);

   // !dcm! should we copy the authorizations? 
   // !jf! will this do the right thing if these headers weren't in original 
   // we should be able to store this stuff in the DeprecatedDialog and not need to pass
   // in the original
   if (original.exists(h_ProxyAuthorizations))
   {
      request->header(h_ProxyAuthorizations) = original.header(h_ProxyAuthorizations);
   }
   if (original.exists(h_Authorizations))
   {    
      request->header(h_Authorizations) = original.header(h_Authorizations);
   }
   request->header(h_CSeq).sequence() = original.header(h_CSeq).sequence();
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeBye ( )

Definition at line 499 of file DeprecatedDialog.cxx.

References incrementCSeq(), and makeRequestInternal().

Referenced by Loadgen::InviteClient::go(), performTest(), Client::process(), and Client::thread().

{
   SipMessage* request = makeRequestInternal(BYE);
   incrementCSeq(*request);

   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeCancel ( const SipMessage request)

Definition at line 585 of file DeprecatedDialog.cxx.

References resip::RequestLine::getMethod(), resip::SipMessage::header(), and resip::RequestLine::method().

{
   assert (request.header(h_Vias).size() >= 1);
   assert (request.header(h_RequestLine).getMethod() == INVITE);
   
   SipMessage* cancel = new SipMessage;
   
   cancel->header(h_RequestLine) = request.header(h_RequestLine);
   cancel->header(h_RequestLine).method() = CANCEL;
   
   cancel->header(h_CallId) = request.header(h_CallId);
   cancel->header(h_To) = request.header(h_To); 
   cancel->header(h_From) = request.header(h_From);
   cancel->header(h_CSeq) = request.header(h_CSeq);
   cancel->header(h_CSeq).method() = CANCEL;
   cancel->header(h_Vias).push_back(request.header(h_Vias).front());
   
   return cancel;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeInitialInvite ( const NameAddr target,
const NameAddr from 
)

Definition at line 444 of file DeprecatedDialog.cxx.

References resip::SipMessage::const_header(), makeInvite(), mCallId, mContact, mLocalEmpty, mLocalSequence, mLocalTag, mLocalUri, mRemoteUri, mRequestUri, and resip::RequestLine::uri().

{
   SipMessage* msg = Helper::makeInvite( target, from, mContact );
   assert( msg );

   mRequestUri = msg->const_header(h_RequestLine).uri();
   mLocalEmpty = false;
   mLocalSequence = msg->const_header(h_CSeq).sequence();
   mCallId = msg->const_header(h_CallId);
   assert(msg->const_header(h_From).exists(p_tag));
   mLocalTag = msg->const_header(h_From).param(p_tag);  
   mRemoteUri = msg->const_header(h_To);
   mLocalUri = msg->const_header(h_From);
   
   return msg;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeInitialMessage ( const NameAddr target,
const NameAddr from 
)

Definition at line 425 of file DeprecatedDialog.cxx.

References resip::SipMessage::const_header(), resip::Helper::makeMessage(), mCallId, mContact, mLocalEmpty, mLocalSequence, mLocalTag, mLocalUri, mRemoteUri, mRequestUri, and resip::RequestLine::uri().

Referenced by resip::TuIM::sendPage().

{
   SipMessage* msg = Helper::makeMessage( target, from, mContact );
   assert( msg );

   mRequestUri = msg->const_header(h_RequestLine).uri();
   mLocalEmpty = false;
   mLocalSequence = msg->const_header(h_CSeq).sequence();
   mCallId = msg->const_header(h_CallId);
   assert(msg->const_header(h_From).exists(p_tag));
   mLocalTag = msg->const_header(h_From).param(p_tag);  
   mRemoteUri = msg->const_header(h_To);
   mLocalUri = msg->const_header(h_From);
   
   return msg;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeInitialPublish ( const NameAddr target,
const NameAddr from 
)

Definition at line 406 of file DeprecatedDialog.cxx.

References resip::SipMessage::const_header(), makePublish(), mCallId, mContact, mLocalEmpty, mLocalSequence, mLocalTag, mLocalUri, mRemoteUri, mRequestUri, and resip::RequestLine::uri().

Referenced by resip::TuIM::sendPublish().

{
   SipMessage* msg = Helper::makePublish( target, from, mContact );
   assert( msg );

   mRequestUri = msg->const_header(h_RequestLine).uri();
   mLocalEmpty = false;
   mLocalSequence = msg->const_header(h_CSeq).sequence();
   mCallId = msg->const_header(h_CallId);
   assert(msg->const_header(h_From).exists(p_tag));
   mLocalTag = msg->const_header(h_From).param(p_tag);  
   mRemoteUri = msg->const_header(h_To);
   mLocalUri = msg->const_header(h_From);
   
   return msg;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeInitialRegister ( const NameAddr registrar,
const NameAddr from 
)

Definition at line 365 of file DeprecatedDialog.cxx.

References resip::SipMessage::const_header(), makeRegister(), mCallId, mContact, mCreated, mLocalEmpty, mLocalSequence, mLocalTag, mLocalUri, mRemoteTarget, mRemoteUri, mRequestUri, and resip::RequestLine::uri().

Referenced by resip::TuIM::registerAor().

{
   SipMessage* msg = Helper::makeRegister( registrar, aor, mContact );
   assert( msg );

   mRequestUri = msg->const_header(h_RequestLine).uri();
   mLocalEmpty = false;
   mLocalSequence = msg->const_header(h_CSeq).sequence();
   mCallId = msg->const_header(h_CallId);
   assert(msg->const_header(h_From).exists(p_tag));
   mLocalTag = msg->const_header(h_From).param(p_tag);  
   mRemoteUri = msg->const_header(h_To);
   mLocalUri = msg->const_header(h_From);
   mCreated = true;
   
   mRemoteTarget = mRemoteUri;
   
   return msg;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeInitialSubscribe ( const NameAddr target,
const NameAddr from 
)

Definition at line 387 of file DeprecatedDialog.cxx.

References resip::SipMessage::const_header(), makeSubscribe(), mCallId, mContact, mLocalEmpty, mLocalSequence, mLocalTag, mLocalUri, mRemoteUri, mRequestUri, and resip::RequestLine::uri().

Referenced by resip::TuIM::subscribeBuddy().

{
   SipMessage* msg = Helper::makeSubscribe( target, from, mContact );
   assert( msg );

   mRequestUri = msg->const_header(h_RequestLine).uri();
   mLocalEmpty = false;
   mLocalSequence = msg->const_header(h_CSeq).sequence();
   mCallId = msg->const_header(h_CallId);
   assert(msg->const_header(h_From).exists(p_tag));
   mLocalTag = msg->const_header(h_From).param(p_tag);  
   mRemoteUri = msg->const_header(h_To);
   mLocalUri = msg->const_header(h_From);
   
   return msg;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeInvite ( )

Definition at line 463 of file DeprecatedDialog.cxx.

References DebugLog, incrementCSeq(), and makeRequestInternal().

Referenced by makeInitialInvite().

{
   SipMessage* request = makeRequestInternal(INVITE);
   incrementCSeq(*request);
   DebugLog(<< "DeprecatedDialog::makeInvite: " << *request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeNotify ( )

Definition at line 519 of file DeprecatedDialog.cxx.

References incrementCSeq(), and makeRequestInternal().

Referenced by resip::TuIM::sendNotify().

{
   SipMessage* request = makeRequestInternal(NOTIFY);
   incrementCSeq(*request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeOptions ( )

Definition at line 528 of file DeprecatedDialog.cxx.

References incrementCSeq(), and makeRequestInternal().

{
   SipMessage* request = makeRequestInternal(OPTIONS);
   incrementCSeq(*request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makePublish ( )

Definition at line 536 of file DeprecatedDialog.cxx.

References incrementCSeq(), and makeRequestInternal().

Referenced by makeInitialPublish().

{
   SipMessage* request = makeRequestInternal(PUBLISH);
   incrementCSeq(*request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeRefer ( const NameAddr referTo)

Definition at line 509 of file DeprecatedDialog.cxx.

References resip::SipMessage::header(), incrementCSeq(), makeRequestInternal(), and mLocalUri.

{
   SipMessage* request = makeRequestInternal(REFER);
   request->header(h_ReferTo) = referTo;
   request->header(h_ReferredBy) = mLocalUri;
   incrementCSeq(*request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeRegister ( )

Definition at line 481 of file DeprecatedDialog.cxx.

References DebugLog, incrementCSeq(), and makeRequestInternal().

Referenced by makeInitialRegister(), resip::TuIM::process(), and resip::TuIM::processRegisterResponse().

{
   SipMessage* request = makeRequestInternal(REGISTER);
   incrementCSeq(*request);
   DebugLog(<< "DeprecatedDialog::makeRegister: " << *request);
   return request;
}

Here is the call graph for this function:

CallId DeprecatedDialog::makeReplaces ( )

Definition at line 607 of file DeprecatedDialog.cxx.

References mDialogId.

{
   return mDialogId;
}
SipMessage * DeprecatedDialog::makeRequest ( resip::MethodTypes  method)

Definition at line 544 of file DeprecatedDialog.cxx.

References incrementCSeq(), and makeRequestInternal().

{
   assert(method != ACK);
   assert(method != CANCEL);
   
   SipMessage* request = makeRequestInternal(method);
   incrementCSeq(*request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeRequestInternal ( MethodTypes  method) [private]

Definition at line 632 of file DeprecatedDialog.cxx.

References copyCSeq(), resip::Data::empty(), resip::SipMessage::header(), mCallId, mContact, mCreated, resip::RequestLine::method(), mLocalTag, mLocalUri, mRemoteTag, mRemoteTarget, mRemoteUri, mRequestUri, mRouteSet, resip::ParserCategory::param(), resip::Helper::processStrictRoute(), resip::RequestLine::uri(), and resip::NameAddr::uri().

Referenced by makeAck(), makeBye(), makeInvite(), makeNotify(), makeOptions(), makePublish(), makeRefer(), makeRegister(), makeRequest(), makeSubscribe(), and makeUpdate().

{
   SipMessage* request = new SipMessage;
   RequestLine rLine(method);

   if (!mCreated)
   {
      rLine.uri() = mRequestUri;
   }
   else
   {
      rLine.uri() = mRemoteTarget.uri();
   }
   
   request->header(h_RequestLine) = rLine;
   request->header(h_To) = mRemoteUri;
   if ( !mRemoteTag.empty() )
   {
       request->header(h_To).param(p_tag) = mRemoteTag;
   }
   request->header(h_From) = mLocalUri;
   if ( !mLocalTag.empty() )
   {
      request->header(h_From).param(p_tag) = mLocalTag; 
   }
   request->header(h_CallId) = mCallId;
   request->header(h_Routes) = mRouteSet;
   request->header(h_Contacts).push_back(mContact);
   request->header(h_CSeq).method() = method;
   copyCSeq(*request);
   request->header(h_MaxForwards).value() = 70;

   Via via;
   via.param(p_branch); // will create the branch
   request->header(h_Vias).push_front(via);

   Helper::processStrictRoute(*request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeResponse ( const SipMessage request,
int  code = 200 
)

Definition at line 40 of file DeprecatedDialog.cxx.

References resip::Helper::computeTag(), DebugLog, resip::SipMessage::exists(), resip::RequestLine::getMethod(), resip::SipMessage::header(), InfoLog, resip::SipMessage::isRequest(), mCallId, mContact, mCreated, mDialogId, mEarly, mLocalEmpty, mLocalSequence, mLocalTag, mLocalUri, mRemoteEmpty, mRemoteSequence, mRemoteTag, mRemoteTarget, mRemoteUri, mRouteSet, resip::ParserCategory::param(), and resip::Helper::tagSize.

Referenced by makeResponse(), performTest(), and resip::TuIM::processSubscribeRequest().

{
   assert( code >= 100 );
   
   if ( (!mCreated) && (code < 300) && (code > 100) )
   {
      assert (code > 100);
      assert (code < 300);      
      assert(request.isRequest());
      assert(request.header(h_RequestLine).getMethod() == INVITE ||
             request.header(h_RequestLine).getMethod() == SUBSCRIBE ||
             request.header(h_RequestLine).getMethod() == PUBLISH);
      
      assert (request.header(h_Contacts).size() == 1);

      SipMessage* response = Helper::makeResponse(request, code, mContact);
      if (request.exists(h_RecordRoutes))
      {
         mRouteSet = request.header(h_RecordRoutes);
      }

      if (!request.exists(h_Contacts) && request.header(h_Contacts).size() != 1)
      {
         InfoLog (<< "Request doesn't have a contact header or more than one contact, so can't create dialog");
         DebugLog (<< request);
         throw Exception("Invalid or missing contact header in request", __FILE__,__LINE__);
      }

      mRemoteTarget = request.header(h_Contacts).front();
      mRemoteSequence = request.header(h_CSeq).sequence();
      mRemoteEmpty = false;
      mLocalSequence = 0;
      mLocalEmpty = true;
      mCallId = request.header(h_CallId);
      response->header(h_To).param(p_tag) = Helper::computeTag(Helper::tagSize);
      assert (response->header(h_To).exists(p_tag));
      mLocalTag = response->header(h_To).param(p_tag); // from response 
      if (request.header(h_From).exists(p_tag))  // 2543 compat
      {
         mRemoteTag = request.header(h_From).param(p_tag); 
      }
      
      mRemoteUri = request.header(h_From);
      mLocalUri = request.header(h_To);

      mDialogId = mCallId;
      mDialogId.param(p_toTag) = mLocalTag;
      mDialogId.param(p_fromTag) = mRemoteTag;

      mEarly = (code < 200);
      mCreated = true;

      return response;
   }
   else
   {
      SipMessage* response = Helper::makeResponse(request, code, mContact);
      if (mCreated)
      {
         response->header(h_To).param(p_tag) = mLocalTag;
      }
      //DebugLog(<< "Created response within dialog: " << *response);
      return response;
   }
}

Here is the call graph for this function:

void DeprecatedDialog::makeResponse ( const SipMessage request,
SipMessage response,
int  code = 200 
)

Definition at line 304 of file DeprecatedDialog.cxx.

References resip::Helper::computeTag(), resip::SipMessage::const_header(), DebugLog, resip::SipMessage::exists(), resip::RequestLine::getMethod(), resip::SipMessage::header(), InfoLog, resip::SipMessage::isRequest(), makeResponse(), mCallId, mContact, mCreated, mDialogId, mEarly, mLocalEmpty, mLocalSequence, mLocalTag, mLocalUri, mRemoteEmpty, mRemoteSequence, mRemoteTag, mRemoteTarget, mRemoteUri, mRouteSet, resip::ParserCategory::param(), and resip::Helper::tagSize.

{
   assert(request.isRequest());
   if ( (!mCreated) && (code < 300) && (code > 100) )
   {
      assert(request.header(h_RequestLine).getMethod() == INVITE ||
             request.header(h_RequestLine).getMethod() == SUBSCRIBE);
      assert (request.header(h_Contacts).size() == 1);

      Helper::makeResponse(response, request, code, mContact);
      response.header(h_To).param(p_tag) = Helper::computeTag(Helper::tagSize);

      if (request.exists(h_RecordRoutes))
      {
         mRouteSet = request.header(h_RecordRoutes);
      }

      if (!request.exists(h_Contacts) && request.header(h_Contacts).size() != 1)
      {
         InfoLog (<< "Request doesn't have a contact header or more than one contact, so can't create dialog");
         DebugLog (<< request);
         throw Exception("Invalid or missing contact header in request", __FILE__,__LINE__);
      }

      mRemoteTarget = request.header(h_Contacts).front();
      mRemoteSequence = request.header(h_CSeq).sequence();
      mRemoteEmpty = false;
      mLocalSequence = 0;
      mLocalEmpty = true;
      mCallId = request.header(h_CallId);
      assert (response.const_header(h_To).exists(p_tag));
      mLocalTag = response.header(h_To).param(p_tag); // from response 
      if (request.header(h_From).exists(p_tag))  // 2543 compat
      {
         mRemoteTag = request.header(h_From).param(p_tag); 
      }
      
      mRemoteUri = request.header(h_From);
      mLocalUri = request.header(h_To);

      mDialogId = mCallId;
      mDialogId.param(p_toTag) = mLocalTag;
      mDialogId.param(p_fromTag) = mRemoteTag;

      mEarly = (code > 100 && code < 200);

      mCreated = true;
   }
   else
   {
      Helper::makeResponse(response, request, code, mContact);
      if (mCreated)
      {
         response.header(h_To).param(p_tag) = mLocalTag;
         mEarly = false;
      }
   }
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeSubscribe ( )

Definition at line 490 of file DeprecatedDialog.cxx.

References DebugLog, incrementCSeq(), and makeRequestInternal().

Referenced by makeInitialSubscribe(), and resip::TuIM::process().

{
   SipMessage* request = makeRequestInternal(SUBSCRIBE);
   incrementCSeq(*request);
   DebugLog(<< "DeprecatedDialog::makeSubscribe: " << *request);
   return request;
}

Here is the call graph for this function:

SipMessage * DeprecatedDialog::makeUpdate ( )

Definition at line 472 of file DeprecatedDialog.cxx.

References DebugLog, incrementCSeq(), and makeRequestInternal().

{
   SipMessage* request = makeRequestInternal(UPDATE);
   incrementCSeq(*request);
   DebugLog(<< "DeprecatedDialog::makeUpdate: " << *request);
   return request;
}

Here is the call graph for this function:

void DeprecatedDialog::setExpirySeconds ( int  secondsInFuture)

Definition at line 751 of file DeprecatedDialog.cxx.

References expireyTimeAbsoluteMs, and resip::Timer::getTimeMs().

Referenced by resip::TuIM::processSubscribeRequest().

{ 
   expireyTimeAbsoluteMs = Timer::getTimeMs() + 1000*secondsInFuture;
}

Here is the call graph for this function:

int DeprecatedDialog::targetRefreshRequest ( const SipMessage request)

Definition at line 226 of file DeprecatedDialog.cxx.

References DebugLog, resip::SipMessage::exists(), resip::RequestLine::getMethod(), resip::SipMessage::header(), InfoLog, mRemoteEmpty, mRemoteSequence, and mRemoteTarget.

{
   assert (request.header(h_RequestLine).getMethod() != CANCEL);
   if (request.header(h_RequestLine).getMethod() != ACK)
   {
      unsigned long cseq = request.header(h_CSeq).sequence();
   
      if (mRemoteEmpty)
      {
         mRemoteSequence = cseq;
         mRemoteEmpty = false;
      }
      else if (cseq < mRemoteSequence)
      {
         InfoLog (<< "Got a cseq out of sequence: " << cseq << " < " << mRemoteSequence);
         throw Exception("out of order", __FILE__,__LINE__);
      }
      else
      {
         mRemoteSequence = cseq;
      }

      if (request.exists(h_Contacts) && request.header(h_Contacts).size() == 1)
      {
         mRemoteTarget = request.header(h_Contacts).front();
      }
      else
      {
         InfoLog (<< "Request doesn't have a contact header or more than one contact, so can't create dialog");
         DebugLog (<< request);
         throw Exception("Invalid or missing contact header in message", __FILE__,__LINE__);
      }
   }
   
   return 0;
}

Here is the call graph for this function:

void DeprecatedDialog::targetRefreshResponse ( const SipMessage response)

Definition at line 217 of file DeprecatedDialog.cxx.

References resip::SipMessage::exists(), resip::SipMessage::header(), and mRemoteTarget.

Referenced by createDialogAsUAC().

{
   if (response.exists(h_Contacts) && response.header(h_Contacts).size() == 1)
   {
      mRemoteTarget = response.header(h_Contacts).front();
   }
}

Here is the call graph for this function:

void DeprecatedDialog::updateRequest ( SipMessage msg)

Definition at line 264 of file DeprecatedDialog.cxx.

References resip::LazyParser::clear(), resip::SipMessage::clearForceTarget(), copyCSeq(), DebugLog, resip::Data::empty(), resip::SipMessage::header(), incrementCSeq(), resip::SipMessage::isRequest(), mCallId, mContact, mCreated, mLocalTag, mLocalUri, mRemoteTag, mRemoteTarget, mRemoteUri, mRouteSet, resip::ParserCategory::param(), resip::Helper::processStrictRoute(), resip::RequestLine::uri(), and resip::NameAddr::uri().

{
   assert (request.isRequest());
   if (mCreated)
   {
      request.header(h_RequestLine).uri() = mRemoteTarget.uri();
      request.header(h_To) = mRemoteUri;
      if ( !mRemoteTag.empty() )
      {
         request.header(h_To).param(p_tag) = mRemoteTag;
      }
      request.header(h_From) = mLocalUri;
      if ( !mLocalTag.empty() )
      {
         request.header(h_From).param(p_tag) = mLocalTag; 
      }
      request.header(h_CallId) = mCallId;
      request.header(h_Routes) = mRouteSet;
      request.header(h_Contacts).clear();
      request.header(h_Contacts).push_back(mContact);
      copyCSeq(request);
      incrementCSeq(request);

      request.header(h_MaxForwards).value() = 70;

      Via via;
      via.param(p_branch); // will create the branch
      request.header(h_Vias).clear();
      request.header(h_Vias).push_back(via);

      request.clearForceTarget();
      Helper::processStrictRoute(request);
   }
   else
   {
      DebugLog (<< "Updating a request when not in a dialog yet");
   }
}

Here is the call graph for this function:


Friends And Related Function Documentation

EncodeStream& operator<< ( EncodeStream ,
const DeprecatedDialog  
) [friend]

Member Data Documentation

Definition at line 136 of file DeprecatedDialog.hxx.

Referenced by getExpirySeconds(), and setExpirySeconds().

Definition at line 129 of file DeprecatedDialog.hxx.

Referenced by createDialogAsUAC(), dialogId(), makeReplaces(), and makeResponse().

Definition at line 114 of file DeprecatedDialog.hxx.

Referenced by clear(), createDialogAsUAC(), isEarly(), and makeResponse().

unsigned long resip::DeprecatedDialog::mLocalSequence [private]

Definition at line 122 of file DeprecatedDialog.hxx.

Referenced by clear(), createDialogAsUAC(), makeResponse(), and targetRefreshRequest().

Definition at line 121 of file DeprecatedDialog.hxx.

Referenced by clear(), createDialogAsUAC(), makeResponse(), and targetRefreshRequest().

Definition at line 134 of file DeprecatedDialog.hxx.


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