30#if defined(WIN32) && !defined(__GNUC__)
31#pragma warning( disable : 4355 )
32#pragma warning( disable : 4800 )
35#define RESIPROCATE_SUBSYSTEM Subsystem::DUM
36#define THROW(msg) throw DialogUsage::Exception(msg, __FILE__,__LINE__);
45 "Application Rejected Sdp(usually no common codec)",
46 "Illegal Sdp Negotiation",
48 "Session Timer Expired",
69 mPeerSupportsSessionTimer(false),
71 mNitState(NitComplete),
72 mServerNitState(NitComplete),
74 mLastRemoteSessionModification(new
SipMessage),
77 mCurrentRetransmit200(0),
78 mStaleReInviteTimerSeq(1),
81 mSessionRefresher(false),
82 mSessionRefreshTimerSeq(0),
83 mSessionExpirationTimerSeq(0),
84 mSessionRefreshReInvite(false),
85 mSessionExpirationPending(false),
89 mEndReason(NotSpecified)
91 DebugLog ( <<
"^^^ InviteSession::InviteSession " <<
this);
97 DebugLog ( <<
"^^^ InviteSession::~InviteSession " <<
this);
248 if (msg.
exists(h_UserAgent))
258 if (msg.
method() == INVITE)
263 else if(msg.
method() == UPDATE)
279 if (msg.
method() == INVITE)
285 if (msg.
exists(h_Supporteds))
289 if (msg.
exists(h_Requires))
293 if (msg.
exists(h_AcceptEncodings))
297 if (msg.
exists(h_AcceptLanguages))
305 if (msg.
exists(h_Accepts))
459 strm <<
"INVITE: " <<
mId
493 WarningLog (<<
"Can't requestOffer when not in Connected state");
558 : mInviteSessionHandle(inviteSessionHandle),
559 mOffer(offer.clone()),
561 mAlternative(alternative ? alternative->clone() : 0)
567 if(mInviteSessionHandle.isValid())
569 mInviteSessionHandle->provideOffer(*mOffer, mLevel, mAlternative.get());
575 return strm <<
"InviteSessionProvideOfferExCommand";
579 std::unique_ptr<const Contents> mOffer;
581 std::unique_ptr<const Contents> mAlternative;
600 : mInviteSessionHandle(inviteSessionHandle),
601 mOffer(offer.clone())
607 if(mInviteSessionHandle.isValid())
609 mInviteSessionHandle->provideOffer(*mOffer);
615 return strm <<
"InviteSessionProvideOfferCommand";
619 std::unique_ptr<const Contents> mOffer;
644 if (
mDum.mDialogEventStateManager)
655 auto response = std::make_shared<SipMessage>();
661 InfoLog (<<
"Sending " << response->brief());
664 if (
mDum.mDialogEventStateManager)
678 if (
mDum.mDialogEventStateManager)
695 : mInviteSessionHandle(inviteSessionHandle),
696 mAnswer(answer.clone())
702 if(mInviteSessionHandle.isValid())
704 mInviteSessionHandle->provideAnswer(*mAnswer);
710 return strm <<
"InviteSessionProvideAnswerCommand";
714 std::unique_ptr<const Contents> mAnswer;
798 auto response = std::make_shared<SipMessage>();
800 InfoLog (<<
"Sending " << response->brief());
831 : mInviteSessionHandle(inviteSessionHandle),
833 mUserEndReason(userEndReason),
834 mUserEndReasons(userEndReasons)
840 if(mInviteSessionHandle.isValid())
844 if (mUserEndReasons.size() > 0)
846 mInviteSessionHandle->end(mUserEndReasons);
850 mInviteSessionHandle->end(mUserEndReason);
855 mInviteSessionHandle->end(mReason);
862 return strm <<
"InviteSessionEndCommand";
892 reject(statusCode,
nullptr, warning);
907 auto response = std::make_shared<SipMessage>();
912 response->setContents(contents);
916 response->header(h_Warnings).push_back(*warning);
918 InfoLog (<<
"Sending " << response->brief());
926 InfoLog (<<
"Not sending " << statusCode <<
" error since transaction"
927 "already completed, sending answer-less ACK");
942 : mInviteSessionHandle(inviteSessionHandle),
949 : mInviteSessionHandle(inviteSessionHandle),
951 mContents(contents?contents->clone():nullptr),
958 if(mInviteSessionHandle.isValid())
960 mInviteSessionHandle->reject(mCode, mContents.get(), mWarning.get());
966 return strm <<
"InviteSessionRejectCommand";
971 std::unique_ptr<Contents> mContents;
972 std::unique_ptr<WarningCategory> mWarning;
992 mDialog.mLocalContact = localUri;
997 WarningLog (<<
"Can't targetRefresh before Connected");
998 throw UsageUseException(
"targetRefresh not allowed in this context", __FILE__, __LINE__);
1010 refer(referTo, referredBy,
nullptr, referSub);
1015 refer(referTo,
myAddr(), std::move(contents), referSub);
1022 auto refer = std::make_shared<SipMessage>();
1024 refer->header(h_ReferTo) = referTo;
1025 refer->header(h_ReferredBy) = referredBy;
1027 refer->setContents(std::move(contents));
1030 refer->header(h_ReferSub).value() =
"false";
1048 WarningLog (<<
"Can't refer before Connected");
1049 throw UsageUseException(
"REFER not allowed in this context", __FILE__, __LINE__);
1053std::shared_ptr<SipMessage>
1081 : mInviteSessionHandle(inviteSessionHandle),
1090 if(mInviteSessionHandle.isValid())
1092 mInviteSessionHandle->refer(mReferTo, mReferSub);
1098 return strm <<
"InviteSessionReferCommand";
1116 refer(referTo, sessionToReplace,
nullptr, referSub);
1122 if (!sessionToReplace.
isValid())
1124 throw UsageUseException(
"Attempted to make a refer w/ and invalid replacement target", __FILE__, __LINE__);
1129 replaces.
value() =
id.getCallId();
1130 replaces.
param(p_toTag) =
id.getRemoteTag();
1131 replaces.
param(p_fromTag) =
id.getLocalTag();
1133 refer(referTo, replaces, std::move(contents), referSub);
1139 refer(referTo, replaces,
nullptr, referSub);
1147 auto refer = std::make_shared<SipMessage>();
1149 refer->setContents(std::move(contents));
1150 refer->header(h_ReferTo) = referTo;
1152 refer->header(h_ReferredBy).remove(p_tag);
1154 refer->header(h_ReferTo).uri().embedded().header(h_Replaces) = replaces;
1171 InfoLog(<<
"refer/replace - queuing NIT:" <<
refer->brief());
1176 WarningLog (<<
"Can't refer before Connected");
1178 throw UsageUseException(
"REFER not allowed in this context", __FILE__, __LINE__);
1186 : mInviteSessionHandle(inviteSessionHandle),
1187 mSessionToReplace(sessionToReplace),
1195 if(mInviteSessionHandle.isValid())
1197 mInviteSessionHandle->refer(mReferTo, mSessionToReplace, mReferSub);
1203 return strm <<
"InviteSessionReferExCommand";
1222 auto info = std::make_shared<SipMessage>();
1225 info->setContents(&contents);
1235 InfoLog(<<
"info - queuing NIT:" <<
info->brief());
1243 : mInviteSessionHandle(inviteSessionHandle),
1244 mContents(contents.clone())
1250 if(mInviteSessionHandle.isValid())
1252 mInviteSessionHandle->info(*mContents);
1258 return strm <<
"InviteSessionInfoCommand";
1262 std::unique_ptr<Contents> mContents;
1274 auto message = std::make_shared<SipMessage>();
1277 message->setContents(&contents);
1296 : mInviteSessionHandle(inviteSessionHandle),
1297 mContents(contents.clone())
1303 if(mInviteSessionHandle.isValid())
1305 mInviteSessionHandle->message(*mContents);
1311 return strm <<
"InviteSessionMessageCommand";
1315 std::unique_ptr<Contents> mContents;
1332 if (i !=
mAcks.end())
1421 InfoLog(<<
"Ignoring stale Retransmit200 timer: seq=" << timeout.
seq()
1481 if (i !=
mAcks.end())
1492 InfoLog(<<
"Retransmitting the UPDATE (glare condition timer)");
1500 InfoLog(<<
"Retransmitting the OPTIONS (glare condition timer)");
1508 InfoLog(<<
"Retransmitting the reINVITE (glare condition timer)");
1517 InfoLog(<<
"Retransmitting the reINVITE-nooffer (glare condition timer)");
1564 InfoLog(<<
"Session expired while a session modification is in flight - deferring expiry until it completes");
1587 unsigned long refreshRetryDuration = timeout.
duration() / 2;
1588 if (refreshRetryDuration > 32)
1591 InfoLog(<<
"Started Session Refresh Retry Timer for " << refreshRetryDuration <<
" seconds");
1606 switch (
toEvent(msg, offerAnswer.get()))
1648 auto response = std::make_shared<SipMessage>();
1657 WarningLog (<<
"DUM delivered an UPDATE response in an incorrect state " << endl << msg);
1666 InfoLog(<<
"dropped stale or duplicate ACK");
1676 dispatchOthers(msg);
1687 switch (
toEvent(msg, offerAnswer.get()))
1697 auto response = std::make_shared<SipMessage>();
1712 if (
mDum.mDialogEventStateManager)
1768 dispatchOthers(msg);
1779 switch (
toEvent(msg, offerAnswer.get()))
1788 auto response = std::make_shared<SipMessage>();
1818 if (
mDum.mDialogEventStateManager)
1829 if (
mDum.mDialogEventStateManager)
1901 InfoLog(<<
"dropped stale or duplicate ACK");
1911 dispatchOthers(msg);
1922 switch (
toEvent(msg, offerAnswer.get()))
1931 auto response = std::make_shared<SipMessage>();
2009 dispatchOthers(msg);
2020 switch (
toEvent(msg, offerAnswer.get()))
2030 auto response = std::make_shared<SipMessage>();
2057 dispatchOthers(msg);
2068 switch (
toEvent(msg, offerAnswer.get()))
2077 auto response = std::make_shared<SipMessage>();
2086 InfoLog(<<
"dropped stale or duplicate ACK");
2096 if (
mDum.mDialogEventStateManager)
2108 InfoLog(<<
"dropped stale or duplicate ACK");
2112 InfoLog(<<
"Got Ack with no answer");
2122 dispatchOthers(msg);
2132 if (msg.
isRequest() && (method == INVITE || method == UPDATE))
2134 DebugLog(<<
"Re-INVITE or UPDATE received when in SentReinviteGlare or SentUpdateGlare" << endl);
2148 dispatchOthers(msg);
2157 if (msg.
isRequest() && (method == INVITE || method == UPDATE))
2172 dispatchOthers(msg);
2182 switch (
toEvent(msg, offerAnswer.get()))
2193 auto response = std::make_shared<SipMessage>();
2202 auto response = std::make_shared<SipMessage>();
2211 dispatchOthers(msg);
2227 dispatchOthers(msg);
2242 dispatchOthers(msg);
2256 dispatchOthers(msg);
2270 dispatchOthers(msg);
2297 auto response = std::make_shared<SipMessage>();
2309 switch (
toEvent(msg, offerAnswer.get()))
2316 InfoLog(<<
"dropped stale or duplicate ACK");
2336 InfoLog (<<
"InviteSession::dispatchTerminated " << msg.
brief());
2342 auto response = std::make_shared<SipMessage>();
2348 auto response = std::make_shared<SipMessage>();
2363InviteSession::dispatchOthers(
const SipMessage& msg)
2375 auto response = std::make_shared<SipMessage>();
2384 dispatchCancel(msg);
2399 InfoLog(<<
"dropped stale or duplicate ACK");
2414 <<
" to the InviteSession in state: " <<
toData(
mState)
2427 auto response = std::make_shared<SipMessage>();
2435InviteSession::dispatchUnhandledInvite(
const SipMessage& msg)
2442 auto response = std::make_shared<SipMessage>();
2444 InfoLog (<<
"Sending " << response->brief());
2453InviteSession::dispatchPrack(
const SipMessage& msg)
2458 auto rsp = std::make_shared<SipMessage>();
2474InviteSession::dispatchCancel(
const SipMessage& msg)
2480 auto rsp = std::make_shared<SipMessage>();
2492 WarningLog (<<
"DUM let me send a CANCEL at an incorrect state " << endl << msg);
2515 auto rsp = std::make_shared<SipMessage>();
2523 if (
mDum.mDialogEventStateManager)
2533 WarningLog (<<
"DUM let me send a BYE at an incorrect state " << endl << msg);
2548 auto response = std::make_shared<SipMessage>();
2552 WarningLog(<<
"an INFO message was received before the application called acceptNIT() for the previous INFO message");
2581 if (statusCode / 100 != 2)
2602 : mInviteSessionHandle(inviteSessionHandle),
2603 mStatusCode(statusCode),
2604 mContents(contents?contents->clone():0)
2611 if(mInviteSessionHandle.isValid())
2613 mInviteSessionHandle->acceptNIT(mStatusCode, mContents.get());
2619 return strm <<
"InviteSessionAcceptNITCommand";
2624 std::unique_ptr<Contents> mContents;
2636 if (statusCode < 400)
2657 : mInviteSessionHandle(inviteSessionHandle),
2658 mStatusCode(statusCode)
2664 if(mInviteSessionHandle.isValid())
2666 mInviteSessionHandle->rejectNIT(mStatusCode);
2672 return strm <<
"InviteSessionRejectNITCommand";
2695 auto response = std::make_shared<SipMessage>();
2746 return ack.
header(h_CSeq).sequence() ==
mInvite200->header(h_CSeq).sequence();
2753 unsigned int seq =
mInvite200->header(h_CSeq).sequence();
2774 timer -= timer % 10;
2776 DebugLog(<<
"491 timer value: " << timer <<
"ms" << endl);
2782 timer -= timer % 10;
2783 DebugLog(<<
"491 timer value: " << timer <<
"ms" << endl);
2822 msg.
remove(h_SessionExpires);
2843 auto options = std::make_shared<SipMessage>();
2846 InfoLog (<<
"sessionRefresh: Sending " << options->brief());
2912 InfoLog(<<
"Session modification complete - applying deferred session expiry");
2959 InfoLog(<<
"Started Session Refresh Timer for " <<
mSessionInterval / 2 <<
" seconds and Session Expiration Timer for " << aBitBeforeExpiration <<
" seconds (Session Interval is " <<
mSessionInterval <<
" seconds)");
2967 InfoLog(<<
"Started Session Expiration Timer for " << aBitBeforeExpiration <<
" seconds (Session Interval is " <<
mSessionInterval <<
" seconds)");
2983 bool isOptionsRequest = msg.
header(h_CSeq).
method() == OPTIONS;
2986 if (!isOptionsRequest)
3002 && !msg.
exists(h_SessionExpires))
3008 else if(msg.
exists(h_SessionExpires))
3011 if(msg.
header(h_SessionExpires).exists(p_refresher))
3040 bool isOptionsRequest = request.
header(h_CSeq).
method() == OPTIONS;
3043 if (!isOptionsRequest)
3057 if(request.
exists(h_MinSE))
3064 bool farEndSupportsTimer =
false;
3067 farEndSupportsTimer =
true;
3068 if(request.
exists(h_SessionExpires))
3072 if(request.
header(h_SessionExpires).exists(p_refresher))
3087 if(farEndSupportsTimer)
3095 if (!isOptionsRequest)
3111 return "InviteSession::Undefined";
3113 return "InviteSession::Connected";
3115 return "InviteSession::SentUpdate";
3117 return "InviteSession::SentUpdateGlare";
3119 return "InviteSession::SentReinvite";
3121 return "InviteSession::SentReinviteGlare";
3123 return "InviteSession::SentReinviteNoOffer";
3125 return "InviteSession::SentReinviteAnswered";
3127 return "InviteSession::SentReinviteNoOfferGlare";
3129 return "InviteSession::SentOptions";
3131 return "InviteSession::SentOptionsGlare";
3133 return "InviteSession::ReceivedUpdate";
3135 return "InviteSession::ReceivedReinvite";
3137 return "InviteSession::ReceivedReinviteNoOffer";
3139 return "InviteSession::ReceivedReinviteSentOffer";
3141 return "InviteSession::Answered";
3143 return "InviteSession::WaitingToOffer";
3145 return "InviteSession::WaitingToRequestOffer";
3147 return "InviteSession::WaitingToTerminate";
3149 return "InviteSession::WaitingToHangup";
3151 return "InviteSession::Terminated";
3158 return "UAS_OfferProvidedAnswer";
3160 return "UAS_EarlyOffer";
3162 return "UAS_EarlyProvidedAnswer";
3164 return "UAS_NoOffer";
3166 return "UAS_ProvidedOffer";
3168 return "UAS_EarlyNoOffer";
3170 return "UAS_EarlyProvidedOffer";
3172 return "UAS_Accepted";
3174 return "UAS_WaitingToOffer";
3176 return "UAS_AcceptedWaitingAnswer";
3180 return "UAC_EarlyWithOffer";
3182 return "UAC_EarlyWithAnswer";
3184 return "UAC_Answered";
3186 return "UAC_SentUpdateEarly";
3188 return "UAC_SentUpdateEarlyGlare";
3190 return "UAC_ReceivedUpdateEarly";
3192 return "UAC_SentAnswer";
3194 return "UAC_QueuedUpdate";
3196 return "UAC_Cancelled";
3201 return "UAS_OfferReliable";
3203 return "UAS_OfferReliableProvidedAnswer";
3205 return "UAS_NoOfferReliable";
3207 return "UAS_ProvidedOfferReliable";
3209 return "UAS_FirstSentOfferReliable";
3211 return "UAS_FirstSentAnswerReliable";
3213 return "UAS_NoAnswerReliableWaitingPrack";
3215 return "UAS_NoAnswerReliable";
3217 return "UAS_NegotiatedReliable";
3219 return "UAS_SentUpdate";
3221 return "UAS_SentUpdateAccepted";
3223 return "UAS_SentUpdateGlare";
3225 return "UAS_ReceivedUpdate";
3227 return "UAS_ReceivedUpdateWaitingAnswer";
3229 return "UAS_WaitingToHangup";
3231 return "UAS_WaitingToRequestOffer";
3248 if(msg.
method() != INVITE)
3268std::unique_ptr<Contents>
3284std::unique_ptr<Contents>
3287 return std::unique_ptr<Contents>(
static_cast<Contents*
>(offerAnswer.
clone()));
3290std::unique_ptr<Contents>
3297 mac->
parts().push_back(alternative->
clone());
3299 return std::unique_ptr<Contents>(mac);
3303 return std::unique_ptr<Contents>(offerAnswer.
clone());
3317 mac->
parts().push_back(alternative->
clone());
3344 dynamic_cast<Contents*
>((mp_ans)->parts().front()));
3366 if (code == 481 || code == 408)
3370 else if (code >= 300 && code <= 399)
3374 else if (method == INVITE && code == 0)
3399 else if (method == INVITE && code > 100 && code < 200)
3431 else if (method == INVITE && code >= 200 && code < 300)
3449 else if (method == INVITE && code == 422)
3453 else if (method == INVITE && code == 487)
3457 else if (method == INVITE && code == 491 &&
3462 else if (method == INVITE && code >= 400)
3466 else if (method == ACK)
3477 else if (method == CANCEL && code == 0)
3481 else if (method == CANCEL && code / 200 == 1)
3485 else if (method == CANCEL && code >= 400)
3489 else if (method == BYE && code == 0)
3493 else if (method == BYE && code / 200 == 1)
3497 else if (method == PRACK && code == 0)
3501 else if (method == PRACK && code / 200 == 1)
3505 else if (method == UPDATE && code == 0)
3516 else if (method == UPDATE && code / 200 == 1)
3520 else if (method == UPDATE && code == 422)
3524 else if (method == UPDATE && code == 491 &&
3529 else if (method == UPDATE && code >= 400)
3533 else if (method == OPTIONS && code == 0)
3537 else if (method == OPTIONS && code / 100 == 2)
3541 else if (method == OPTIONS && code == 491)
3552std::shared_ptr<SipMessage>
3555 auto ack = std::make_shared<SipMessage>();
3557 std::shared_ptr<SipMessage> source;
3586 ack->header(h_CSeq).sequence() = source->header(h_CSeq).sequence();
3592 mAcks[source->getTransactionId()] = ack;
3595 InfoLog (<<
"Sending " << ack->brief());
3600std::shared_ptr<SipMessage>
3603 auto bye = std::make_shared<SipMessage>();
3614 Token reason(
"SIP");
3616 reason.
param(p_text) = txt;
3619 bye->header(h_Reasons).push_back(reason);
3623 if (
mDum.mDialogEventStateManager)
3696 if (statusCode / 100 != 2)
3701 auto response = std::make_shared<SipMessage>();
3703 response->header(h_ReferSub).value() =
"false";
3712 if (responseCode < 400)
3717 auto response = std::make_shared<SipMessage>();
const Token SessionTimerToken(Symbols::Timer)
#define WarningLog(args_)
#define resip_assert(x)
This file needs to work for both C and C++ code.
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
void executeCommand() override
InviteSessionAcceptNITCommand(const InviteSessionHandle &inviteSessionHandle, int statusCode, const Contents *contents)
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
void executeCommand() override
InviteSessionEndCommand(const InviteSessionHandle &inviteSessionHandle, InviteSession::EndReason reason, const Data &userEndReason=Data::Empty, ParserContainer< Token > userEndReasons=ParserContainer< Token >())
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
InviteSessionInfoCommand(const InviteSessionHandle &inviteSessionHandle, const Contents &contents)
void executeCommand() override
InviteSessionMessageCommand(const InviteSessionHandle &inviteSessionHandle, const Contents &contents)
void executeCommand() override
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
InviteSessionProvideAnswerCommand(const InviteSessionHandle &inviteSessionHandle, const Contents &answer)
void executeCommand() override
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
void executeCommand() override
InviteSessionProvideOfferCommand(const InviteSessionHandle &inviteSessionHandle, const Contents &offer)
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
void executeCommand() override
InviteSessionProvideOfferExCommand(const InviteSessionHandle &inviteSessionHandle, const Contents &offer, DialogUsageManager::EncryptionLevel level, const Contents *alternative)
InviteSessionReferCommand(const InviteSessionHandle &inviteSessionHandle, const NameAddr &referTo, bool referSub)
void executeCommand() override
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
void executeCommand() override
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
InviteSessionReferExCommand(const InviteSessionHandle &inviteSessionHandle, const NameAddr &referTo, InviteSessionHandle sessionToReplace, bool referSub)
InviteSessionRejectCommand(const InviteSessionHandle &inviteSessionHandle, int code, WarningCategory *warning)
InviteSessionRejectCommand(const InviteSessionHandle &inviteSessionHandle, int code, const Contents *contents, WarningCategory *warning)
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
void executeCommand() override
void executeCommand() override
InviteSessionRejectNITCommand(const InviteSessionHandle &inviteSessionHandle, int statusCode)
EncodeStream & encodeBrief(EncodeStream &strm) const override
output a brief description to stream
std::shared_ptr< SipMessage > getLastRequest() const noexcept
BaseUsageHandle getBaseHandle() const
DialogUsageManager & mDum
Represents the "callid" element in the SIP grammar.
const Data & param(const ExtensionParameter ¶m) const
Const accessor for non-natively-supported parameter types.
Base class for all SIP body types.
virtual Contents * clone() const =0
returns a copy of a Contents object
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
static const Data Empty
Constant that represents a zero-length data.
BaseCreator * getCreator() const noexcept
std::shared_ptr< UserProfile > getUserProfile() const
std::shared_ptr< MasterProfile > & getMasterProfile()
const NameAddr & myAddr() const noexcept
virtual void send(std::shared_ptr< SipMessage > msg)
const NameAddr & peerAddr() const noexcept
dcm! – kill typedef std::list<DialogId> DialogIdSet;
void makeRequest(SipMessage &request, MethodTypes method, bool incrementCSeq=true)
const DialogId & getId() const noexcept
void setRequestNextCSeq(SipMessage &request)
void makeResponse(SipMessage &response, const SipMessage &request, int responseCode)
static void setOutgoingEncryptionLevel(SipMessage &message, DialogUsageManager::EncryptionLevel level)
const Data & transactionId() const
unsigned long duration() const
static void getResponseCodeReason(int responseCode, Data &reason)
Returns the default reason string for a particular response code.
static std::unique_ptr< SdpContents > getSdp(Contents *tree)
virtual void onStaleReInviteTimeout(InviteSessionHandle h)
UAC gets no final response within the stale re-invite timeout (default is 40 seconds).
virtual void onInfo(InviteSessionHandle, const SipMessage &msg)=0
called when INFO message is received the application must call acceptNIT() or rejectNIT() once it is ...
virtual void onOfferRejected(InviteSessionHandle, const SipMessage *msg)=0
called if an offer in a UPDATE or re-INVITE was rejected - not real useful.
virtual void onIllegalNegotiation(InviteSessionHandle, const SipMessage &msg)
will be called if reINVITE or UPDATE in dialog fails
virtual void onAckNotReceived(InviteSessionHandle)
default behaviour is to send a BYE to end the dialog
virtual void onAckReceived(InviteSessionHandle, const SipMessage &msg)
called when ACK is received
virtual void onAnswer(InviteSessionHandle, const SipMessage &msg, const SdpContents &)=0
called when an answer is received - has nothing to do with user answering the call
virtual void onSessionExpired(InviteSessionHandle)
will be called if Session-Timers are used and Session Timer expires default behaviour is to send a BY...
virtual void onReferNoSub(InviteSessionHandle, const SipMessage &msg)=0
virtual void onOfferRequired(InviteSessionHandle, const SipMessage &msg)=0
called when an Invite w/out offer is sent, or any other context which requires an offer from the user
virtual void onMessage(InviteSessionHandle, const SipMessage &msg)=0
called when MESSAGE message is received
virtual void onInfoFailure(InviteSessionHandle, const SipMessage &msg)=0
virtual void onInfoSuccess(InviteSessionHandle, const SipMessage &msg)=0
called when response to INFO message is received
virtual void onTerminated(InviteSessionHandle, InviteSessionHandler::TerminatedReason reason, const SipMessage *related=0)=0
virtual void onOffer(InviteSessionHandle, const SipMessage &msg, const SdpContents &)=0
called when an offer is received - must send an answer soon after this
virtual bool isGenericOfferAnswer()
virtual void onReadyToSend(InviteSessionHandle, SipMessage &msg)
called to allow app to adorn a message. default is to send immediately
virtual void onMessageFailure(InviteSessionHandle, const SipMessage &msg)=0
virtual void onMessageSuccess(InviteSessionHandle, const SipMessage &msg)=0
called when response to MESSAGE message is received
virtual void onRemoteAnswerChanged(InviteSessionHandle, const SipMessage &msg, const Contents &)
virtual void onFlowTerminated(InviteSessionHandle)
Called when a TCP or TLS flow to the server has terminated.
virtual void onOfferRequestRejected(InviteSessionHandle, const SipMessage &msg)
Called when an error response is received for a reinvite-nobody request (via requestOffer)
std::shared_ptr< SipMessage > & getNIT()
virtual void flowTerminated()
std::unique_ptr< Contents > getOfferAnswer(const SipMessage &msg)
virtual void message(const Contents &contents)
sends a message request
const SdpContents & getLocalSdp() const
bool hasLocalOfferAnswer() const
virtual void infoCommand(const Contents &contents)
std::shared_ptr< SipMessage > mLastNitResponse
bool hasProposedRemoteOfferAnswer() const
void dispatchOptions(const SipMessage &msg)
void dispatchSentReinvite(const SipMessage &msg)
void dispatchSentOptions(const SipMessage &msg)
virtual void referCommand(const NameAddr &referTo, bool referSub=true)
const SdpContents & getRemoteSdp() const
bool hasProposedRemoteSdp() const
void transition(State target)
bool isSessionModificationInFlight() const
void dispatchTerminated(const SipMessage &msg)
void setCurrentLocalOfferAnswer(const SipMessage &msg)
virtual void rejectReferNoSub(int responseCode)
std::shared_ptr< SipMessage > mLastSentNITRequest
Mimes mPeerSupportedMimeTypes
bool hasRemoteSdp() const
virtual void endCommand(EndReason reason=NotSpecified)
Asynchronously makes the specific dialog end.
bool expireSessionAfterFailedModification()
EncodeStream & dump(EncodeStream &strm) const override
std::shared_ptr< SipMessage > sendBye()
virtual void rejectNIT(int statusCode=488)
rejects an INFO or MESSAGE request with an error status code
virtual void reject(int statusCode, WarningCategory *warning=0)
Rejects an offer at the SIP level.
void dispatchSentUpdate(const SipMessage &msg)
virtual void provideAnswerCommand(const Contents &answer)
std::shared_ptr< SipMessage > getLastSentNITRequest() const
gets the last NIT request that was sent by the session
const Contents & getProposedRemoteOfferAnswer() const
NameAddrs mPeerPAssertedIdentities
void dispatchReceivedUpdateOrReinvite(const SipMessage &msg)
Tokens mPeerSupportedMethods
const Data & getEndReasonString(InviteSession::EndReason reason)
std::shared_ptr< SipMessage > mInvite200
void dispatchSentReinviteNoOffer(const SipMessage &msg)
Tokens mPeerSupportedEncodings
unsigned int mSessionExpirationTimerSeq
std::unique_ptr< Contents > mProposedRemoteOfferAnswer
std::unique_ptr< Contents > mProposedLocalOfferAnswer
std::unique_ptr< Contents > mCurrentLocalOfferAnswer
std::shared_ptr< SipMessage > mLastRemoteSessionModification
std::shared_ptr< SipMessage > mLastLocalSessionModification
bool sessionTimerSupportedLocalAndPeer() const
SipMessage mLastReferNoSubRequest
unsigned int mStaleReInviteTimerSeq
virtual void requestOffer()
Called to request that the far end provide an offer.
virtual void end() override
static std::unique_ptr< Contents > makeOfferAnswer(const Contents &offerAnswer)
DialogUsageManager::EncryptionLevel mProposedEncryptionLevel
unsigned long mCurrentRetransmit200
bool hasRemoteOfferAnswer() const
std::queue< QueuedNIT * > mNITQueue
virtual void refer(const NameAddr &referTo, bool referSub=true)
sends a refer request
void startRetransmit200Timer()
void setSessionTimerHeaders(SipMessage &msg)
bool mSessionRefreshReInvite
void dispatchSentReinviteAnswered(const SipMessage &msg)
Tokens mPeerSupportedLanguages
uint32_t mSessionInterval
void storePeerCapabilities(const SipMessage &msg)
void dispatchGlare(const SipMessage &msg)
virtual void provideOfferCommand(const Contents &offer)
Provide asynchronous method access by using command.
void dispatchConnected(const SipMessage &msg)
void dispatchReceivedReinviteSentOffer(const SipMessage &msg)
virtual void acceptNIT(int statusCode=200, const Contents *contents=0)
accepts an INFO or MESSAGE request with a 2xx and an optional contents
void checkDeferredSessionExpiration()
InviteSession(const InviteSession &)=delete
void setSessionTimerPreferences()
bool mPeerSupportsSessionTimer
virtual void onReadyToSend(SipMessage &msg) override
virtual void rejectNITCommand(int statusCode=488)
Asynchronously rejects an INFO or MESSAGE request with an error status code.
InviteSessionHandle getSessionHandle()
virtual void provideAnswer(const Contents &answer)
Similar to provideOffer - called to set the answer to be signaled to the peer.
void dispatchWaitingToOffer(const SipMessage &msg)
virtual void rejectCommand(int statusCode, WarningCategory *warning=0)
Asynchronously rejects an offer at the SIP level.
void handleSessionTimerResponse(const SipMessage &msg)
virtual void targetRefresh(const NameAddr &localUri)
will send a reINVITE (current offerAnswer) or UPDATE with new Contact header
virtual void info(const Contents &contents)
sends an info request
void dispatchMessage(const SipMessage &msg)
@ UAS_ReceivedUpdateWaitingAnswer
@ ReceivedReinviteSentOffer
@ UAS_WaitingToRequestOffer
@ UAS_FirstSentOfferReliable
@ UAS_NoAnswerReliableWaitingPrack
@ UAC_ReceivedUpdateEarly
@ UAS_FirstSentAnswerReliable
@ ReceivedReinviteNoOffer
@ UAS_ProvidedOfferReliable
@ UAC_SentUpdateEarlyGlare
@ UAS_OfferProvidedAnswer
@ UAS_OfferReliableProvidedAnswer
@ UAS_AcceptedWaitingAnswer
@ UAS_EarlyProvidedAnswer
@ SentReinviteNoOfferGlare
void dispatchWaitingToRequestOffer(const SipMessage &msg)
Tokens mPeerRequiresOptionTags
unsigned int mSessionRefreshTimerSeq
bool updateMethodSupported() const
const SdpContents & getProposedRemoteSdp() const
void referNoSub(const SipMessage &msg)
const Contents & getRemoteOfferAnswer() const
static void setOfferAnswer(SipMessage &msg, const Contents &offerAnswer, const Contents *alternative=0)
void dispatchWaitingToHangup(const SipMessage &msg)
void startStaleReInviteTimer()
std::unique_ptr< Contents > mCurrentRemoteOfferAnswer
void dispatchInfo(const SipMessage &msg)
bool mSessionExpirationPending
void dispatch(const SipMessage &msg) override
Event toEvent(const SipMessage &msg, const Contents *offeranswer)
bool isAckForCurrent200(const SipMessage &ack) const
Tokens mPeerSupportedOptionTags
virtual void acceptNITCommand(int statusCode=200, const Contents *contents=0)
Asynchronously accepts an INFO or MESSAGE request with a 2xx and an optional contents.
virtual void acceptReferNoSub(int statusCode=200)
void dispatchBye(const SipMessage &msg)
void handleSessionTimerRequest(SipMessage &response, const SipMessage &request)
bool isTerminated() const
const Contents & getLocalOfferAnswer() const
void dispatchWaitingToTerminate(const SipMessage &msg)
DialogUsageManager::EncryptionLevel getEncryptionLevel(const SipMessage &msg)
bool isReliable(const SipMessage &msg) const
virtual void messageCommand(const Contents &contents)
void provideProposedOffer()
void dispatchReinviteNoOfferGlare(const SipMessage &msg)
virtual void provideOffer(const Contents &offer)
Called to set the offer that will be used in the next message that sends an offer.
static Data toData(State state)
Tokens mPeerAllowedEvents
std::shared_ptr< SipMessage > sendAck(const Contents *answer=0)
ParserContainer< Token > mUserEndReasons
void dispatchAnswered(const SipMessage &msg)
DialogUsageManager::EncryptionLevel mCurrentEncryptionLevel
virtual Brief brief() const
return a facet for brief encoding of message
SIP body type for holding Multipart-Alternative body contents (MIME content-type multipart/alternativ...
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
void remove(const Param< NameAddr > ¶mType)
virtual void setQuoted(bool)
Parameter * getParameterByEnum(ParameterTypes::Type type) const
size_t size() const
return the size of the mParsers vector
Container class for ParserCategory, used by SipMessage to represent multi-valued headers (Contact,...
bool find(const T &rhs) const
Finds the first header field value that matches rhs.
static int getRandom()
Returns a postive integer (31 bits) of randomness.
Data & unknownMethodName()
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
static const SdpContents Empty
SignatureStatus getSignatureStatus() const
Represents a SIP message.
void setContents(const Contents *contents)
Set the contents of the message.
bool isRequest() const
Returns true if message is a request, false otherwise.
Contents * getContents() const
Retrieves the body of a SIP message.
const RequestLine & header(const RequestLineType &l) const
Returns the RequestLine. This is only valid for request messages.
virtual const Data & getTransactionId() const
Returns the transaction id from the branch or if 2543, the computed hash.
bool isResponse() const
Returns true if message is a response, false otherwise.
bool exists(const HeaderBase &headerType) const
Returns true if the given header field is present, false otherwise.
void remove(const HeaderBase &headerType)
Prevents a header field from being present when the message is prepared for sending to a transport.
const SecurityAttributes * getSecurityAttributes() const noexcept
resip::MethodTypes method() const
returns the method type of the message
static const char * C100rel
static const char * Timer
static const char * NoReferSub
Represents the "token" element in the RFC 3261 grammar.
const Data & param(const ExtensionParameter ¶m) const
Const accessor for non-natively-supported parameter types.
void post(Message *msg)
Posts a Message to this TransactionUser's fifo.
Represents the "warning-value" element in the RFC 3261 grammar.
This file is used to handle compatibility fixes/tweaks so reSIProcate can function on multiple platfo...
dcm! – add UnusedChecking(_enum) below;
const _Tp & resipMin(const _Tp &__a, const _Tp &__b)
StatusLineType h_StatusLine
H_PAssertedIdentitys h_PAssertedIdentities
RequestLineType h_RequestLine
const _Tp & resipMax(const _Tp &__a, const _Tp &__b)
Handle< InviteSession > InviteSessionHandle
H_AllowEventss h_AllowEvents