reSIProcate/DialogUsageManager  9694
Public Member Functions | Protected Member Functions | Protected Attributes
resip::BaseCreator Class Reference

#include <BaseCreator.hxx>

Inheritance diagram for resip::BaseCreator:
Inheritance graph
[legend]
Collaboration diagram for resip::BaseCreator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 BaseCreator (DialogUsageManager &dum, const SharedPtr< UserProfile > &userProfile)
virtual ~BaseCreator ()
SharedPtr< SipMessagegetLastRequest ()
SharedPtr< UserProfilegetUserProfile ()

Protected Member Functions

void makeInitialRequest (const NameAddr &target, MethodTypes method)
void makeInitialRequest (const NameAddr &target, const NameAddr &from, MethodTypes method)

Protected Attributes

SharedPtr< SipMessagemLastRequest
DialogUsageManagermDum
SharedPtr< UserProfilemUserProfile

Detailed Description

Definition at line 13 of file BaseCreator.hxx.


Constructor & Destructor Documentation

BaseCreator::BaseCreator ( DialogUsageManager dum,
const SharedPtr< UserProfile > &  userProfile 
)

Definition at line 13 of file BaseCreator.cxx.

   : mLastRequest(new SipMessage),
     mDum(dum),
     mUserProfile(userProfile)
{}
BaseCreator::~BaseCreator ( ) [virtual]

Definition at line 20 of file BaseCreator.cxx.

{}

Member Function Documentation

SharedPtr< SipMessage > BaseCreator::getLastRequest ( )
SharedPtr< UserProfile > BaseCreator::getUserProfile ( )

Definition at line 38 of file BaseCreator.cxx.

References mUserProfile.

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

{
   return mUserProfile;
}
void BaseCreator::makeInitialRequest ( const NameAddr target,
MethodTypes  method 
) [protected]
void BaseCreator::makeInitialRequest ( const NameAddr target,
const NameAddr from,
MethodTypes  method 
) [protected]

dcm! - clunky, have userprofile provide appropriate gruu or contact...

Definition at line 52 of file BaseCreator.cxx.

References resip::Helper::computeCallId(), resip::Helper::computeTag(), DebugLog, resip::Symbols::Digest, resip::Data::empty(), resip::ParserContainerBase::empty(), resip::Data::Empty, resip::Uri::exists(), resip::SharedPtr< T >::get(), resip::DialogUsageManager::getMasterProfile(), h_AllowEvents, h_CallId, h_RequestLine, mDum, mLastRequest, mUserProfile, resip::ParserCategory::param(), resip::Auth::scheme(), resip::Helper::tagSize, resip::NameAddr::uri(), resip::RequestLine::uri(), and resip::Uri::user().

{
   RequestLine rLine(method);
   rLine.uri() = target.uri();   
   mLastRequest->header(h_RequestLine) = rLine;

   mLastRequest->header(h_To) = target;
   mLastRequest->header(h_MaxForwards).value() = 70;
   mLastRequest->header(h_CSeq).method() = method;
   mLastRequest->header(h_CSeq).sequence() = 1;
   mLastRequest->header(h_From) = from;
   mLastRequest->header(h_From).param(p_tag) = Helper::computeTag(Helper::tagSize);
   mLastRequest->header(h_CallId).value() = Helper::computeCallId();

   assert(mUserProfile.get());
   if (!mUserProfile->getImsAuthUserName().empty())
   {
      Auth auth;
      auth.scheme() = Symbols::Digest;
      auth.param(p_username) = mUserProfile->getImsAuthUserName();
      auth.param(p_realm) = mUserProfile->getImsAuthHost();
      auth.param(p_uri) = "sip:" + mUserProfile->getImsAuthHost();
      auth.param(p_nonce) = Data::Empty;
      auth.param(p_response) = Data::Empty;
      mLastRequest->header(h_Authorizations).push_back(auth);
      DebugLog ( << "Adding auth header to inital reg for IMS: " << auth);
   }

   NameAddr contact; // if no GRUU, let the stack fill in the contact 

   if(mUserProfile->hasUserAgentCapabilities())
   {
      contact = mUserProfile->getUserAgentCapabilities();
   }

   //.dcm. If we want to use userprofiles oacross multiple registration we will
   //need the lookup-rtype hasGruu methods
   //if (mUserProfile->hasGruu(target.uri().getAor()))
   //?dcm? handle selction of anon vs pub gruu in profile?
   //if (mUserProfile->hasGruu(target.uri().getAor()))
   if (!mUserProfile->isAnonymous() && mUserProfile->hasPublicGruu() && method != REGISTER) //why not use GRUU for publish/etc?
   {
      contact.uri() = mUserProfile->getPublicGruu();
      mLastRequest->header(h_Contacts).push_front(contact);
   }
   else if(mUserProfile->isAnonymous() && mUserProfile->hasTempGruu() && method != REGISTER)
   {
      contact.uri() = mUserProfile->getTempGruu();
      mLastRequest->header(h_Contacts).push_front(contact);
   }
   else
   {
      if (mUserProfile->hasOverrideHostAndPort())
      {
         contact.uri() = mUserProfile->getOverrideHostAndPort();
      }
      contact.uri().user() = from.uri().user();

      // .jjg. there isn't anything in the outbound [11] draft that says we 
      // aren't allowed to include p_Instance in this case...  
      // odds are it will be useful (or necessary) for some implementations
      const Data& instanceId = mUserProfile->getInstanceId();
      if (!contact.uri().exists(p_gr) && !instanceId.empty())
      {
         contact.param(p_Instance) = instanceId;
      }
      mLastRequest->header(h_Contacts).push_front(contact);

      if (method != REGISTER)
      {
         const NameAddrs& sRoute = mUserProfile->getServiceRoute();
         if (!sRoute.empty())
         {
            mLastRequest->header(h_Routes) = sRoute;
         }
      }
   }

   if(mUserProfile->clientOutboundEnabled() && method != REGISTER)
   {
      // Add ;ob parm to non-register requests - RFC5626 pg17
      mLastRequest->header(h_Contacts).front().uri().param(p_ob);
   }
      
   Via via;
   mLastRequest->header(h_Vias).push_front(via);

   if(mUserProfile->isAdvertisedCapability(Headers::Allow)) 
   {
      mLastRequest->header(h_Allows) = mDum.getMasterProfile()->getAllowedMethods();
   }
   if(mUserProfile->isAdvertisedCapability(Headers::AcceptEncoding)) 
   {
      mLastRequest->header(h_AcceptEncodings) = mDum.getMasterProfile()->getSupportedEncodings();
   }
   if(mUserProfile->isAdvertisedCapability(Headers::AcceptLanguage)) 
   {
      mLastRequest->header(h_AcceptLanguages) = mDum.getMasterProfile()->getSupportedLanguages();
   }
   if(mUserProfile->isAdvertisedCapability(Headers::AllowEvents)) 
   {
      mLastRequest->header(h_AllowEvents) = mDum.getMasterProfile()->getAllowedEvents();
   }
   if(mUserProfile->isAdvertisedCapability(Headers::Supported)) 
   {
      mLastRequest->header(h_Supporteds) = mDum.getMasterProfile()->getSupportedOptionTags();
   }

   // Merge Embedded parameters
   mLastRequest->mergeUri(target.uri());

   //DumHelper::setOutgoingEncryptionLevel(mLastRequest, mEncryptionLevel);

   DebugLog ( << "BaseCreator::makeInitialRequest: " << std::endl << std::endl << mLastRequest);
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 30 of file BaseCreator.hxx.

Referenced by getUserProfile(), and makeInitialRequest().


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