void WaitingForMediaOffer::ProvisionalResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const { if( response.getResponseStatusCode() != SIP_TRYING_CODE ) { // Both reliable and unreliable provisional responses can carry SDP bodies. According to // draft-ietf-sipping-sip-offeranswer-04.txt section 3.1, unreliable provisional responses // carrying an answer is a mere previes of what the 'real' SDP answer will be and that it // must be identical to it. Since we may be changing the SDP of the 'real' answer to compensate // for NATs we need to also manipulate the 'preview' answer to make match the requirement that // the preview and 'real' answers be identical. impl.ProcessMediaOffer( response, INITIAL_OFFER_ANSWER ); // we are receiving a provisional response - check if it is sent reliably... if( response.getHeaderValue( 0, SIP_RSEQ_FIELD ) ) { // Presence of RSeq: header in the message indicates that it is sent reliably ChangeState( impl, impl.pWaitingForPrackWithMediaAnswer ); } else { // We have received an unreliable provisional response - although that does // not cause a state machine state change, we need to reset the tick counter // to show that there is still activity in this dialog. impl.resetTimerTickCounter(); } } }
void WaitingForMediaOffer::ProvisionalResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const { if( response.getResponseStatusCode() != SIP_TRYING_CODE ) { // Both reliable and unreliable provisional responses can carry SDP bodies. According to // draft-ietf-sipping-sip-offeranswer-04.txt section 3.1, unreliable provisional responses // carrying an offer is a mere preview of what the 'real' SDP offfer will be and that it // must be identical to it. Since we may be changing the SDP of the 'real' offer to compensate // for NATs we need to also manipulate the 'preview' offer to make it meet the requirement that // the preview and 'real' offers be identical. impl.ProcessMediaOffer( response, INITIAL_OFFER_ANSWER ); // we are receiving a provisional response - check if it is sent reliably... if( response.getHeaderValue( 0, SIP_RSEQ_FIELD ) ) { // Presence of RSeq: header in the message indicates that it is sent reliably ChangeState( impl, impl.pWaitingForPrackWithMediaAnswer ); } else { // We have received an unreliable provisional response - take a copy of the // patched SDP so that it can be re-applied to subsequent responses carrying // the same SDP body. impl.savePatchedSdpPreview( response ); ChangeState( impl, impl.pWaitingFor200OkWithMediaOffer ); } } }
bool WaitingForPrack::PrackRequest( DialogTracker& impl, SipMessage& request, TransactionDirectionality direction, const char* address, int port ) const { if( request.hasSdpBody() ) { impl.ProcessMediaOffer( request, NON_INITIAL_OFFER_ANSWER ); ChangeState( impl, impl.pWaitingFor200OkWithAnswerForPrack ); } else { ChangeState( impl, impl.pWaitingFor200OkForPrack ); } return true; }
bool WaitingForInvite::InviteRequest( DialogTracker& impl, SipMessage& request, TransactionDirectionality direction, const char* address, int port ) const { bool bTrackRequestResponse = false; impl.setTransactionDirectionality( direction ); // check is another sipX is already taking care of NAT traversing this session. if( !impl.isRequestAlreadyHandledByOther( request ) ) { bTrackRequestResponse = true; impl.markRequestAsHandledByUs( request ); // check if the INVITE contains an SDP offer if( request.hasSdpBody() ) { // request contains an SDP offer. Check if the SDP or the or the actual // location of the two endpoints impose the use of a media relay. if( impl.doesEndpointsLocationImposeMediaRelay() ) { OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Media relay required", impl.name(), impl.GetCurrentState()->name() ); impl.setMediaRelayRequiredFlag(); } else { OsSysLog::add(FAC_NAT,PRI_DEBUG,"'%s:%s' - Media relay not required", impl.name(), impl.GetCurrentState()->name() ); impl.clearMediaRelayRequiredFlag(); } impl.ProcessMediaOffer( request, INITIAL_OFFER_ANSWER ); ChangeState( impl, impl.pWaitingForMediaAnswer ); } else { // request does contains an SDP offer. This INVITE may be used to set up a 3PCC // call. Play it safe and impose the use of a media relay to guarantee speechpath impl.setMediaRelayRequiredFlag(); ChangeState( impl, impl.pWaitingForMediaOffer ); } } else { // this particular session is already being handled by another sipX i nthe network. // That sipX is taking care of overcoming the NATs that separate the endpoints involved // in that session. There isn't much value we can add here so just bail on tracking that // session. ChangeState( impl, impl.pMoribund ); } return bTrackRequestResponse; }
void WaitingForMediaOffer::SuccessfulResponse( DialogTracker& impl, SipMessage& response, const char* address, int port ) const { impl.ProcessMediaOffer( response, INITIAL_OFFER_ANSWER ); ChangeState( impl, impl.pWaitingForAckWithAnswerForInvite ); }