00001 00008 /*************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 #ifndef CALLMODULE_H 00018 #define CALLMODULE_H 00019 00020 #include "../backend/callinterface.h" 00021 #include "../backend/capiexception.h" 00022 00023 class Connection; 00024 00054 class CallModule: public CallInterface 00055 { 00056 public: 00065 CallModule(Connection* connection, int timeout=-1, bool DTMF_exit=false, bool checkConnection=true) throw (CapiWrongState); 00066 00069 ~CallModule(); 00070 00080 virtual void mainLoop() throw (CapiWrongState,CapiMsgError,CapiExternalError); 00081 00086 virtual void transmissionComplete(void); 00087 00092 virtual void alerting (void); 00093 00098 virtual void callConnected (void); 00099 00104 virtual void callDisconnectedLogical (void); 00105 00110 virtual void callDisconnectedPhysical (void); 00111 00116 virtual void gotDTMF (void); 00117 00122 virtual void dataIn (unsigned char* data, unsigned length); 00123 00124 protected: 00127 virtual long getTime(); 00128 00131 void resetTimer(int new_timeout); 00132 00133 bool DTMF_exit; 00134 bool finish; 00135 Connection* conn; 00136 long exit_time; 00137 int timeout; 00138 }; 00139 00140 #endif 00141 00142 /* History 00143 00144 Old Log (for new changes see ChangeLog): 00145 00146 Revision 1.4 2003/10/03 14:56:40 gernot 00147 - partly implementation of a bigger semantic change: don't throw 00148 call finished exceptions in normal operation any longer; i.e. we only 00149 test for the connection at the begin of a command. This allows return 00150 values, e.g. for commands like capisuite.fax_receive() which were 00151 interrupted by an exception always in former CapiSuite versions and thus 00152 never returned. This is also a better and more logical use of exceptions 00153 IMO. ATTN: this is *far from stable* 00154 00155 Revision 1.3 2003/04/17 10:40:32 gernot 00156 - support new ALERTING notification feature of backend 00157 00158 Revision 1.2 2003/03/06 09:35:10 gernot 00159 - fixed typo 00160 00161 Revision 1.1.1.1 2003/02/19 08:19:53 gernot 00162 initial checkin of 0.4 00163 00164 Revision 1.12 2002/12/06 13:08:30 ghillie 00165 minor doc change 00166 00167 Revision 1.11 2002/11/29 10:27:44 ghillie 00168 - updated comments, use doxygen format now 00169 00170 Revision 1.10 2002/11/25 21:00:53 ghillie 00171 - improved documentation, now doxygen-readabl 00172 00173 Revision 1.9 2002/11/25 11:56:21 ghillie 00174 - changed semantics of timeout parameter: -1 = infinite now, 0 = 0 seconds (i.e. abort immediately) 00175 00176 Revision 1.8 2002/11/22 15:18:06 ghillie 00177 - added support for DTMF_exit 00178 - de-register Connection object uncondionally in destructor (checking for abort removed) 00179 00180 Revision 1.7 2002/11/21 15:34:50 ghillie 00181 - mainLoop() doesn't return any value any more, but throws CapiWrongState when connection is lost 00182 00183 Revision 1.6 2002/11/15 13:51:49 ghillie 00184 fix: call module wasn't finished when call was only connected/disconnected physically 00185 00186 Revision 1.5 2002/11/14 17:05:19 ghillie 00187 major structural changes - much is easier, nicer and better prepared for the future now: 00188 - added DisconnectLogical handler to CallInterface 00189 - DTMF handling moved from CallControl to Connection 00190 - new call module ConnectModule for establishing connection 00191 - python script reduced from 2 functions to one (callWaiting, callConnected 00192 merged to callIncoming) 00193 - call modules implement the CallInterface now, not CallControl any more 00194 => this freed CallControl from nearly all communication stuff 00195 00196 Revision 1.4 2002/11/13 15:25:08 ghillie 00197 fixed small typo 00198 00199 Revision 1.3 2002/11/13 08:34:54 ghillie 00200 moved history to the bottom 00201 00202 Revision 1.2 2002/11/12 15:52:08 ghillie 00203 added data in handler 00204 00205 Revision 1.1 2002/10/25 13:29:39 ghillie 00206 grouped files into subdirectories 00207 00208 Revision 1.3 2002/10/23 14:25:29 ghillie 00209 - a callmodule has to register itself at CallControl so it can be aborted if call is gone 00210 - added distinction between "exited normally" and "aborted because call is gone" -> different results of mainLoop() 00211 00212 Revision 1.2 2002/10/10 12:45:40 gernot 00213 added AudioReceive module, some small details changed 00214 00215 Revision 1.1 2002/10/09 14:34:22 gernot 00216 added CallModule class as base class for all call handling modules 00217 00218 */