#include <callmodule.h>
Inheritance diagram for CallModule:
Public Member Functions | |
CallModule (Connection *connection, int timeout=-1, bool DTMF_exit=false) | |
Constructor. Register this module at the according Connection object. | |
~CallModule () | |
Destructor. Deregister this module at the according Connection object. | |
virtual void | mainLoop () throw (CapiWrongState,CapiMsgError,CapiExternalError,CapiError) |
Waits in busy loop until the module is completed. | |
virtual void | transmissionComplete (void) |
empty here. | |
virtual void | alerting (void) |
empty here. | |
virtual void | callConnected (void) |
empty here. | |
virtual void | callDisconnectedLogical (void) |
abort current modul if logical connection is lost. | |
virtual void | callDisconnectedPhysical (void) |
abort current module if physical connection is lost. | |
virtual void | gotDTMF (void) |
finish current module if DTMF is received. | |
virtual void | dataIn (unsigned char *data, unsigned length) |
empty here. | |
Protected Member Functions | |
virtual long | getTime () |
get the current time in # of seconds sinc 1/1/1970 | |
void | resetTimer (int new_timeout) |
restart the timer with new timeout value | |
Protected Attributes | |
bool | DTMF_exit |
if set to true, we will finish when we receive a DTMF signal | |
bool | finish |
set this if the module should exit nicely for any reason | |
bool | abort |
set this for hard exit because connection is lost, causes CapiWrongState to be throwed in mainLoop | |
Connection * | conn |
reference to the according Connection object | |
long | exit_time |
time when the timeout should occur | |
int | timeout |
timeout period in seconds |
This class implements the CallInterface. It is the base class for all special call handling modules like FaxReceive/FaxSend, AudioReceive/AudioSend, etc. It contains basic code for registering with the according Connection object, realizing exits because of timeouts, received DTMF and call clearing from the other party.
The general usage is: create a CallModule object, then run mainLoop(). mainLoop() will exit if necessary.
To be able to recognize call clearing of the other party, the CapiWrongState exception is used. It is triggered by mainLoop().
Sub classes will mainly overwrite mainLoop() and the other signals they need for their tasks.
If you don't change the semantics in the sub classes, the module will terminate when at least one of the following events occurs:
|
Constructor. Register this module at the according Connection object.
|
|
Destructor. Deregister this module at the according Connection object.
|
|
empty here. empty function to overwrite if necessary Implements CallInterface.
Reimplemented in CallOutgoing.
|
|
empty here. empty function to overwrite if necessary Implements CallInterface.
Reimplemented in CallOutgoing, ConnectModule, and Switch2FaxG3.
|
|
abort current modul if logical connection is lost. will abort currently running module. May be overwritten with complete new behaviour if needed. Implements CallInterface.
Reimplemented in DisconnectModule, and Switch2FaxG3.
|
|
abort current module if physical connection is lost. will abort currently running module. Only overwrite if you know what you do! Implements CallInterface.
Reimplemented in DisconnectModule.
|
|
empty here. empty function to overwrite if necessary Implements CallInterface.
Reimplemented in AudioReceive.
|
|
get the current time in # of seconds sinc 1/1/1970
|
|
finish current module if DTMF is received. finish current module if DTMF_exit was enabled Implements CallInterface.
Reimplemented in ReadDTMF.
|
|
Waits in busy loop until the module is completed. Waits in a busy loop (sleeping 100 msecs between each iteration) until a DTMF signal is reached (if enabled) or the timeout is reached (if enabled). This method will likely be overwritten in each sub class. You can call CallModule::mainLoop() there to implement busy loops.
Reimplemented in AudioReceive, AudioSend, CallOutgoing, ConnectModule, DisconnectModule, FaxReceive, FaxSend, ReadDTMF, and Switch2FaxG3.
|
|
restart the timer with new timeout value
|
|
empty here. empty function to overwrite if necessary Implements CallInterface.
Reimplemented in AudioSend, FaxReceive, and FaxSend.
|
|
set this for hard exit because connection is lost, causes CapiWrongState to be throwed in mainLoop
|
|
reference to the according Connection object
|
|
if set to true, we will finish when we receive a DTMF signal
|
|
time when the timeout should occur
|
|
set this if the module should exit nicely for any reason
|
|
timeout period in seconds
|