reSIProcate/DialogUsageManager  9680
ClientInviteSession.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_CLIENTINVITESESSION_HXX)
00002 #define RESIP_CLIENTINVITESESSION_HXX
00003 
00004 #include "resip/dum/InviteSession.hxx"
00005 #include "resip/dum/Handles.hxx"
00006 
00007 namespace resip
00008 {
00009 class SipMessage;
00010 class Contents;
00011 
00012 class ClientInviteSession : public InviteSession
00013 {
00014    public:
00015       ClientInviteSession(DialogUsageManager& dum,
00016                           Dialog& dialog,
00017                           SharedPtr<SipMessage> request,
00018                           const Contents* initialOffer,
00019                           DialogUsageManager::EncryptionLevel level,
00020                           ServerSubscriptionHandle serverSub = ServerSubscriptionHandle::NotValid());
00021 
00022       ClientInviteSessionHandle getHandle();
00023 
00024    public:
00028       virtual void provideOffer (const Contents& offer);
00029       virtual void provideOffer(const Contents& offer, DialogUsageManager::EncryptionLevel level, const Contents* alternative);
00030 
00034       virtual void provideAnswer (const Contents& answer);
00035 
00037       virtual void end(const Data& userReason);
00038       virtual void end(EndReason reason);
00039       virtual void end();
00040 
00044       virtual void reject (int statusCode, WarningCategory *warning = 0);
00045 
00046       const Contents& getEarlyMedia() const;
00047       
00048    private:
00049       virtual void dispatch(const SipMessage& msg);
00050       virtual void dispatch(const DumTimeout& timer);
00051 
00052       void dispatchStart (const SipMessage& msg);
00053       void dispatchEarly (const SipMessage& msg);
00054       void dispatchEarlyWithOffer (const SipMessage& msg);
00055       void dispatchEarlyWithAnswer (const SipMessage& msg);
00056       void dispatchAnswered (const SipMessage& msg);
00057       void dispatchSentUpdateEarly (const SipMessage& msg);
00058       void dispatchSentUpdateEarlyGlare (const SipMessage& msg);
00059       void dispatchReceivedUpdateEarly (const SipMessage& msg);
00060       void dispatchSentAnswer (const SipMessage& msg);
00061       void dispatchQueuedUpdate (const SipMessage& msg);
00062       void dispatchCancelled (const SipMessage& msg);
00063 
00064       void handleRedirect (const SipMessage& msg);
00065       void handleProvisional (const SipMessage& msg);
00066       void handleFinalResponse (const SipMessage& msg);
00067       void handleOffer (const SipMessage& msg, const Contents& offer);
00068       void handleAnswer (const SipMessage& msg, const Contents& answer);
00069       void sendPrackIfNeeded(const SipMessage& msg);
00070       void sendPrack(const Contents& offerAnswer);
00071       
00072       // Called by the DialogSet (friend) when the app has CANCELed the request
00073       void cancel();
00074 
00075       // Called by the DialogSet when it receives a 2xx response
00076       void onForkAccepted();
00077 
00078       bool checkRseq(const SipMessage& msg);
00079    private:
00080       void startCancelTimer();
00081       void startStaleCallTimer();
00082       void sendSipFrag(const SipMessage& response);
00083 
00084       void onConnectedAspect(ClientInviteSessionHandle h, const SipMessage& msg);
00085       void onProvisionalAspect(ClientInviteSessionHandle c, const SipMessage& msg);
00086       void onFailureAspect(ClientInviteSessionHandle c, const SipMessage& msg);
00087 
00088       std::auto_ptr<Contents> mEarlyMedia;
00089 
00090       RAckCategory mRelRespInfo;
00091       unsigned int mStaleCallTimerSeq;
00092       unsigned int mCancelledTimerSeq;      
00093       ServerSubscriptionHandle mServerSub;
00094 
00095       // disabled
00096       ClientInviteSession(const ClientInviteSession&);
00097       ClientInviteSession& operator=(const ClientInviteSession&);
00098 
00099       friend class Dialog;
00100 };
00101 
00102 }
00103 
00104 #endif
00105 
00106 /* ====================================================================
00107  * The Vovida Software License, Version 1.0
00108  *
00109  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00110  *
00111  * Redistribution and use in source and binary forms, with or without
00112  * modification, are permitted provided that the following conditions
00113  * are met:
00114  *
00115  * 1. Redistributions of source code must retain the above copyright
00116  *    notice, this list of conditions and the following disclaimer.
00117  *
00118  * 2. Redistributions in binary form must reproduce the above copyright
00119  *    notice, this list of conditions and the following disclaimer in
00120  *    the documentation and/or other materials provided with the
00121 
00122  *    distribution.
00123  *
00124  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00125  *    and "Vovida Open Communication Application Library (VOCAL)" must
00126  *    not be used to endorse or promote products derived from this
00127  *    software without prior written permission. For written
00128  *    permission, please contact vocal@vovida.org.
00129  *
00130  * 4. Products derived from this software may not be called "VOCAL", nor
00131  *    may "VOCAL" appear in their name, without prior written
00132  *    permission of Vovida Networks, Inc.
00133  *
00134  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00135  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00136  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00137  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00138  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00139  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00140  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00141  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00142  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00143  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00144  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00145  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00146  * DAMAGE.
00147  *
00148  * ====================================================================
00149  *
00150  * This software consists of voluntary contributions made by Vovida
00151  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00152  * Inc.  For more information on Vovida Networks, Inc., please see
00153  * <http://www.vovida.org/>.
00154  *
00155  */