/[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 5747 by sgodin, Wed Dec 14 17:04:17 2005 UTC revision 5757 by daniel, Fri Dec 16 02:44:08 2005 UTC
# Line 54  Line 54 
54     : DialogUsage(dum, dialog),     : DialogUsage(dum, dialog),
55       mState(Undefined),       mState(Undefined),
56       mNitState(NitComplete),       mNitState(NitComplete),
57         mLastLocalSessionModification(new SipMessage),
58         mLastRemoteSessionModification(new SipMessage),
59         mInvite200(new SipMessage),
60         mLastNitResponse(new SipMessage),
61       mCurrentRetransmit200(0),       mCurrentRetransmit200(0),
62       mSessionInterval(0),       mSessionInterval(0),
63       mMinSE(90),       mMinSE(90),
# Line 276  Line 280 
280        case Connected:        case Connected:
281        case WaitingToRequestOffer:        case WaitingToRequestOffer:
282           transition(SentReinviteNoOffer);           transition(SentReinviteNoOffer);
283           mDialog.makeRequest(mLastLocalSessionModification, INVITE);           mDialog.makeRequest(*mLastLocalSessionModification, INVITE);
284           mLastLocalSessionModification.setContents(0);          // Clear the SDP contents from the INVITE           mLastLocalSessionModification->setContents(0);         // Clear the SDP contents from the INVITE
285           setSessionTimerHeaders(mLastLocalSessionModification);           setSessionTimerHeaders(*mLastLocalSessionModification);
286    
287             InfoLog (<< "Sending " << mLastLocalSessionModification->brief());
288    
          InfoLog (<< "Sending " << mLastLocalSessionModification.brief());  
289           // call send to give app an chance to adorn the message.           // call send to give app an chance to adorn the message.
290           send(mLastLocalSessionModification);           send(mLastLocalSessionModification);
291           break;           break;
# Line 310  Line 315 
315           if (updateMethodSupported())           if (updateMethodSupported())
316           {           {
317              transition(SentUpdate);              transition(SentUpdate);
318              mDialog.makeRequest(mLastLocalSessionModification, UPDATE);              mDialog.makeRequest(*mLastLocalSessionModification, UPDATE);
319           }           }
320           else           else
321           {           {
322              transition(SentReinvite);              transition(SentReinvite);
323              mDialog.makeRequest(mLastLocalSessionModification, INVITE);              mDialog.makeRequest(*mLastLocalSessionModification, INVITE);
324           }           }
325           setSessionTimerHeaders(mLastLocalSessionModification);           setSessionTimerHeaders(*mLastLocalSessionModification);
326    
327           InfoLog (<< "Sending " << mLastLocalSessionModification.brief());           InfoLog (<< "Sending " << mLastLocalSessionModification->brief());
328           InviteSession::setSdp(mLastLocalSessionModification, offer, alternative);           InviteSession::setSdp(*mLastLocalSessionModification, offer, alternative);
329           mProposedLocalSdp = InviteSession::makeSdp(offer, alternative);           mProposedLocalSdp = InviteSession::makeSdp(offer, alternative);
330           mProposedEncryptionLevel = level;           mProposedEncryptionLevel = level;
331           DumHelper::setOutgoingEncryptionLevel(mLastLocalSessionModification, mProposedEncryptionLevel);           DumHelper::setOutgoingEncryptionLevel(*mLastLocalSessionModification, mProposedEncryptionLevel);
332    
333           // call send to give app an chance to adorn the message.           // call send to give app an chance to adorn the message.
334           send(mLastLocalSessionModification);           send(mLastLocalSessionModification);
335           break;           break;
# Line 338  Line 344 
344        case ReceivedReinviteNoOffer:        case ReceivedReinviteNoOffer:
345           assert(!mProposedRemoteSdp.get());           assert(!mProposedRemoteSdp.get());
346           transition(ReceivedReinviteSentOffer);           transition(ReceivedReinviteSentOffer);
347           mDialog.makeResponse(mInvite200, mLastRemoteSessionModification, 200);           mDialog.makeResponse(*mInvite200, *mLastRemoteSessionModification, 200);
348           handleSessionTimerRequest(mInvite200, mLastRemoteSessionModification);           handleSessionTimerRequest(*mInvite200, *mLastRemoteSessionModification);
349           InviteSession::setSdp(mInvite200, offer, 0);           InviteSession::setSdp(*mInvite200, offer, 0);
350           mProposedLocalSdp  = InviteSession::makeSdp(offer);           mProposedLocalSdp  = InviteSession::makeSdp(offer);
351    
352           InfoLog (<< "Sending " << mInvite200.brief());           InfoLog (<< "Sending " << mInvite200->brief());
353           DumHelper::setOutgoingEncryptionLevel(mInvite200, mCurrentEncryptionLevel);           DumHelper::setOutgoingEncryptionLevel(*mInvite200, mCurrentEncryptionLevel);
354           send(mInvite200);           send(mInvite200);
355           startRetransmit200Timer();           startRetransmit200Timer();
356           break;           break;
# Line 370  Line 376 
376     {     {
377        case ReceivedReinvite:        case ReceivedReinvite:
378           transition(Connected);           transition(Connected);
379           mDialog.makeResponse(mInvite200, mLastRemoteSessionModification, 200);           mDialog.makeResponse(*mInvite200, *mLastRemoteSessionModification, 200);
380           handleSessionTimerRequest(mInvite200, mLastRemoteSessionModification);           handleSessionTimerRequest(*mInvite200, *mLastRemoteSessionModification);
381           InviteSession::setSdp(mInvite200, answer, 0);           InviteSession::setSdp(*mInvite200, answer, 0);
382           mCurrentLocalSdp = InviteSession::makeSdp(answer);           mCurrentLocalSdp = InviteSession::makeSdp(answer);
383           mCurrentRemoteSdp = mProposedRemoteSdp;           mCurrentRemoteSdp = mProposedRemoteSdp;
384           InfoLog (<< "Sending " << mInvite200.brief());           InfoLog (<< "Sending " << mInvite200->brief());
385           DumHelper::setOutgoingEncryptionLevel(mInvite200, mCurrentEncryptionLevel);           DumHelper::setOutgoingEncryptionLevel(*mInvite200, mCurrentEncryptionLevel);
386           send(mInvite200);           send(mInvite200);
387           startRetransmit200Timer();           startRetransmit200Timer();
388           break;           break;
# Line 385  Line 391 
391        {        {
392           transition(Connected);           transition(Connected);
393    
394           SipMessage response;           SharedPtr<SipMessage> response(new SipMessage);
395           mDialog.makeResponse(response, mLastRemoteSessionModification, 200);           mDialog.makeResponse(*response, *mLastRemoteSessionModification, 200);
396           handleSessionTimerRequest(response, mLastRemoteSessionModification);           handleSessionTimerRequest(*response, *mLastRemoteSessionModification);
397           InviteSession::setSdp(response, answer, 0);           InviteSession::setSdp(*response, answer, 0);
398           mCurrentLocalSdp = InviteSession::makeSdp(answer);           mCurrentLocalSdp = InviteSession::makeSdp(answer);
399           mCurrentRemoteSdp = mProposedRemoteSdp;           mCurrentRemoteSdp = mProposedRemoteSdp;
400           InfoLog (<< "Sending " << response.brief());           InfoLog (<< "Sending " << response->brief());
401           DumHelper::setOutgoingEncryptionLevel(response, mCurrentEncryptionLevel);           DumHelper::setOutgoingEncryptionLevel(*response, mCurrentEncryptionLevel);
402           send(response);           send(response);
403           break;           break;
404        }        }
# Line 458  Line 464 
464        case ReceivedReinvite:        case ReceivedReinvite:
465        case ReceivedReinviteNoOffer:        case ReceivedReinviteNoOffer:
466        {        {
467           SipMessage response;           SharedPtr<SipMessage> response(new SipMessage);
468           mDialog.makeResponse(response, mLastRemoteSessionModification, 488);           mDialog.makeResponse(*response, *mLastRemoteSessionModification, 488);
469           InfoLog (<< "Sending " << response.brief());           InfoLog (<< "Sending " << response->brief());
470           send(response);           send(response);
471    
472           sendBye();           sendBye();
# Line 498  Line 504 
504        {        {
505           transition(Connected);           transition(Connected);
506    
507           SipMessage response;           SharedPtr<SipMessage> response(new SipMessage);
508           mDialog.makeResponse(response, mLastRemoteSessionModification, statusCode);           mDialog.makeResponse(*response, *mLastRemoteSessionModification, statusCode);
509           if(warning)           if(warning)
510           {           {
511              response.header(h_Warnings).push_back(*warning);              response->header(h_Warnings).push_back(*warning);
512           }           }
513           InfoLog (<< "Sending " << response.brief());           InfoLog (<< "Sending " << response->brief());
514           send(response);           send(response);
515           break;           break;
516        }        }
# Line 543  Line 549 
549     if (isConnected()) // ?slg? likely not safe in any state except Connected - what should behaviour be if state is ReceivedReinvite?     if (isConnected()) // ?slg? likely not safe in any state except Connected - what should behaviour be if state is ReceivedReinvite?
550     {     {
551        mSentRefer = true;        mSentRefer = true;
552        SipMessage refer;        SharedPtr<SipMessage> refer(new SipMessage());
553        mDialog.makeRequest(refer, REFER);        mDialog.makeRequest(*refer, REFER);
554        refer.header(h_ReferTo) = referTo;        refer->header(h_ReferTo) = referTo;
555        refer.header(h_ReferredBy) = mDialog.mLocalContact; // !slg! is it ok to do this - should it be an option?        refer->header(h_ReferredBy) = mDialog.mLocalContact; // !slg! is it ok to do this - should it be an option?
556        send(refer);        send(refer);
557     }     }
558     else     else
# Line 573  Line 579 
579     if (isConnected())  // ?slg? likely not safe in any state except Connected - what should behaviour be if state is ReceivedReinvite?     if (isConnected())  // ?slg? likely not safe in any state except Connected - what should behaviour be if state is ReceivedReinvite?
580     {     {
581        mSentRefer = true;        mSentRefer = true;
582        SipMessage refer;        SharedPtr<SipMessage> refer(new SipMessage());      
583        mDialog.makeRequest(refer, REFER);        mDialog.makeRequest(*refer, REFER);
584    
585        refer.header(h_ReferTo) = referTo;        refer->header(h_ReferTo) = referTo;
586        refer.header(h_ReferredBy) = mDialog.mLocalContact; // ?slg? is it ok to do this - should it be an option?        refer->header(h_ReferredBy) = mDialog.mLocalContact; // ?slg? is it ok to do this - should it be an option?
587        CallId replaces;        CallId replaces;
588        DialogId id = sessionToReplace->mDialog.getId();        DialogId id = sessionToReplace->mDialog.getId();
589        replaces.value() = id.getCallId();        replaces.value() = id.getCallId();
590        replaces.param(p_toTag) = id.getRemoteTag();        replaces.param(p_toTag) = id.getRemoteTag();
591        replaces.param(p_fromTag) = id.getLocalTag();        replaces.param(p_fromTag) = id.getLocalTag();
592    
593        refer.header(h_ReferTo).uri().embedded().header(h_Replaces) = replaces;        refer->header(h_ReferTo).uri().embedded().header(h_Replaces) = replaces;
594        send(refer);        send(refer);
595     }     }
596     else     else
# Line 603  Line 609 
609        if (isConnected())  // ?slg? likely not safe in any state except Connected - what should behaviour be if state is ReceivedReinvite?        if (isConnected())  // ?slg? likely not safe in any state except Connected - what should behaviour be if state is ReceivedReinvite?
610        {        {
611           mNitState = NitProceeding;           mNitState = NitProceeding;
612           SipMessage info;           SharedPtr<SipMessage> info(new SipMessage());
613           mDialog.makeRequest(info, INFO);           mDialog.makeRequest(*info, INFO);
614           // !jf! handle multipart here           // !jf! handle multipart here
615           info.setContents(&contents);           info->setContents(&contents);
616           DumHelper::setOutgoingEncryptionLevel(info, mCurrentEncryptionLevel);           DumHelper::setOutgoingEncryptionLevel(*info, mCurrentEncryptionLevel);
617           send(info);           send(info);
618        }        }
619        else        else
# Line 632  Line 638 
638        if (isConnected())  // ?slg? likely not safe in any state except Connected - what should behaviour be if state is ReceivedReinvite?        if (isConnected())  // ?slg? likely not safe in any state except Connected - what should behaviour be if state is ReceivedReinvite?
639        {        {
640           mNitState = NitProceeding;           mNitState = NitProceeding;
641           SipMessage message;           SharedPtr<SipMessage> message(new SipMessage());
642           mDialog.makeRequest(message, MESSAGE);           mDialog.makeRequest(*message, MESSAGE);
643           // !jf! handle multipart here           // !jf! handle multipart here
644           message.setContents(&contents);           message->setContents(&contents);
645           DumHelper::setOutgoingEncryptionLevel(message, mCurrentEncryptionLevel);           DumHelper::setOutgoingEncryptionLevel(*message, mCurrentEncryptionLevel);
646           send(message);           send(message);
647           InfoLog (<< "Trying to send MESSAGE: " << message);           InfoLog (<< "Trying to send MESSAGE: " << message);
648        }        }
# Line 734  Line 740 
740     {     {
741        if (mCurrentRetransmit200)        if (mCurrentRetransmit200)
742        {        {
743           InfoLog (<< "Retransmitting: " << endl << mInvite200);           InfoLog (<< "Retransmitting: " << endl << *mInvite200);
744           DumHelper::setOutgoingEncryptionLevel(mInvite200, mCurrentEncryptionLevel);           //DumHelper::setOutgoingEncryptionLevel(*mInvite200, mCurrentEncryptionLevel);
745           send(mInvite200);           send(mInvite200);
746           mCurrentRetransmit200 *= 2;           mCurrentRetransmit200 *= 2;
747           mDum.addTimerMs(DumTimeout::Retransmit200, resipMin(Timer::T2, mCurrentRetransmit200), getBaseHandle(),  timeout.seq());           mDum.addTimerMs(DumTimeout::Retransmit200, resipMin(Timer::T2, mCurrentRetransmit200), getBaseHandle(),  timeout.seq());
# Line 745  Line 751 
751     {     {
752        if(mCurrentRetransmit200)  // If retransmit200 timer is active then ACK is not received yet        if(mCurrentRetransmit200)  // If retransmit200 timer is active then ACK is not received yet
753        {        {
754           if (timeout.seq() == mLastRemoteSessionModification.header(h_CSeq).sequence())           if (timeout.seq() == mLastRemoteSessionModification->header(h_CSeq).sequence())
755           {           {
756              mCurrentRetransmit200 = 0; // stop the 200 retransmit timer              mCurrentRetransmit200 = 0; // stop the 200 retransmit timer
757    
# Line 847  Line 853 
853     {     {
854        case OnInvite:        case OnInvite:
855        case OnInviteReliable:        case OnInviteReliable:
856           mLastRemoteSessionModification = msg;           *mLastRemoteSessionModification = msg;
857           transition(ReceivedReinviteNoOffer);           transition(ReceivedReinviteNoOffer);
858           //handler->onDialogModified(getSessionHandle(), None, msg);           //handler->onDialogModified(getSessionHandle(), None, msg);
859           handler->onOfferRequired(getSessionHandle(), msg);           handler->onOfferRequired(getSessionHandle(), msg);
# Line 855  Line 861 
861    
862        case OnInviteOffer:        case OnInviteOffer:
863        case OnInviteReliableOffer:        case OnInviteReliableOffer:
864           mLastRemoteSessionModification = msg;           *mLastRemoteSessionModification = msg;
865           transition(ReceivedReinvite);           transition(ReceivedReinvite);
866           mCurrentEncryptionLevel = getEncryptionLevel(msg);           mCurrentEncryptionLevel = getEncryptionLevel(msg);
867           mProposedRemoteSdp = InviteSession::makeSdp(*sdp);           mProposedRemoteSdp = InviteSession::makeSdp(*sdp);
# Line 878  Line 884 
884           //  !kh!           //  !kh!
885           //  Find out if it's an UPDATE requiring state change.           //  Find out if it's an UPDATE requiring state change.
886           //  See rfc3311 5.2, 4th paragraph.           //  See rfc3311 5.2, 4th paragraph.
887           mLastRemoteSessionModification = msg;           *mLastRemoteSessionModification = msg;
888           mCurrentEncryptionLevel = getEncryptionLevel(msg);           mCurrentEncryptionLevel = getEncryptionLevel(msg);
889           mProposedRemoteSdp = InviteSession::makeSdp(*sdp);           mProposedRemoteSdp = InviteSession::makeSdp(*sdp);
890           handler->onOffer(getSessionHandle(), msg, *sdp);           handler->onOffer(getSessionHandle(), msg, *sdp);
# Line 887  Line 893 
893        case OnUpdate:        case OnUpdate:
894        {        {
895           // ?slg? no sdp in update - just responsd immediately (likely session timer) - do we need a callback?           // ?slg? no sdp in update - just responsd immediately (likely session timer) - do we need a callback?
896           SipMessage response;           SharedPtr<SipMessage> response(new SipMessage);
897           mLastRemoteSessionModification = msg;           *mLastRemoteSessionModification = msg;
898           mDialog.makeResponse(response, mLastRemoteSessionModification, 200);           mDialog.makeResponse(*response, *mLastRemoteSessionModification, 200);
899           handleSessionTimerRequest(response, mLastRemoteSessionModification);           handleSessionTimerRequest(*response, *mLastRemoteSessionModification);
900           send(response);           send(response);
901           break;           break;
902        }        }
# Line 927  Line 933 
933        case OnUpdateOffer:        case OnUpdateOffer:
934        {        {
935           // glare           // glare
936           SipMessage response;           SharedPtr<SipMessage> response(new SipMessage);
937           mDialog.makeResponse(response, msg, 491);           mDialog.makeResponse(*response, msg, 491);
938           send(response);           send(response);
939           break;           break;
940        }        }
# Line 1009  Line 1015 
1015        case OnUpdate:        case OnUpdate:
1016        case OnUpdateOffer:        case OnUpdateOffer:
1017        {        {
1018           SipMessage response;           SharedPtr<SipMessage> response(new SipMessage);
1019           mDialog.makeResponse(response, msg, 491);           mDialog.makeResponse(*response, msg, 491);
1020           send(response);           send(response);
1021           break;           break;
1022        }        }
# Line 1124  Line 1130 
1130        case OnUpdate:        case OnUpdate:
1131        case OnUpdateOffer:        case OnUpdateOffer:
1132        {        {
1133           SipMessage response;           SharedPtr<SipMessage> response(new SipMessage);
1134           mDialog.makeResponse(response, msg, 491);           mDialog.makeResponse(*response, msg, 491);
1135           send(response);           send(response);
1136           break;           break;
1137        }        }
# Line 1166  Line 1172 
1172              // Change interval to min from 422 response              // Change interval to min from 422 response
1173              mSessionInterval = msg.header(h_MinSE).value();              mSessionInterval = msg.header(h_MinSE).value();
1174              mMinSE = mSessionInterval;              mMinSE = mSessionInterval;
1175              setSessionTimerHeaders(mLastLocalSessionModification);              setSessionTimerHeaders(*mLastLocalSessionModification);
1176              send(mLastLocalSessionModification);              send(mLastLocalSessionModification);
1177           }           }
1178           else           else
# Line 1219  Line 1225 
1225        case OnUpdate:        case OnUpdate:
1226        case OnUpdateOffer:        case OnUpdateOffer:
1227        {        {
1228           SipMessage response;           SharedPtr<SipMessage> response(new SipMessage);
1229           mDialog.makeResponse(response, msg, 491);           mDialog.makeResponse(*response, msg, 491);
1230           send(response);           send(response);
1231           break;           break;
1232        }        }
# Line 1289  Line 1295 
1295     {     {
1296        // Means that the UAC has sent us a second reINVITE or UPDATE before we        // Means that the UAC has sent us a second reINVITE or UPDATE before we
1297        // responded to the first one. Bastard!        // responded to the first one. Bastard!
1298        SipMessage response;        SharedPtr<SipMessage> response(new SipMessage);
1299        mDialog.makeResponse(response, msg, 500);        mDialog.makeResponse(*response, msg, 500);
1300        response.header(h_RetryAfter).value() = Random::getRandom() % 10;        response->header(h_RetryAfter).value() = Random::getRandom() % 10;
1301        send(response);        send(response);
1302     }     }
1303     else     else
# Line 1398  Line 1404 
1404    
1405     if (msg.isRequest())     if (msg.isRequest())
1406     {     {
1407        SipMessage response;        SharedPtr<SipMessage> response(new SipMessage);
1408        mDialog.makeResponse(response, msg, 481);        mDialog.makeResponse(*response, msg, 481);
1409        send(response);        send(response);
1410    
1411        // !jf! means the peer sent BYE while we are waiting for response to BYE        // !jf! means the peer sent BYE while we are waiting for response to BYE
# Line 1457  Line 1463 
1463    
1464     // If we get an INVITE request from the wire and we are not in     // If we get an INVITE request from the wire and we are not in
1465     // Connected state, reject the request and send a BYE     // Connected state, reject the request and send a BYE
1466     SipMessage response;     SharedPtr<SipMessage> response(new SipMessage);
1467     mDialog.makeResponse(response, msg, 400); // !jf! what code to use?     mDialog.makeResponse(*response, msg, 400); // !jf! what code to use?
1468     InfoLog (<< "Sending " << response.brief());     InfoLog (<< "Sending " << response->brief());
1469     send(response);     send(response);
1470    
1471     sendBye();     sendBye();
# Line 1473  Line 1479 
1479     assert(msg.header(h_CSeq).method() == PRACK);     assert(msg.header(h_CSeq).method() == PRACK);
1480     if(msg.isRequest())     if(msg.isRequest())
1481     {     {
1482        SipMessage rsp;        SharedPtr<SipMessage> rsp(new SipMessage);
1483        mDialog.makeResponse(rsp, msg, 481);        mDialog.makeResponse(*rsp, msg, 481);
1484        send(rsp);        send(rsp);
1485    
1486        sendBye();        sendBye();
# Line 1495  Line 1501 
1501     assert(msg.header(h_CSeq).method() == CANCEL);     assert(msg.header(h_CSeq).method() == CANCEL);
1502     if(msg.isRequest())     if(msg.isRequest())
1503     {     {
1504        SipMessage rsp;        SharedPtr<SipMessage> rsp(new SipMessage);
1505        mDialog.makeResponse(rsp, msg, 200);        mDialog.makeResponse(*rsp, msg, 200);
1506        send(rsp);        send(rsp);
1507    
1508        sendBye();        sendBye();
# Line 1519  Line 1525 
1525     if (msg.isRequest())     if (msg.isRequest())
1526     {     {
1527    
1528        SipMessage rsp;        SharedPtr<SipMessage> rsp(new SipMessage);
1529        InfoLog (<< "Received " << msg.brief());        InfoLog (<< "Received " << msg.brief());
1530        mDialog.makeResponse(rsp, msg, 200);        mDialog.makeResponse(*rsp, msg, 200);
1531        send(rsp);        send(rsp);
1532    
1533        // !jf! should we make some other callback here        // !jf! should we make some other callback here
# Line 1543  Line 1549 
1549     if (msg.isRequest())     if (msg.isRequest())
1550     {     {
1551        InfoLog (<< "Received " << msg.brief());        InfoLog (<< "Received " << msg.brief());
1552        mDialog.makeResponse(mLastNitResponse, msg, 200);        mDialog.makeResponse(*mLastNitResponse, msg, 200);
1553        handler->onInfo(getSessionHandle(), msg);        handler->onInfo(getSessionHandle(), msg);
1554     }     }
1555     else     else
# Line 1570  Line 1576 
1576        throw UsageUseException("Must accept with a 2xx", __FILE__, __LINE__);        throw UsageUseException("Must accept with a 2xx", __FILE__, __LINE__);
1577     }     }
1578    
1579     mLastNitResponse.header(h_StatusLine).statusCode() = statusCode;       mLastNitResponse->header(h_StatusLine).statusCode() = statusCode;  
1580     mLastNitResponse.setContents(contents);     mLastNitResponse->setContents(contents);
1581     Helper::getResponseCodeReason(statusCode, mLastNitResponse.header(h_StatusLine).reason());     Helper::getResponseCodeReason(statusCode, mLastNitResponse->header(h_StatusLine).reason());
1582     send(mLastNitResponse);       send(mLastNitResponse);  
1583  }  }
1584    
# Line 1583  Line 1589 
1589     {     {
1590        throw UsageUseException("Must reject with a >= 4xx", __FILE__, __LINE__);        throw UsageUseException("Must reject with a >= 4xx", __FILE__, __LINE__);
1591     }     }
1592     mLastNitResponse.header(h_StatusLine).statusCode() = statusCode;       mLastNitResponse->header(h_StatusLine).statusCode() = statusCode;  
1593     mLastNitResponse.releaseContents();     mLastNitResponse->releaseContents();
1594     Helper::getResponseCodeReason(statusCode, mLastNitResponse.header(h_StatusLine).reason());     Helper::getResponseCodeReason(statusCode, mLastNitResponse->header(h_StatusLine).reason());
1595     send(mLastNitResponse);     send(mLastNitResponse);
1596  }  }
1597    
# Line 1596  Line 1602 
1602     if (msg.isRequest())     if (msg.isRequest())
1603     {     {
1604        InfoLog (<< "Received " << msg.brief());        InfoLog (<< "Received " << msg.brief());
1605        mDialog.makeResponse(mLastNitResponse, msg, 200);        mDialog.makeResponse(*mLastNitResponse, msg, 200);
1606        mLastNitResponse.header(h_Contacts).clear();        mLastNitResponse->header(h_Contacts).clear();
1607        handler->onMessage(getSessionHandle(), msg);        handler->onMessage(getSessionHandle(), msg);
1608     }     }
1609     else     else
# Line 1620  Line 1626 
1626  InviteSession::startRetransmit200Timer()  InviteSession::startRetransmit200Timer()
1627  {  {
1628     mCurrentRetransmit200 = Timer::T1;     mCurrentRetransmit200 = Timer::T1;
1629     int seq = mLastRemoteSessionModification.header(h_CSeq).sequence();     int seq = mLastRemoteSessionModification->header(h_CSeq).sequence();
1630     mDum.addTimerMs(DumTimeout::Retransmit200, mCurrentRetransmit200, getBaseHandle(), seq);     mDum.addTimerMs(DumTimeout::Retransmit200, mCurrentRetransmit200, getBaseHandle(), seq);
1631     mDum.addTimerMs(DumTimeout::WaitForAck, Timer::TH, getBaseHandle(), seq);     mDum.addTimerMs(DumTimeout::WaitForAck, Timer::TH, getBaseHandle(), seq);
1632  }  }
# Line 1635  Line 1641 
1641  void  void
1642  InviteSession::start491Timer()  InviteSession::start491Timer()
1643  {  {
1644     int seq = mLastLocalSessionModification.header(h_CSeq).sequence();     int seq = mLastLocalSessionModification->header(h_CSeq).sequence();
1645    
1646     if (dynamic_cast<ClientInviteSession*>(this))     if (dynamic_cast<ClientInviteSession*>(this))
1647     {     {
# Line 1684  Line 1690 
1690     if (updateMethodSupported())     if (updateMethodSupported())
1691     {     {
1692        transition(SentUpdate);        transition(SentUpdate);
1693        mDialog.makeRequest(mLastLocalSessionModification, UPDATE);        mDialog.makeRequest(*mLastLocalSessionModification, UPDATE);
1694        mLastLocalSessionModification.releaseContents();  // Don't send SDP        mLastLocalSessionModification->releaseContents();  // Don't send SDP
1695     }     }
1696     else     else
1697     {     {
1698        transition(SentReinvite);        transition(SentReinvite);
1699        mDialog.makeRequest(mLastLocalSessionModification, INVITE);        mDialog.makeRequest(*mLastLocalSessionModification, INVITE);
1700        InviteSession::setSdp(mLastLocalSessionModification, mCurrentLocalSdp.get());        InviteSession::setSdp(*mLastLocalSessionModification, mCurrentLocalSdp.get());
1701        mProposedLocalSdp = InviteSession::makeSdp(*mCurrentLocalSdp.get(), 0);        mProposedLocalSdp = InviteSession::makeSdp(*mCurrentLocalSdp.get(), 0);
1702        mSessionRefreshReInvite = true;              mSessionRefreshReInvite = true;      
1703     }     }
1704     setSessionTimerHeaders(mLastLocalSessionModification);     setSessionTimerHeaders(*mLastLocalSessionModification);
1705    
1706     InfoLog (<< "sessionRefresh: Sending " << mLastLocalSessionModification.brief());     InfoLog (<< "sessionRefresh: Sending " << mLastLocalSessionModification->brief());
1707     DumHelper::setOutgoingEncryptionLevel(mLastLocalSessionModification, mCurrentEncryptionLevel);     DumHelper::setOutgoingEncryptionLevel(*mLastLocalSessionModification, mCurrentEncryptionLevel);
1708     send(mLastLocalSessionModification);     send(mLastLocalSessionModification);
1709  }  }
1710    
# Line 2245  Line 2251 
2251    
2252  void InviteSession::sendAck(const SdpContents *sdp)  void InviteSession::sendAck(const SdpContents *sdp)
2253  {  {
2254     SipMessage ack;     SharedPtr<SipMessage> ack(new SipMessage);
2255    
2256     assert(mAcks.count(mLastLocalSessionModification.header(h_CSeq).sequence()) == 0);     assert(mAcks.count(mLastLocalSessionModification->header(h_CSeq).sequence()) == 0);
2257    
2258     mDialog.makeRequest(ack, ACK);     mDialog.makeRequest(*ack, ACK);
2259    
2260     // Copy Authorization, Proxy Authorization headers and CSeq from original Invite     // Copy Authorization, Proxy Authorization headers and CSeq from original Invite
2261     if(mLastLocalSessionModification.exists(h_Authorizations))     if(mLastLocalSessionModification->exists(h_Authorizations))
2262     {     {
2263        ack.header(h_Authorizations) = mLastLocalSessionModification.header(h_Authorizations);        ack->header(h_Authorizations) = mLastLocalSessionModification->header(h_Authorizations);
2264     }     }
2265     if(mLastLocalSessionModification.exists(h_ProxyAuthorizations))     if(mLastLocalSessionModification->exists(h_ProxyAuthorizations))
2266     {     {
2267        ack.header(h_ProxyAuthorizations) = mLastLocalSessionModification.header(h_ProxyAuthorizations);        ack->header(h_ProxyAuthorizations) = mLastLocalSessionModification->header(h_ProxyAuthorizations);
2268     }     }
2269     ack.header(h_CSeq).sequence() = mLastLocalSessionModification.header(h_CSeq).sequence();     ack->header(h_CSeq).sequence() = mLastLocalSessionModification->header(h_CSeq).sequence();
2270    
2271     if(sdp != 0)     if(sdp != 0)
2272     {     {
2273        setSdp(ack, *sdp);        setSdp(*ack, *sdp);
2274     }     }
2275     mAcks[ack.header(h_CSeq).sequence()] = ack;     mAcks[ack->header(h_CSeq).sequence()] = ack;
2276     mDum.addTimerMs(DumTimeout::CanDiscardAck, Timer::TH, getBaseHandle(), ack.header(h_CSeq).sequence());     mDum.addTimerMs(DumTimeout::CanDiscardAck, Timer::TH, getBaseHandle(), ack->header(h_CSeq).sequence());
2277    
2278     InfoLog (<< "Sending " << ack.brief());     InfoLog (<< "Sending " << ack->brief());
2279     send(ack);     send(ack);
2280  }  }
2281    
2282  void InviteSession::sendBye()  void InviteSession::sendBye()
2283  {  {
2284     SipMessage bye;     SharedPtr<SipMessage> bye(new SipMessage());
2285     mDialog.makeRequest(bye, BYE);     mDialog.makeRequest(*bye, BYE);
2286     Data reason;     Data reason;
2287     if (mEndReason != NotSpecified)     if (mEndReason != NotSpecified)
2288     {     {
2289        reason = getEndReasonString(mEndReason);        reason = getEndReasonString(mEndReason);
2290        bye.header(h_Reasons).push_back(Token(reason));              bye->header(h_Reasons).push_back(Token(reason));      
2291     }     }
2292        
2293     InfoLog (<< myAddr() << " Sending BYE " << reason);     InfoLog (<< myAddr() << " Sending BYE " << reason);

Legend:
Removed from v.5747  
changed lines
  Added in v.5757

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27