reSIProcate/DialogUsageManager  9694
InviteSessionHandler.hxx
Go to the documentation of this file.
00001 #if !defined(RESIP_INVITESESSIONHANDLER_HXX)
00002 #define RESIP_INVITESESSIONHANDLER_HXX
00003 
00004 #include "resip/dum/InviteSession.hxx"
00005 #include "resip/dum/Handles.hxx"
00006 
00007 namespace resip
00008 {
00009 
00010 class SipMessage;
00011 class SdpContents;
00012 class Contents;
00013 
00040 class InviteSessionHandler
00041 {
00042    public:
00043       InviteSessionHandler(bool genericOfferAnswer=false) : mGenericOfferAnswer(genericOfferAnswer) {}
00044       virtual ~InviteSessionHandler() {}
00045       virtual bool isGenericOfferAnswer() { return mGenericOfferAnswer; }
00046 
00048       virtual void onNewSession(ClientInviteSessionHandle, InviteSession::OfferAnswerType oat, const SipMessage& msg)=0;
00049       virtual void onNewSession(ServerInviteSessionHandle, InviteSession::OfferAnswerType oat, const SipMessage& msg)=0;
00050 
00052       virtual void onFailure(ClientInviteSessionHandle, const SipMessage& msg)=0;
00053       
00055       virtual void onEarlyMedia(ClientInviteSessionHandle, const SipMessage&, const SdpContents&)=0;
00056       virtual void onEarlyMedia(ClientInviteSessionHandle, const SipMessage&, const Contents&);
00057 
00059       virtual void onProvisional(ClientInviteSessionHandle, const SipMessage&)=0;
00060 
00062       virtual void onConnected(ClientInviteSessionHandle, const SipMessage& msg)=0;
00063 
00065       virtual void onConnected(InviteSessionHandle, const SipMessage& msg)=0;
00066 
00068       virtual void onConnectedConfirmed(InviteSessionHandle, const SipMessage &msg);
00069 
00074       virtual void onStaleCallTimeout(ClientInviteSessionHandle h);
00075 
00079       virtual void terminate(ClientInviteSessionHandle h);
00080       
00084       enum TerminatedReason
00085       {
00086          Error,
00087          Timeout, 
00088          Replaced,
00089          LocalBye,
00090          RemoteBye,
00091          LocalCancel,
00092          RemoteCancel,
00093          Rejected, //Only as UAS, UAC has distinct onFailure callback
00094          Referred
00095       };
00096             
00097       virtual void onTerminated(InviteSessionHandle, InviteSessionHandler::TerminatedReason reason, const SipMessage* related=0)=0;
00098 
00101       virtual void onForkDestroyed(ClientInviteSessionHandle)=0;
00102 
00109       virtual void onRedirected(ClientInviteSessionHandle, const SipMessage& msg)=0;
00110 
00112       virtual void onReadyToSend(InviteSessionHandle, SipMessage& msg);
00113 
00116       virtual void onAnswer(InviteSessionHandle, const SipMessage& msg, const SdpContents&)=0;
00117       // You should only override the following method if genericOfferAnswer is true
00118       virtual void onAnswer(InviteSessionHandle, const SipMessage& msg, const Contents&);
00119 
00121       virtual void onOffer(InviteSessionHandle, const SipMessage& msg, const SdpContents&)=0;      
00122       // You should only override the following method if genericOfferAnswer is true
00123       virtual void onOffer(InviteSessionHandle, const SipMessage& msg, const Contents&);      
00124 
00128       virtual void onRemoteSdpChanged(InviteSessionHandle, const SipMessage& msg, const SdpContents&);
00129       // You should only override the following method if genericOfferAnswer is true
00130       virtual void onRemoteAnswerChanged(InviteSessionHandle, const SipMessage& msg, const Contents&);  
00131 
00133       virtual void onOfferRequestRejected(InviteSessionHandle, const SipMessage& msg);
00134 
00137       virtual void onOfferRequired(InviteSessionHandle, const SipMessage& msg)=0;      
00138       
00141       virtual void onOfferRejected(InviteSessionHandle, const SipMessage* msg)=0;
00142       
00144       virtual void onInfo(InviteSessionHandle, const SipMessage& msg)=0;
00145 
00147       virtual void onInfoSuccess(InviteSessionHandle, const SipMessage& msg)=0;
00148       virtual void onInfoFailure(InviteSessionHandle, const SipMessage& msg)=0;
00149 
00151       virtual void onMessage(InviteSessionHandle, const SipMessage& msg)=0;
00152 
00154       virtual void onMessageSuccess(InviteSessionHandle, const SipMessage& msg)=0;
00155       virtual void onMessageFailure(InviteSessionHandle, const SipMessage& msg)=0;
00156 
00161       virtual void onRefer(InviteSessionHandle, ServerSubscriptionHandle, const SipMessage& msg)=0;
00162 
00163       virtual void onReferNoSub(InviteSessionHandle, const SipMessage& msg)=0;
00164 
00166       virtual void onReferRejected(InviteSessionHandle, const SipMessage& msg)=0;
00167 
00169       virtual void onReferAccepted(InviteSessionHandle, ClientSubscriptionHandle, const SipMessage& msg)=0;
00170 
00172       virtual void onAckReceived(InviteSessionHandle, const SipMessage& msg);
00173 
00175       virtual void onAckNotReceived(InviteSessionHandle);
00176 
00179       virtual void onStaleReInviteTimeout(InviteSessionHandle h);
00180 
00182       virtual void onIllegalNegotiation(InviteSessionHandle, const SipMessage& msg);     
00183 
00186       virtual void onSessionExpired(InviteSessionHandle);
00187 
00190       //  Called only if clientOutbound is enabled on the UserProfile and the first hop server 
00193       virtual void onFlowTerminated(InviteSessionHandle);
00194 
00195    private:
00196           bool mGenericOfferAnswer;
00197 };
00198 
00199 }
00200 
00201 #endif
00202 
00203 /* ====================================================================
00204  * The Vovida Software License, Version 1.0 
00205  * 
00206  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
00207  * 
00208  * Redistribution and use in source and binary forms, with or without
00209  * modification, are permitted provided that the following conditions
00210  * are met:
00211  * 
00212  * 1. Redistributions of source code must retain the above copyright
00213  *    notice, this list of conditions and the following disclaimer.
00214  * 
00215  * 2. Redistributions in binary form must reproduce the above copyright
00216  *    notice, this list of conditions and the following disclaimer in
00217  *    the documentation and/or other materials provided with the
00218  *    distribution.
00219  * 
00220  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
00221  *    and "Vovida Open Communication Application Library (VOCAL)" must
00222  *    not be used to endorse or promote products derived from this
00223  *    software without prior written permission. For written
00224  *    permission, please contact vocal@vovida.org.
00225  *
00226  * 4. Products derived from this software may not be called "VOCAL", nor
00227  *    may "VOCAL" appear in their name, without prior written
00228  *    permission of Vovida Networks, Inc.
00229  * 
00230  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
00231  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00232  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
00233  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
00234  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
00235  * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
00236  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00237  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00238  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00239  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00240  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00241  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00242  * DAMAGE.
00243  * 
00244  * ====================================================================
00245  * 
00246  * This software consists of voluntary contributions made by Vovida
00247  * Networks, Inc. and many individuals on behalf of Vovida Networks,
00248  * Inc.  For more information on Vovida Networks, Inc., please see
00249  * <http://www.vovida.org/>.
00250  *
00251  */