#include <incomingscript.h>
Inheritance diagram for IncomingScript:
Public Member Functions | |
IncomingScript (ostream &debug, unsigned short debug_level, ostream &error, Connection *conn, string incoming_script, PycStringIO_CAPI *cStringIO) throw (ApplicationError) | |
Constructor. Create Object and start detached thread. | |
virtual | ~IncomingScript () |
Destructor. Destruct object and assure the call is disconnected. | |
Private Member Functions | |
virtual void | run (void) throw () |
Thread body. Calls the python function callIncoming() which will handle the call. | |
Private Attributes | |
Connection * | conn |
reference to according connection object | |
pthread_t | thread_handle |
handle for the created pthread thread | |
Friends | |
void * | incomingscript_exec_handler (void *) |
Thread exec handler for IncomingScript class. | |
void | incomingscript_cleanup_handler (void *) |
Thread clean handler for IncomingScript class. |
IncomingScript handels an incoming connection. For each connection, one object of it is created by FlowControl. It mainly creates a new thread with an own python subinterpreter, initializes the capisuitemodule, and calls run() of PythonScript which will execute the defined function in the script.
|
Constructor. Create Object and start detached thread.
|
|
Destructor. Destruct object and assure the call is disconnected.
|
|
Thread body. Calls the python function callIncoming() which will handle the call. Create python sub-interpreter, read script for incoming calls, The read Python script for incoming calls must provide a function named callIncoming with the following signature: def callIncoming(call, service, callingParty, calledParty): # function body The parameters given to the python function are:
At the moment callIncoming() is called, the call is waiting for an answer, so the first thing the script must do is to call connect_*() or reject(). It must also disconnect the call in any case (even in the exception handlers!) before finishing using disconnect(). If the call is disconnected by the other party, the Python exception CallGoneError is raised and should be caught by the script (but even there you must call disconnect()). The python global lock will be acquired while the function runs. Reimplemented from PythonScript.
|
|
Thread clean handler for IncomingScript class. This is a handler which is called by pthreads at cleanup. It will call this->final(). |
|
Thread exec handler for IncomingScript class. This is a handler which will call this->run() for the use in pthread_create(). It will also register incomingscript_cleanup_handler |
|
reference to according connection object
|
|
handle for the created pthread thread
|