38#define RESIPROCATE_SUBSYSTEM ReconSubsystem::RECON
63 mDialogSet(remoteParticipantDialogSet),
66 mOfferRequired(false),
67 mLocalHold(conversationManager.remoteParticipantInitialHold()),
73 mKeyframeIntervals(conversationManager.keyframeIntervals())
86 mDialogSet(remoteParticipantDialogSet),
89 mOfferRequired(false),
90 mLocalHold(conversationManager.remoteParticipantInitialHold()),
96 mKeyframeIntervals(conversationManager.keyframeIntervals())
98 InfoLog(<<
"RemoteParticipant created (UAS or forked leg), handle=" <<
mHandle);
125 auto profile = callingProfile;
128 DebugLog(<<
"initiateRemoteCall: no callingProfile supplied, calling mDialogSet.getConversationProfile()");
133 CallbackSdpReady createAndSendInvite = [
this, handleId, &cm, destination, profile, extraHeaders](
bool success, std::unique_ptr<SdpContents> offer)
135 if(!cm.getParticipant(handleId))
142 ErrLog(<<
"failed to create an SDP offer");
153 std::multimap<resip::Data,resip::Data>::const_iterator it = extraHeaders.begin();
154 for (; it != extraHeaders.end(); it++)
162 if(mPendingRequest.mType == Hold ||
163 mPendingRequest.mType == Unhold)
165 mPendingRequest.mType = None;
179 if(profile && profile->delayedMediaOutboundMode())
181 createAndSendInvite(
true, std::unique_ptr<SdpContents>(
nullptr));
199 bool alreadyExists =
false;
200 for (StringCategories::iterator it = scs.begin(); it != scs.end(); it++)
204 alreadyExists =
true;
227 Data existingHeaderValue;
237 char* buffer =
new char[existingHeaderValue.
size()];
238 memcpy(buffer, existingHeaderValue.
data(), existingHeaderValue.
size());
239 newHfvl.
push_back(buffer, existingHeaderValue.
size(),
true );
246 char* buffer =
new char[headerValue.
size()];
247 memcpy(buffer, headerValue.
data(), headerValue.
size());
250 invitemsg->setRawHeader(&newHfvl, headerType);
255 WarningLog(<<
"Discarding header '" << headerName <<
"', invalid value format '" << headerValue <<
"': " << ex);
264 if(mState != Terminating)
266 stateTransition(Terminating);
276 if (mInviteSessionHandle.
isValid())
279 if (mReferSubscriptionHandle.
isValid())
281 mReferSubscriptionHandle->end();
284 mInviteSessionHandle->
end();
295 WarningLog(<<
"RemoteParticipant::destroyParticipant exception: " << e);
299 WarningLog(<<
"RemoteParticipant::destroyParticipant unknown exception");
324 bool shouldHold =
true;
325 ConversationMap::iterator it;
328 if(!it->second->shouldHold())
340 if(mLocalHold != _hold)
358 if (mState != Terminating)
360 if (mInviteSessionHandle.
isValid())
362 mInviteSessionHandle->
message(*contents.get());
368 WarningLog(<<
"RemoteParticipant::sendInstantMessage exception: " << e);
372 WarningLog(<<
"RemoteParticipant::sendInstantMessage unknown exception");
377RemoteParticipant::stateTransition(
State state)
384 stateName =
"Connecting";
break;
386 stateName =
"Accepted";
break;
388 stateName =
"Connected";
break;
390 stateName =
"Redirecting";
break;
392 stateName =
"Holding";
break;
394 stateName =
"Unholding";
break;
396 stateName =
"Replacing";
break;
397 case PendingOODRefer:
398 stateName =
"PendingOODRefer";
break;
400 stateName =
"Terminating";
break;
402 stateName =
"Unknown: " +
Data(state);
break;
404 InfoLog( <<
"RemoteParticipant::stateTransition of handle=" <<
mHandle <<
" to state=" << stateName );
407 if(mState == Connected && mPendingRequest.mType != None)
409 PendingRequestType type = mPendingRequest.mType;
410 mPendingRequest.mType = None;
420 redirect(mPendingRequest.mDestination, mPendingRequest.mRedirectSuccessCondition, mPendingRequest.mRedirectSuccessCondition);
423 redirectToParticipant(mPendingRequest.mDestInviteSessionHandle, mPendingRequest.mRedirectSuccessCondition);
443 if(mState == Connecting && mInviteSessionHandle.
isValid())
450 WarningLog(<<
"RemoteParticipant::accept cannot accept call, since no free RTP ports, rejecting instead.");
455 if(mPendingRequest.mType == Hold ||
456 mPendingRequest.mType == Unhold)
458 mPendingRequest.mType = None;
464 else if(mPendingOffer)
466 provideAnswer(*mPendingOffer,
true ,
false );
474 mDialogSet.
accept(mInviteSessionHandle);
475 stateTransition(Accepted);
480 else if(mState == PendingOODRefer)
486 WarningLog(<<
"RemoteParticipant::accept called in invalid state: " << mState);
491 WarningLog(<<
"RemoteParticipant::accept exception: " << e);
495 WarningLog(<<
"RemoteParticipant::accept unknown exception");
504 if(mState == Connecting && mInviteSessionHandle.
isValid())
509 if(earlyFlag && mPendingOffer)
513 WarningLog(<<
"RemoteParticipant::alert cannot alert call with early media, since no free RTP ports, rejecting instead.");
518 provideAnswer(*mPendingOffer,
false ,
true );
528 WarningLog(<<
"RemoteParticipant::alert called in invalid state: " << mState);
533 WarningLog(<<
"RemoteParticipant::alert exception: " << e);
537 WarningLog(<<
"RemoteParticipant::alert unknown exception");
547 if(mState == Connecting && mInviteSessionHandle.
isValid())
556 else if(mState == PendingOODRefer)
562 WarningLog(<<
"RemoteParticipant::reject called in invalid state: " << mState);
567 WarningLog(<<
"RemoteParticipant::reject exception: " << e);
571 WarningLog(<<
"RemoteParticipant::reject unknown exception");
582 if (mState == Connecting && mInviteSessionHandle.
isValid())
592 if (redirectCode < 300 || redirectCode > 399)
594 WarningLog(<<
"RemoteParticipant::redirect: invalid redirect code of " << redirectCode <<
" provided, using 302 instead");
597 sis->
redirect(destinations, redirectCode);
602 if(mPendingRequest.mType == None)
604 if((mState == Connecting || mState == Accepted || mState == Connected) && mInviteSessionHandle.
isValid())
608 mRedirectSuccessCondition = successCondition;
610 stateTransition(Redirecting);
614 mPendingRequest.mType = Redirect;
615 mPendingRequest.mDestination = destination;
616 mPendingRequest.mRedirectCode = redirectCode;
617 mPendingRequest.mRedirectSuccessCondition = successCondition;
620 else if(mState == PendingOODRefer)
626 mPendingRequest.mType = Redirect;
627 mPendingRequest.mDestination = destination;
628 mPendingRequest.mRedirectCode = redirectCode;
629 mPendingRequest.mRedirectSuccessCondition = successCondition;
634 WarningLog(<<
"RemoteParticipant::redirect error: request pending");
640 WarningLog(<<
"RemoteParticipant::redirect exception: " << e);
644 WarningLog(<<
"RemoteParticipant::redirect unknown exception");
653 if(destParticipantInviteSessionHandle.
isValid())
655 if(mPendingRequest.mType == None)
657 if((mState == Connecting || mState == Accepted || mState == Connected) && mInviteSessionHandle.
isValid())
661 if(sis && !sis->
isAccepted() && mState == Connecting)
670 mRedirectSuccessCondition = successCondition;
671 mInviteSessionHandle->
refer(
NameAddr(destParticipantInviteSessionHandle->
peerAddr().
uri()) , destParticipantInviteSessionHandle ,
true );
672 stateTransition(Redirecting);
676 mPendingRequest.mType = RedirectTo;
677 mPendingRequest.mDestInviteSessionHandle = destParticipantInviteSessionHandle;
678 mPendingRequest.mRedirectSuccessCondition = successCondition;
683 mPendingRequest.mType = RedirectTo;
684 mPendingRequest.mDestInviteSessionHandle = destParticipantInviteSessionHandle;
685 mPendingRequest.mRedirectSuccessCondition = successCondition;
690 WarningLog(<<
"RemoteParticipant::redirectToParticipant error: request pending");
696 WarningLog(<<
"RemoteParticipant::redirectToParticipant error: destParticipant has no valid InviteSession");
702 WarningLog(<<
"RemoteParticipant::redirectToParticipant exception: " << e);
706 WarningLog(<<
"RemoteParticipant::redirectToParticipant unknown exception");
715 if(mPendingRequest.mType == None)
717 bool readyForInfo = (mState == Connected);
726 if(mInviteSessionHandle.
isValid())
728 DebugLog(<<
"sending an INFO message");
729 mInviteSessionHandle->
info(contents);
733 WarningLog(<<
"RemoteParticipant::info error: mInviteSessionHandle not valid");
738 WarningLog(<<
"RemoteParticipant::info error: mState not connected");
743 WarningLog(<<
"RemoteParticipant::info error: request pending");
748 WarningLog(<<
"RemoteParticipant::info exception: " << e);
752 WarningLog(<<
"RemoteParticipant::info unknown exception");
761 InfoLog(<<
"RemoteParticipant::hold request: handle=" <<
mHandle);
765 if(mPendingRequest.mType == None)
767 if(mState == Connected && mInviteSessionHandle.
isValid())
770 stateTransition(Holding);
774 mPendingRequest.mType = Hold;
777 else if(mPendingRequest.mType == Unhold)
779 mPendingRequest.mType = None;
782 else if(mPendingRequest.mType == Hold)
788 WarningLog(<<
"RemoteParticipant::hold error: request already pending");
793 WarningLog(<<
"RemoteParticipant::hold exception: " << e);
797 WarningLog(<<
"RemoteParticipant::hold unknown exception");
806 InfoLog(<<
"RemoteParticipant::unhold request: handle=" <<
mHandle);
810 if(mPendingRequest.mType == None)
812 if(mState == Connected && mInviteSessionHandle.
isValid())
815 stateTransition(Unholding);
819 mPendingRequest.mType = Unhold;
822 else if(mPendingRequest.mType == Hold)
824 mPendingRequest.mType = None;
827 else if(mPendingRequest.mType == Unhold)
833 WarningLog(<<
"RemoteParticipant::unhold error: request already pending");
838 WarningLog(<<
"RemoteParticipant::unhold exception: " << e);
842 WarningLog(<<
"RemoteParticipant::unhold unknown exception");
849 auto now = std::chrono::steady_clock::now();
850 if(now < (mLastRemoteKeyframeRequest + mKeyframeRequestInterval))
852 DebugLog(<<
"keyframe request ignored, too soon");
855 mLastRemoteKeyframeRequest = now;
856 std::shared_ptr<resip::SdpContents> _sdp =
getRemoteSdp();
857 std::set<Data> streamIDs;
860 WarningLog(<<
"we need to request a keyframe but there is no peer SDP");
864 streamIDs = _sdp->session().getMediaStreamLabels();
865 if(streamIDs.empty())
867 WarningLog(<<
"peer SDP does not contain a stream ID (RFC 4574)");
870 DebugLog(<<
"requesting a keyframe for stream(s)");
879 if(mKeyframeIntervals.empty())
886 mCurrentIntervalIndex = 0;
888 auto now = std::chrono::steady_clock::now();
889 std::chrono::seconds t = std::chrono::seconds(mKeyframeIntervals[mCurrentIntervalIndex]);
890 if(now < (mLastRemoteKeyframeRequest + t))
892 DebugLog(<<
"keyframe timeout ignored, too soon");
896 if(mCurrentIntervalIndex < mKeyframeIntervals.size()-1)
898 mCurrentIntervalIndex++;
916 bool stateChanged = (remoteHold != mRemoteHold);
917 mRemoteHold = remoteHold;
927 stateTransition(PendingOODRefer);
928 mPendingOODReferMsg = referMsg;
929 mPendingOODReferNoSubHandle = ood;
935 stateTransition(PendingOODRefer);
936 mPendingOODReferMsg = referMsg;
937 mPendingOODReferSubHandle = ss;
943 if(mState == PendingOODRefer)
945 std::shared_ptr<UserProfile> profile;
946 bool accepted =
false;
947 if(mPendingOODReferNoSubHandle.
isValid())
949 mPendingOODReferNoSubHandle->send(mPendingOODReferNoSubHandle->accept(202));
950 profile = mPendingOODReferNoSubHandle->getUserProfile();
953 else if(mPendingOODReferSubHandle.
isValid())
955 mPendingOODReferSubHandle->
send(mPendingOODReferSubHandle->
accept(202));
964 buildSdpOffer(mLocalHold, [
this, handleId, &cm, profile](
bool success, std::unique_ptr<SdpContents> _offer)
966 if(!cm.getParticipant(handleId))
968 WarningLog(<<
"handle no longer valid");
973 ErrLog(<<
"failed to create an SDP offer");
974 mConversationManager.onParticipantTerminated(mHandle, 500,
"Failed to create SDP offer");
982 mPendingOODReferSubHandle,
991 stateTransition(Connecting);
996 WarningLog(<<
"acceptPendingOODRefer - no valid handles");
1006 if(mState == PendingOODRefer)
1008 if(mPendingOODReferNoSubHandle.
isValid())
1010 mPendingOODReferNoSubHandle->send(mPendingOODReferNoSubHandle->reject(statusCode));
1013 else if(mPendingOODReferSubHandle.
isValid())
1015 mPendingOODReferSubHandle->
send(mPendingOODReferSubHandle->
reject(statusCode));
1020 WarningLog(<<
"rejectPendingOODRefer - no valid handles");
1030 if(mState == PendingOODRefer)
1032 if(mPendingOODReferNoSubHandle.
isValid())
1034 auto redirect = mPendingOODReferNoSubHandle->reject(302 );
1035 redirect->header(h_Contacts).clear();
1036 redirect->header(h_Contacts).push_back(destination);
1037 mPendingOODReferNoSubHandle->send(
redirect);
1040 else if(mPendingOODReferSubHandle.
isValid())
1043 redirect->header(h_Contacts).clear();
1044 redirect->header(h_Contacts).push_back(destination);
1050 WarningLog(<<
"redirectPendingOODRefer - no valid handles");
1060 unsigned int code = 400;
1062 mReferSubscriptionHandle = h;
1077 if (mState == Redirecting)
1081 stateTransition(Connected);
1086 code >= 180 && code <= 189)
1088 if (mState == Redirecting)
1092 stateTransition(Connected);
1095 else if(code >= 200 && code < 300)
1097 if(mState == Redirecting)
1101 stateTransition(Connected);
1104 else if(code >= 300)
1106 if(mState == Redirecting)
1109 stateTransition(Connected);
1122 localSdp = mLocalSdpGathering;
1126 WarningLog(<<
"localSdp not available, can't create ICE SDP fragment");
1133 auto ice = localSdp->session().makeIceFragment(
Data(candidate),
1137 StackLog(<<
"about to send " << *ice);
1142 WarningLog(<<
"failed to create ICE fragment for mid: " << mid);
1147RemoteParticipant::provideOffer(
bool postOfferAccept,
bool preferExistingSdp)
1153 buildSdpOffer(mLocalHold,[
this, handleId, &cm, postOfferAccept](
bool success, std::unique_ptr<SdpContents> offer)
1155 if(!cm.getParticipant(handleId))
1157 WarningLog(<<
"handle no longer valid");
1162 ErrLog(<<
"buildSdpOffer failed");
1163 mConversationManager.onParticipantTerminated(mHandle, 500,
"Failed to create SDP offer");
1167 mDialogSet.
provideOffer(std::move(offer), mInviteSessionHandle, postOfferAccept);
1168 mOfferRequired =
false;
1169 }, preferExistingSdp);
1173RemoteParticipant::provideAnswer(
const SdpContents& offer,
bool postAnswerAccept,
bool postAnswerAlert)
1177 buildSdpAnswer(offer, [
this, h, postAnswerAccept, postAnswerAlert](
bool answerOk, std::unique_ptr<SdpContents> answer)
1181 WarningLog(<<
"handle no longer valid");
1186 mDialogSet.provideAnswer(std::move(answer), mInviteSessionHandle, postAnswerAccept, postAnswerAlert);
1187 if(postAnswerAccept && mState == Replacing)
1189 stateTransition(Connecting);
1194 ErrLog(<<
"buildSdpAnswer failed");
1195 mInviteSessionHandle->
reject(488);
1197 mPendingOffer.reset();
1205 ConversationMap::iterator it;
1206 for(it = temp.begin(); it != temp.end(); it++)
1208 it->second->destroy();
1215 stateTransition(Terminating);
1217 ConversationMap::iterator it;
1220 it->second->unregisterParticipant(
this);
1244 InfoLog(<<
"setLocalSdp: handle=" <<
mHandle <<
", localSdp=" << sdp);
1246 mLocalSdpGathering.reset();
1252 InfoLog(<<
"setRemoteSdp: handle=" <<
mHandle <<
", remoteSdp=" << sdp);
1263 InfoLog(<<
"setLocalSdpGathering: handle=" <<
mHandle <<
", localSdpGathering=" << sdp);
1268RemoteParticipant::replaceWithParticipant(
Participant* _replacingParticipant)
1272 replacingParticipant->mLocalHold = mLocalHold;
1288 mInviteSessionHandle = h->getSessionHandle();
1297 mInviteSessionHandle = h->getSessionHandle();
1301 if(msg.
exists(h_Replaces))
1303 pair<InviteSessionHandle, int> presult;
1311 participantToReplace->replaceWithParticipant(
this);
1315 stateTransition(Replacing);
1323 bool autoAnswer =
false;
1326 bool autoAnswerRequired;
1328 if(!autoAnswer && autoAnswerRequired)
1332 warning.
code() = 399;
1333 warning.
text() =
"automatic answer forbidden";
1335 h->reject(403 , &warning);
1341 WarningLog(<<
"bypassing logic for Auto-Answer");
1357 stateTransition(Terminating);
1406 ConversationMap::const_iterator it;
1426 stateTransition(Connected);
1431 DebugLog(<<
"ending forked call leg, another leg already answered");
1441 stateTransition(Connected);
1453 stateTransition(Connected);
1466 stateTransition(Terminating);
1467 Data callbackReason;
1471 callbackReason =
"RemoteBye";
1472 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", received a BYE from peer");
1475 callbackReason =
"RemoteCancel";
1476 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", received a CANCEL from peer");
1479 callbackReason =
"Rejected";
1480 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", received a rejection from peer");
1483 callbackReason =
"LocalBye";
1484 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", ended locally via BYE");
1487 callbackReason =
"LocalCancel";
1488 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", ended locally via CANCEL");
1491 callbackReason =
"Replaced";
1492 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", ended due to being replaced");
1495 callbackReason =
"Referred";
1496 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", ended due to being reffered");
1499 callbackReason =
"Error";
1500 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", ended due to an error");
1503 callbackReason =
"Timeout";
1504 InfoLog(<<
"onTerminated: handle=" <<
mHandle <<
", ended due to a timeout");
1510 unsigned int statusCode = 0;
1517 if (msg->
exists(h_Reasons) && msg->
header(h_Reasons).size() > 0)
1520 callbackReason +=
": ";
1526 if(
mHandle && mReferringAppDialog.isValid())
1530 replaceWithParticipant(participant);
1562 stateTransition(Connected);
1569 if(mState == Connecting && mInviteSessionHandle.
isValid())
1576 mPendingOffer = std::unique_ptr<SdpContents>(
static_cast<SdpContents*
>(offer.
clone()));
1583 WarningLog(<<
"RemoteParticipant::onOffer cannot continue due to no free RTP ports, rejecting offer.");
1588 provideAnswer(offer, mState==Replacing ,
false );
1604 mOfferRequired =
true;
1610 WarningLog(<<
"RemoteParticipant::onOfferRequired cannot continue due to no free RTP ports, rejecting offer request.");
1615 provideOffer(mState == Replacing );
1616 if(mState == Replacing)
1618 stateTransition(Connecting);
1655 InfoLog(<<
"onMediaControlEvent: not implemented by this ConversationManager");
1662 InfoLog(<<
"onTrickleIce: not implemented by this ConversationManager");
1672 bool accepted =
false;
1684 if(mediaControlContents)
1695 if(trickleIceContents)
1706 WarningLog(<<
"INFO message without recognized payload content-type, rejecting");
1712 WarningLog(<<
"INFO message received, but mHandle not set, rejecting");
1740 bool holdSdp = mLocalHold;
1758 participant->mReferringAppDialog =
getHandle();
1760 replaceWithParticipant(participant);
1764 participant->
buildSdpOffer(holdSdp, [
this, h, msg, profile, ss, participantDialogSet, participant](
bool success, unique_ptr<SdpContents> _offer)
1768 WarningLog(<<
"handle no longer valid");
1773 ErrLog(<<
"failed to create an SDP offer");
1774 mConversationManager.onParticipantTerminated(mHandle, 500,
"Failed to create SDP offer");
1781 participantDialogSet->
sendInvite(NewInviteMsg);
1802 bool holdSdp = mLocalHold;
1820 participant->mReferringAppDialog =
getHandle();
1822 replaceWithParticipant(participant);
1827 participant->
buildSdpOffer(holdSdp, [
this, handleId, &cm, msg, profile, participantDialogSet, participant](
bool success, unique_ptr<SdpContents> _offer)
1829 if(!cm.getParticipant(handleId))
1831 WarningLog(<<
"handle no longer valid");
1836 ErrLog(<<
"failed to create SDP offer");
1837 mConversationManager.onParticipantTerminated(mHandle, 500,
"Failed to create SDP offer");
1844 participantDialogSet->
sendInvite(NewInviteMsg);
1865 WarningLog(<<
"onReferNoSub exception: " << e);
1869 WarningLog(<<
"onReferNoSub unknown exception");
1883 if(msg.
isResponse() && mState == Redirecting)
1886 stateTransition(Connected);
1910 if (remoteDisplayName.
empty())
1915 ConversationMap::iterator it;
1918 it->second->relayInstantMessageToRemoteParticipants(
mHandle, remoteDisplayName, msg);
1936 std::unique_ptr<Contents> contents(failedMessage->getContents()->clone());
1954 if (notify.
exists(h_Event) && notify.
header(h_Event).value() ==
"refer")
1961 h->rejectUpdate(400,
Data(
"Only notifies for refers are allowed."));
1969 if (notify.
exists(h_Event) && notify.
header(h_Event).value() ==
"refer")
1976 h->rejectUpdate(400,
Data(
"Only notifies for refers are allowed."));
1984 if (notify.
exists(h_Event) && notify.
header(h_Event).value() ==
"refer")
1991 h->rejectUpdate(400,
Data(
"Only notifies for refers are allowed."));
2006 else if(notify->
isResponse() && mState == Redirecting)
2009 stateTransition(Connected);
2016 if(mState == Redirecting)
2019 stateTransition(Connected);
#define WarningLog(args_)
#define resip_assert(x)
This file needs to work for both C and C++ code.
This class is one of two main classes of concern to an application using the UserAgent library.
virtual void onParticipantSendIMFailure(ParticipantHandle partHandle, const resip::SipMessage &status, std::unique_ptr< resip::Contents > contents)
Notifies an application that a send IM call has failed.
virtual void onParticipantConnectedConfirmed(ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application that an inbound remote participant call now fully connected after answering (...
virtual void onParticipantConnected(ParticipantHandle partHandle, const resip::SipMessage &msg)=0
Notifies an application that a remote participant call attempt is now connected.
MediaStackAdapter & getMediaStackAdapter()
virtual void onParticipantAlerting(ParticipantHandle partHandle, const resip::SipMessage &msg)=0
Notifies an application that a remote participant call attempt is alerting the remote party.
virtual void onParticipantRequestedHold(ParticipantHandle partHandle, bool held)=0
virtual void onDtmfEvent(ParticipantHandle partHandle, int dtmf, int duration, bool up)=0
Notifies an application when an RFC2833 DTMF event is received from a particular remote participant.
virtual void onParticipantRedirectFailure(ParticipantHandle partHandle, unsigned int statusCode)=0
Notifies an application that a redirect request has failed.
@ RedirectSuccessOnRinging
@ RedirectSuccessOnTrying
virtual void onIncomingParticipant(ParticipantHandle partHandle, const resip::SipMessage &msg, bool autoAnswer, ConversationProfile &conversationProfile)=0
Notifies an application about a new remote participant that is attempting to contact it.
virtual bool onReceiveIMFromParticipant(ParticipantHandle partHandle, const resip::SipMessage &msg)
Notifies an application about a subsequent message from remote and existing IM participant.
virtual void onParticipantTerminated(ParticipantHandle partHandle, unsigned int statusCode)=0
Notifies an application about a disconnect by a remote participant.
virtual void onParticipantRedirectSuccess(ParticipantHandle partHandle)=0
Notifies an application that a redirect request has succeeded.
virtual void onParticipantDestroyed(ParticipantHandle partHandle)=0
Notifies an application when a Participant has been destroyed.
virtual RemoteParticipantDialogSet * createRemoteIMSessionParticipantDialogSetInstance(ConversationManager::ParticipantForkSelectMode forkSelectMode=ConversationManager::ForkSelectAutomatic, std::shared_ptr< ConversationProfile > conversationProfile=nullptr)
This class extends the resip UserProfile to include Conversation Manager specific settings.
virtual bool shouldAutoAnswer(const resip::SipMessage &inviteRequest, bool *required=0)
Checks an Invite message for auto-answer headers against the current allow settings.
This class is used to manage membership of participants.
ConversationHandle getHandle()
virtual void confirmParticipant(Participant *participant)
This class represents base functionality for a participant that supports IMs.
This is the base class for a RemoteParticipant, LocalParticipant and a MediaResourceParticipant.
virtual void removeFromConversation(Conversation *conversation)
virtual void applyBridgeMixWeights()
ConversationMap mConversations
virtual void setHandle(ParticipantHandle partHandle)
std::map< ConversationHandle, Conversation * > ConversationMap
virtual void addToConversation(Conversation *conversation, unsigned int inputGain=100, unsigned int outputGain=100)
virtual ParticipantHandle getParticipantHandle()
ParticipantHandle mHandle
virtual void replaceWithParticipant(Participant *replacingParticipant)
ConversationManager & mConversationManager
This class represents an IM Session remote participant.
This class is used by Invite DialogSets.
virtual bool isUACConnected()
virtual void endIncludeRelated(ParticipantHandle requestingParticipant)
virtual std::shared_ptr< resip::SdpContents > getProposedSdp()
virtual void removeDialog(const resip::DialogId &dialogId)
std::shared_ptr< ConversationProfile > getConversationProfile()
void provideOffer(std::unique_ptr< resip::SdpContents > offer, resip::InviteSessionHandle &inviteSessionHandle, bool postOfferAccept)
virtual void setActiveRemoteParticipantHandle(ParticipantHandle handle)
virtual void setProposedSdp(ParticipantHandle handle, const resip::SdpContents &sdp)
virtual RemoteParticipant * createUACOriginalRemoteParticipant(ParticipantHandle handle)
virtual ParticipantHandle getActiveRemoteParticipantHandle()
void sendInvite(std::shared_ptr< resip::SipMessage > invite)
void accept(resip::InviteSessionHandle &inviteSessionHandle)
virtual bool isStaleFork(const resip::DialogId &dialogId)
virtual void setUACConnected(const resip::DialogId &dialogId, ParticipantHandle partHandle)
virtual ConversationManager::ParticipantForkSelectMode getForkSelectMode()
This class represent a remote participant.
virtual void onConnectedConfirmed(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onNewSession(resip::ClientInviteSessionHandle h, resip::InviteSession::OfferAnswerType oat, const resip::SipMessage &msg)
virtual void notifyTerminating()
virtual void onFailure(resip::ClientInviteSessionHandle h, const resip::SipMessage &msg)
virtual void processReferNotify(resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify)
virtual void onUpdateExtension(resip::ClientSubscriptionHandle, const resip::SipMessage ¬ify, bool outOfOrder)
void setProposedSdp(const resip::SdpContents &sdp)
void setRemoteSdp(const resip::SdpContents &sdp, bool answer=false)
virtual void onRedirected(resip::ClientInviteSessionHandle, const resip::SipMessage &msg)
virtual void destroyConversations()
virtual void requestKeyframeFromPeerTimeout(bool reset)
virtual void redirectToParticipant(resip::InviteSessionHandle &destParticipantInviteSessionHandle, ConversationManager::RedirectSuccessCondition successCondition=ConversationManager::RedirectSuccessOnConnected)
virtual void checkHoldCondition()
virtual int onRequestRetry(resip::ClientSubscriptionHandle h, int retryMinimum, const resip::SipMessage ¬ify)
virtual void onRemoteSdpChanged(resip::InviteSessionHandle, const resip::SipMessage &msg, const resip::SdpContents &sdp)
virtual void onRefer(resip::InviteSessionHandle, resip::ServerSubscriptionHandle, const resip::SipMessage &msg)
virtual void onLocalIceCandidate(const resip::Data &candidate, unsigned int lineIndex, const resip::Data &mid)
virtual void redirect(resip::NameAddr &destination, unsigned int redirectCode=302, ConversationManager::RedirectSuccessCondition successCondition=ConversationManager::RedirectSuccessOnConnected)
virtual void rejectPendingOODRefer(unsigned int statusCode)
virtual void onMessageFailure(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onOfferRequestRejected(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onUpdatePending(resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify, bool outOfOrder)
virtual bool onMediaControlEvent(resip::MediaControlContents::MediaControl &mediaControl)
virtual void initiateRemoteCall(const resip::NameAddr &destination)
virtual bool mediaStackPortAvailable()=0
virtual void setPendingOODReferInfo(resip::ServerOutOfDialogReqHandle ood, const resip::SipMessage &referMsg)
virtual void onOffer(resip::InviteSessionHandle handle, const resip::SipMessage &msg, const resip::SdpContents &offer)
virtual void onInfo(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void setLocalHold(bool hold)
virtual void onReferRejected(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onInfoSuccess(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onReferNoSub(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void enableTrickleIce()
std::function< void(bool sdpOk, std::unique_ptr< resip::SdpContents > sdp)> CallbackSdpReady
void addExtraHeader(const std::shared_ptr< resip::SipMessage > &invitemsg, const resip::Data &headerName, const resip::Data &headerValue)
virtual void sendInstantMessage(std::unique_ptr< resip::Contents > contents) override
virtual void onUpdateActive(resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify, bool outOfOrder)
virtual void onNewSubscription(resip::ClientSubscriptionHandle h, const resip::SipMessage ¬ify)
void setLocalSdp(const resip::SdpContents &sdp)
virtual void onConnected(resip::ClientInviteSessionHandle h, const resip::SipMessage &msg)
virtual ~RemoteParticipant()
void setLocalSdpGathering(const resip::SdpContents &sdp)
virtual void onOfferRequired(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void addToConversation(Conversation *conversation, unsigned int inputGain=100, unsigned int outputGain=100) override
std::shared_ptr< resip::SdpContents > getLocalSdp()
virtual void onProvisional(resip::ClientInviteSessionHandle, const resip::SipMessage &msg)
virtual void notifyIncomingParticipant(const resip::SipMessage &msg, bool autoAnswer, ConversationProfile &conversationProfile)
virtual void onForkDestroyed(resip::ClientInviteSessionHandle)
virtual void info(const resip::Contents &contents)
virtual void onMessage(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onStaleCallTimeout(resip::ClientInviteSessionHandle)
virtual void acceptPendingOODRefer()
virtual void onAnswer(resip::InviteSessionHandle, const resip::SipMessage &msg, const resip::SdpContents &)
virtual void removeFromConversation(Conversation *conversation) override
virtual void conversationsConfirm()
std::shared_ptr< resip::SdpContents > getRemoteSdp()
virtual void buildSdpOffer(bool holdSdp, CallbackSdpReady sdpReady, bool preferExistingSdp=false)=0
virtual bool onTrickleIce(resip::TrickleIceContents &trickleIce)
virtual void destroyParticipant() override
virtual void onReferAccepted(resip::InviteSessionHandle, resip::ClientSubscriptionHandle, const resip::SipMessage &msg)
virtual void doReferNoSub(const resip::SipMessage &msg)
virtual void adjustRTPStreams(bool sendingOffer=false)=0
virtual bool holdPreferExistingSdp()
virtual void reject(unsigned int rejectCode)
virtual void onEarlyMedia(resip::ClientInviteSessionHandle, const resip::SipMessage &, const resip::SdpContents &)
virtual void onMessageSuccess(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void requestKeyframeFromPeer()
virtual resip::InviteSessionHandle & getInviteSessionHandle()
virtual void alert(bool earlyFlag)
void setRemoteHold(bool remoteHold)
RemoteParticipant(ParticipantHandle partHandle, ConversationManager &conversationManager, resip::DialogUsageManager &dum, RemoteParticipantDialogSet &remoteParticipantDialogSet)
virtual void onInfoFailure(resip::InviteSessionHandle, const resip::SipMessage &msg)
virtual void onOfferRejected(resip::InviteSessionHandle, const resip::SipMessage *msg)
virtual void onTerminated(resip::InviteSessionHandle h, resip::InviteSessionHandler::TerminatedReason reason, const resip::SipMessage *msg)
virtual void redirectPendingOODRefer(resip::NameAddr &destination)
AppDialogHandle getHandle()
DialogId getDialogId() const
The abstract base-class for all exceptions thrown by resip code.
Base class for all SIP body types.
const Mime & getType() const
getter for mime type of message
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
static const Data Empty
Constant that represents a zero-length data.
const char * c_str() const
Returns a null-terminated string representing.
bool empty() const noexcept
Checks whether the Data is empty.
size_type size() const noexcept
Returns the number of bytes in this Data.
static Data from(const T &x)
Converts from arbitrary other type to Data.
const char * data() const noexcept
Returns a pointer to the contents of this Data.
const Data & getCallId() const
std::shared_ptr< SipMessage > makeInviteSession(const NameAddr &target, const std::shared_ptr< UserProfile > &userProfile, const Contents *initialOffer, AppDialogSet *ads=nullptr)
InviteSessionHandle findInviteSession(const DialogId &id)
std::shared_ptr< SipMessage > makeInviteSessionFromRefer(const SipMessage &refer, ServerSubscriptionHandle, const Contents *initialOffer, AppDialogSet *=nullptr)
std::shared_ptr< UserProfile > getUserProfile() const
const NameAddr & myAddr() const noexcept
const NameAddr & peerAddr() const noexcept
static const Data & getLocalHostName()
int getDuration() const
obtain duration in milliseconds
unsigned short getEventCode() const
obtain representation of the button as event code
DtmfPayload & dtmfPayload()
get the parsed payload
static Handle< InviteSession > NotValid()
TerminatedReason
called when an dialog enters the terminated state - this can happen after getting a BYE,...
@ Referred
slg! - This is really Redirected - not sure why it is called Referred. Only gets used when we send a ...
virtual void message(const Contents &contents)
sends a message request
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.
std::shared_ptr< SipMessage > getLastSentNITRequest() const
gets the last NIT request that was sent by the session
virtual void refer(const NameAddr &referTo, bool referSub=true)
sends a refer request
virtual void end(const Data &userReason)
Makes the specific dialog end.
virtual void acceptNIT(int statusCode=200, const Contents *contents=0)
accepts an INFO or MESSAGE request with a 2xx and an optional contents
virtual void info(const Contents &contents)
sends an info request
virtual void acceptReferNoSub(int statusCode=200)
MediaControl & mediaControl()
get the parsed payload
virtual Brief brief() const
return a facet for brief encoding of message
Represents the "name-addr" and the "addr-spec" elements in the RFC 3261 grammar.
void push_back(const T &t)
Inserts a header field value at the back of this container.
bool isTrickleIceSupported() const
determine if ice-options:trickle is present
Provides an interface to process and generate SDP bodies (MIME content-type application/sdp).
virtual Contents * clone() const
duplicate an SdpContents object
Session & session()
get the parsed SDP
void redirect(const NameAddrs &contacts, int code=302)
send a 3xx
virtual void reject(int statusCode, WarningCategory *warning=0)
Rejects an offer at the SIP level.
void provisional(int code=180, bool earlyFlag=true)
send a 1xx - provisional response.
ServerSubscriptionHandle getHandle() const
std::shared_ptr< SipMessage > accept(int statusCode=202)
void send(std::shared_ptr< SipMessage > msg) override
std::shared_ptr< SipMessage > reject(int responseCode)
SIP body type for holding SipFrag contents (MIME content-type message/sipfrag).
Represents a SIP 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.
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.
Represents the "header-value" element in the RFC 3261 grammar (ie, an unknown header field value).
static const Mime & getStaticType()
Data getAOR(bool addPort) const
Represents the "warning-value" element in the RFC 3261 grammar.
unsigned int ParticipantHandle
dcm! – add UnusedChecking(_enum) below;
StatusLineType h_StatusLine
bool isEqualNoCase(const Data &left, const Data &right)
RequestLineType h_RequestLine