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