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 AUDIORECEIVE_H 00018 #define AUDIORECEIVE_H 00019 00020 #include <string> 00021 #include "callmodule.h" 00022 00023 class Connection; 00024 00025 using namespace std; 00026 00050 class AudioReceive: public CallModule 00051 { 00052 public: 00065 AudioReceive(Connection *conn, string file, int timeout, int silence_timeout, bool DTMF_exit) throw (CapiWrongState,CapiExternalError); 00066 00074 void mainLoop() throw (CapiWrongState,CapiExternalError); 00075 00084 void dataIn(unsigned char* data, unsigned length); 00085 00090 long duration(); 00091 00092 private: 00093 unsigned int silence_count; 00094 unsigned int silence_timeout; 00095 string file; 00096 long start_time, 00097 end_time; 00098 }; 00099 00100 #endif 00101 00102 /* History 00103 00104 Old Log (for new changes see ChangeLog): 00105 00106 Revision 1.1.1.1 2003/02/19 08:19:53 gernot 00107 initial checkin of 0.4 00108 00109 Revision 1.14 2003/01/16 13:03:07 ghillie 00110 - added attribute end_time 00111 - updated comment to reflect new truncation of silence 00112 00113 Revision 1.13 2002/12/04 11:38:50 ghillie 00114 - added time measurement: save time in start_time at the begin of mainLoop() and return difference to getTime() in duration() 00115 00116 Revision 1.12 2002/12/02 12:32:21 ghillie 00117 renamed Connection::SPEECH to Connection::VOICE 00118 00119 Revision 1.11 2002/11/29 10:26:10 ghillie 00120 - updated comments, use doxygen format now 00121 - removed transmissionComplete() method as this makes no sense in receiving! 00122 00123 Revision 1.10 2002/11/25 11:54:21 ghillie 00124 - tests for speech mode before receiving now 00125 - small performance improvement (use string::empty() instead of comparison to "") 00126 00127 Revision 1.9 2002/11/22 15:16:20 ghillie 00128 added support for finishing when DTMF is received 00129 00130 Revision 1.8 2002/11/21 15:32:40 ghillie 00131 - moved code from constructor/destructor to overwritten mainLoop() method 00132 00133 Revision 1.7 2002/11/19 15:57:19 ghillie 00134 - Added missing throw() declarations 00135 - phew. Added error handling. All exceptions are caught now. 00136 00137 Revision 1.6 2002/11/14 17:05:19 ghillie 00138 major structural changes - much is easier, nicer and better prepared for the future now: 00139 - added DisconnectLogical handler to CallInterface 00140 - DTMF handling moved from CallControl to Connection 00141 - new call module ConnectModule for establishing connection 00142 - python script reduced from 2 functions to one (callWaiting, callConnected 00143 merged to callIncoming) 00144 - call modules implement the CallInterface now, not CallControl any more 00145 => this freed CallControl from nearly all communication stuff 00146 00147 Revision 1.5 2002/11/13 15:24:25 ghillie 00148 finished silence detection code 00149 00150 Revision 1.4 2002/11/13 08:34:54 ghillie 00151 moved history to the bottom 00152 00153 Revision 1.3 2002/11/12 15:52:08 ghillie 00154 added data in handler 00155 00156 Revision 1.2 2002/10/29 14:28:22 ghillie 00157 added stop_file_* calls to make sure transmission is cancelled when it's time... 00158 00159 Revision 1.1 2002/10/25 13:29:39 ghillie 00160 grouped files into subdirectories 00161 00162 Revision 1.2 2002/10/24 09:55:52 ghillie 00163 many fixes. Works for one call now 00164 00165 Revision 1.1 2002/10/23 09:47:30 ghillie 00166 added audioreceive module 00167 00168 */