/[resiprocate]/main/resip/dum/InviteSession.cxx
ViewVC logotype

Diff of /main/resip/dum/InviteSession.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5575 by sgodin, Wed Oct 26 13:45:32 2005 UTC revision 5586 by sgodin, Fri Oct 28 21:01:13 2005 UTC
# Line 401  Line 401 
401    
402        case SentReinviteAnswered:        case SentReinviteAnswered:
403           transition(Connected);           transition(Connected);
404           sendAck(&answer);           sendAck(mLastSessionModification, &answer);
405    
406           mCurrentRemoteSdp = mProposedRemoteSdp;           mCurrentRemoteSdp = mProposedRemoteSdp;
407           mCurrentLocalSdp = InviteSession::makeSdp(answer);           mCurrentLocalSdp = InviteSession::makeSdp(answer);
# Line 659  Line 659 
659  void  void
660  InviteSession::dispatch(const SipMessage& msg)  InviteSession::dispatch(const SipMessage& msg)
661  {  {
662       // Look for 2xx retransmissions - resend ACK and filter out of state machine
663       if(msg.header(h_CSeq).method() == INVITE && msg.isResponse() && msg.header(h_StatusLine).statusCode() / 200 == 1)
664       {
665          AckMap::iterator i = mAcks.find(msg.header(h_CSeq).sequence());
666          if (i != mAcks.end())
667          {
668             send(i->second);  // resend ACK
669             return;
670          }
671       }
672    
673     // !jf! do we need to handle 3xx here or is it handled elsewhere?     // !jf! do we need to handle 3xx here or is it handled elsewhere?
674     switch (mState)     switch (mState)
675     {     {
# Line 767  Line 778 
778           }           }
779        }        }
780     }     }
781       else if (timeout.type() == DumTimeout::CanDiscardAck)
782       {
783          AckMap::iterator i = mAcks.find(timeout.seq());
784          if (i != mAcks.end())
785          {
786             mAcks.erase(i);
787          }
788       }
789     else if (timeout.type() == DumTimeout::Glare)     else if (timeout.type() == DumTimeout::Glare)
790     {     {
791        if (mState == SentUpdateGlare)        if (mState == SentUpdateGlare)
# Line 847  Line 866 
866        case On2xxAnswer:        case On2xxAnswer:
867           // retransmission of 200I           // retransmission of 200I
868           // !jf! Need to include the answer here.           // !jf! Need to include the answer here.
869           sendAck();           sendAck(mLastSessionModification);  // !slg! ?????????  Look up ACK map???
870           break;           break;
871    
872        case OnUpdateOffer:        case OnUpdateOffer:
# Line 1006  Line 1025 
1025           setCurrentLocalSdp(msg);           setCurrentLocalSdp(msg);
1026    
1027           // !jf! I need to potentially include an answer in the ACK here           // !jf! I need to potentially include an answer in the ACK here
1028           sendAck();           sendAck(mLastSessionModification);
1029           mCurrentEncryptionLevel = getEncryptionLevel(msg);           mCurrentEncryptionLevel = getEncryptionLevel(msg);
1030                    
1031           if (mSessionRefreshReInvite)           if (mSessionRefreshReInvite)
# Line 1036  Line 1055 
1055           break;           break;
1056        }        }
1057        case On2xx:        case On2xx:
1058           sendAck();           sendAck(mLastSessionModification);
1059           transition(Connected);           transition(Connected);
1060           handleSessionTimerResponse(msg);           handleSessionTimerResponse(msg);
1061           handler->onIllegalNegotiation(getSessionHandle(), msg);           handler->onIllegalNegotiation(getSessionHandle(), msg);
# Line 1118  Line 1137 
1137        {        {
1138           transition(SentReinviteAnswered);           transition(SentReinviteAnswered);
1139           handleSessionTimerResponse(msg);           handleSessionTimerResponse(msg);
1140           mLastSessionModification = msg;           // mLastSessionModification = msg;   // ?slg? why are we storing 200's?
1141           mCurrentEncryptionLevel = getEncryptionLevel(msg);           mCurrentEncryptionLevel = getEncryptionLevel(msg);
1142           mProposedRemoteSdp = InviteSession::makeSdp(*sdp);           mProposedRemoteSdp = InviteSession::makeSdp(*sdp);
1143           handler->onOffer(getSessionHandle(), msg, *sdp);           handler->onOffer(getSessionHandle(), msg, *sdp);
# Line 1130  Line 1149 
1149        }        }
1150    
1151        case On2xx:        case On2xx:
1152           sendAck();           sendAck(mLastSessionModification);
1153           transition(Connected);           transition(Connected);
1154           handleSessionTimerResponse(msg);           handleSessionTimerResponse(msg);
1155           handler->onIllegalNegotiation(getSessionHandle(), msg);           handler->onIllegalNegotiation(getSessionHandle(), msg);
# Line 1337  Line 1356 
1356        if(msg.header(h_StatusLine).statusCode() / 200 == 1)  // Note: stack ACK's non-2xx final responses only        if(msg.header(h_StatusLine).statusCode() / 200 == 1)  // Note: stack ACK's non-2xx final responses only
1357        {        {
1358           // !jf! Need to include the answer here.           // !jf! Need to include the answer here.
1359           sendAck();           sendAck(mLastSessionModification);
1360        }        }
1361        sendBye();        sendBye();
1362        transition(Terminated);        transition(Terminated);
# Line 2210  Line 2229 
2229     }     }
2230  }  }
2231    
2232  void InviteSession::sendAck(const SdpContents *sdp)  void InviteSession::sendAck(SipMessage& originalInvite, const SdpContents *sdp)
2233  {  {
2234     SipMessage ack;     SipMessage ack;
2235    
2236       assert(mAcks.count(originalInvite.header(h_CSeq).sequence()) == 0);
2237    
2238     mDialog.makeRequest(ack, ACK);     mDialog.makeRequest(ack, ACK);
2239    
2240       // Copy Authorization, Proxy Authorization headers and CSeq from original Invite
2241       if(originalInvite.exists(h_Authorizations))
2242       {
2243          ack.header(h_Authorizations) = originalInvite.header(h_Authorizations);
2244       }
2245       if(originalInvite.exists(h_ProxyAuthorizations))
2246       {
2247          ack.header(h_ProxyAuthorizations) = originalInvite.header(h_ProxyAuthorizations);
2248       }
2249       ack.header(h_CSeq).sequence() = originalInvite.header(h_CSeq).sequence();
2250    
2251     if(sdp != 0)     if(sdp != 0)
2252     {     {
2253        setSdp(ack, *sdp);        setSdp(ack, *sdp);
2254     }     }
2255       mAcks[ack.header(h_CSeq).sequence()] = ack;
2256       mDum.addTimerMs(DumTimeout::CanDiscardAck, Timer::TH, getBaseHandle(), ack.header(h_CSeq).sequence());
2257    
2258     InfoLog (<< "Sending " << ack.brief());     InfoLog (<< "Sending " << ack.brief());
2259     send(ack);     send(ack);
2260  }  }

Legend:
Removed from v.5575  
changed lines
  Added in v.5586

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27