|
reSIProcate/DialogUsageManager
9694
|
#include <BaseCreator.hxx>


Public Member Functions | |
| BaseCreator (DialogUsageManager &dum, const SharedPtr< UserProfile > &userProfile) | |
| virtual | ~BaseCreator () |
| SharedPtr< SipMessage > | getLastRequest () |
| SharedPtr< UserProfile > | getUserProfile () |
Protected Member Functions | |
| void | makeInitialRequest (const NameAddr &target, MethodTypes method) |
| void | makeInitialRequest (const NameAddr &target, const NameAddr &from, MethodTypes method) |
Protected Attributes | |
| SharedPtr< SipMessage > | mLastRequest |
| DialogUsageManager & | mDum |
| SharedPtr< UserProfile > | mUserProfile |
Definition at line 13 of file BaseCreator.hxx.
| 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.
{}
| SharedPtr< SipMessage > BaseCreator::getLastRequest | ( | ) |
Definition at line 24 of file BaseCreator.cxx.
References mLastRequest.
Referenced by resip::Dialog::Dialog(), resip::DialogSet::DialogSet(), resip::DialogSet::dispatch(), resip::Dialog::dispatch(), resip::DialogSet::end(), resip::InviteSessionCreator::getInitialOffer(), resip::DialogSet::handledByAuthOrRedirect(), resip::InviteSessionCreator::InviteSessionCreator(), resip::Dialog::makeClientInviteSession(), resip::DialogSet::makeClientOutOfDialogReq(), resip::DialogSet::makeClientPublication(), resip::DialogSet::makeClientRegistration(), resip::DialogUsageManager::makeNewSession(), and resip::InviteSession::sendAck().
{
return mLastRequest;
}
| 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] |
Definition at line 44 of file BaseCreator.cxx.
References resip::SharedPtr< T >::get(), and mUserProfile.
Referenced by resip::InviteSessionCreator::InviteSessionCreator(), resip::OutOfDialogReqCreator::OutOfDialogReqCreator(), resip::PagerMessageCreator::PagerMessageCreator(), resip::PublicationCreator::PublicationCreator(), resip::RegistrationCreator::RegistrationCreator(), and resip::SubscriptionCreator::SubscriptionCreator().
{
assert(mUserProfile.get());
makeInitialRequest(target, mUserProfile->getDefaultFrom(), method);
}

| 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);
}

DialogUsageManager& resip::BaseCreator::mDum [protected] |
Definition at line 29 of file BaseCreator.hxx.
Referenced by resip::InviteSessionCreator::InviteSessionCreator(), and makeInitialRequest().
SharedPtr<SipMessage> resip::BaseCreator::mLastRequest [protected] |
Definition at line 28 of file BaseCreator.hxx.
Referenced by getLastRequest(), resip::InviteSessionCreator::InviteSessionCreator(), makeInitialRequest(), resip::PagerMessageCreator::PagerMessageCreator(), resip::PublicationCreator::PublicationCreator(), resip::RegistrationCreator::RegistrationCreator(), and resip::SubscriptionCreator::SubscriptionCreator().
SharedPtr<UserProfile> resip::BaseCreator::mUserProfile [protected] |
Definition at line 30 of file BaseCreator.hxx.
Referenced by getUserProfile(), and makeInitialRequest().
1.7.5.1