<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>CapiSuite: IncomingScript Class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.3.8 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a></div> <h1>IncomingScript Class Reference</h1>Incoming call handling. One object for each incoming call is created. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="incomingscript_8h-source.html">incomingscript.h</a>></code> <p> <p>Inheritance diagram for IncomingScript: <p><center><img src="classIncomingScript.png" usemap="#IncomingScript_map" border="0" alt=""></center> <map name="IncomingScript_map"> <area href="classPythonScript.html" alt="PythonScript" shape="rect" coords="0,0,95,24"> </map> <a href="classIncomingScript-members.html">List of all members.</a><table border=0 cellpadding=0 cellspacing=0> <tr><td></td></tr> <tr><td colspan=2><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="classIncomingScript.html#a0">IncomingScript</a> (ostream &<a class="el" href="classPythonScript.html#p3">debug</a>, unsigned short <a class="el" href="classPythonScript.html#p5">debug_level</a>, ostream &<a class="el" href="classPythonScript.html#p4">error</a>, <a class="el" href="classConnection.html">Connection</a> *<a class="el" href="classIncomingScript.html#r0">conn</a>, string incoming_script, PycStringIO_CAPI *<a class="el" href="classPythonScript.html#p6">cStringIO</a>) throw (ApplicationError)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Constructor. Create Object and start detached thread. <a href="#a0"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top>virtual </td><td class="memItemRight" valign=bottom><a class="el" href="classIncomingScript.html#a1">~IncomingScript</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. Destruct object and assure the call is disconnected. <a href="#a1"></a><br></td></tr> <tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top>virtual void </td><td class="memItemRight" valign=bottom><a class="el" href="classIncomingScript.html#d0">run</a> (void) throw ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Thread body. Calls the python function callIncoming() which will handle the call. <a href="#d0"></a><br></td></tr> <tr><td colspan=2><br><h2>Private Attributes</h2></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="classConnection.html">Connection</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="classIncomingScript.html#r0">conn</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">reference to according connection object <a href="#r0"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top>pthread_t </td><td class="memItemRight" valign=bottom><a class="el" href="classIncomingScript.html#r1">thread_handle</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">handle for the created pthread thread <a href="#r1"></a><br></td></tr> <tr><td colspan=2><br><h2>Friends</h2></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top>void * </td><td class="memItemRight" valign=bottom><a class="el" href="classIncomingScript.html#n0">incomingscript_exec_handler</a> (void *)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Thread exec handler for IncomingScript class. <a href="#n0"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="classIncomingScript.html#n1">incomingscript_cleanup_handler</a> (void *)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Thread clean handler for IncomingScript class. <a href="#n1"></a><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> Incoming call handling. One object for each incoming call is created. <p> 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 <a class="el" href="classIncomingScript.html#d0">run()</a> of <a class="el" href="classPythonScript.html">PythonScript</a> which will execute the defined function in the script.<p> <dl compact><dt><b>Author:</b></dt><dd>Gernot Hillier </dd></dl> <p> <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="a0" doxytag="IncomingScript::IncomingScript" ></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> IncomingScript::IncomingScript </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">ostream & </td> <td class="mdname" nowrap> <em>debug</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>unsigned short </td> <td class="mdname" nowrap> <em>debug_level</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>ostream & </td> <td class="mdname" nowrap> <em>error</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="classConnection.html">Connection</a> * </td> <td class="mdname" nowrap> <em>conn</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>string </td> <td class="mdname" nowrap> <em>incoming_script</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap>PycStringIO_CAPI * </td> <td class="mdname" nowrap> <em>cStringIO</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"> throw (<a class="el" href="classApplicationError.html">ApplicationError</a>)</td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Constructor. Create Object and start detached thread. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>debug</em> </td><td>stream for debugging info </td></tr> <tr><td></td><td valign=top><em>debug_level</em> </td><td>verbosity level for debug messages </td></tr> <tr><td></td><td valign=top><em>error</em> </td><td>stream for error messages </td></tr> <tr><td></td><td valign=top><em>conn</em> </td><td>reference to according connection (disconnected if error occurs) </td></tr> <tr><td></td><td valign=top><em>incoming_script</em> </td><td>file name of the python script to use as incoming script </td></tr> <tr><td></td><td valign=top><em>cStringIO</em> </td><td>pointer to the Python cStringIO C API </td></tr> </table> </dl> <dl compact><dt><b>Exceptions:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>ApplicationError</em> </td><td>Thrown if thread can't be started</td></tr> </table> </dl> </td> </tr> </table> <a class="anchor" name="a1" doxytag="IncomingScript::~IncomingScript" ></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> IncomingScript::~<a class="el" href="classIncomingScript.html">IncomingScript</a> </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [virtual]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Destructor. Destruct object and assure the call is disconnected. <p> </td> </tr> </table> <hr><h2>Member Function Documentation</h2> <a class="anchor" name="d0" doxytag="IncomingScript::run" ></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void IncomingScript::run </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap> throw ()<code> [private, virtual]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Thread body. Calls the python function callIncoming() which will handle the call. <p> Create python sub-interpreter, read script for incoming calls,<p> The read Python script for incoming calls must provide a function named callIncoming with the following signature:<p> def callIncoming(call, service, callingParty, calledParty): # function body<p> The parameters given to the python function are:<ul> <li>call: reference to the incoming call. Must be given to all capisuite-provided python functions as first parameter.</li><li>service (integer): service as signalled by ISDN, set to one of the SERVICE_* constants defined in capisuitemodule_init</li><li>callingParty (string): the number of the calling party (source of the call)</li><li>calledParty (string): the number of the called party (destination of the call)</li></ul> <p> 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().<p> 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()).<p> The python global lock will be acquired while the function runs. <p> Reimplemented from <a class="el" href="classPythonScript.html#b0">PythonScript</a>. <p> </td> </tr> </table> <hr><h2>Friends And Related Function Documentation</h2> <a class="anchor" name="n1" doxytag="IncomingScript::incomingscript_cleanup_handler" ></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void incomingscript_cleanup_handler </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void * </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [friend]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Thread clean handler for IncomingScript class. <p> This is a handler which is called by pthreads at cleanup. It will call this-><a class="el" href="classPythonScript.html#b1">final()</a>. </td> </tr> </table> <a class="anchor" name="n0" doxytag="IncomingScript::incomingscript_exec_handler" ></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void* incomingscript_exec_handler </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void * </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [friend]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Thread exec handler for IncomingScript class. <p> This is a handler which will call this-><a class="el" href="classIncomingScript.html#d0">run()</a> for the use in pthread_create(). It will also register incomingscript_cleanup_handler </td> </tr> </table> <hr><h2>Member Data Documentation</h2> <a class="anchor" name="r0" doxytag="IncomingScript::conn" ></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="classConnection.html">Connection</a>* <a class="el" href="classIncomingScript.html#r0">IncomingScript::conn</a><code> [private]</code> </td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> reference to according connection object <p> </td> </tr> </table> <a class="anchor" name="r1" doxytag="IncomingScript::thread_handle" ></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> pthread_t <a class="el" href="classIncomingScript.html#r1">IncomingScript::thread_handle</a><code> [private]</code> </td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> handle for the created pthread thread <p> </td> </tr> </table> <hr>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="incomingscript_8h-source.html">incomingscript.h</a><li>incomingscript.cpp</ul> <hr size="1"><address style="align: right;"><small>Generated on Sun Nov 28 14:37:45 2004 for CapiSuite by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.8 </small></address> </body> </html>