Author: derek Date: Mon Jun 11 01:17:26 2007 New Revision: 305 Modified: sofaswitch/trunk/callflow/docs/app1.sgml sofaswitch/trunk/callflow/docs/chap2.sgml sofaswitch/trunk/callflow/docs/chap3.sgml sofaswitch/trunk/callflow/src/acceptcall.cpp sofaswitch/trunk/callflow/src/acceptcall.h sofaswitch/trunk/callflow/src/stoptimer.cpp Log: Tidyups, and text inserts, resulting from doing documentation on this utility. Modified: sofaswitch/trunk/callflow/docs/app1.sgml ============================================================================== --- sofaswitch/trunk/callflow/docs/app1.sgml (original) +++ sofaswitch/trunk/callflow/docs/app1.sgml Mon Jun 11 01:17:26 2007 @@ -1,16 +1,16 @@ <appendix> <title>Building these docs</title> <para> -The documentation for %callflow was generated from multiple +The documentation for &callflow; was generated from multiple <literal>.sgml</literal> and <literal>.xml</literal> files. The utility <screen> xsltproc </screen> was used to process the supplied files to generate <literal>html</literal> files and several auxillary help files. The generated files were compressed -into one <literal>.zip</literal> file. When the &callflow; utility runs, it -reads in the supplied zip file (which contains the index information). A -<literal>wxWidgets</literal> class is used to display the html documentation. +into one <literal>.zip</literal> file. When the &callflow; utility runs, the +generated zip file is read in. A <literal>wxWidgets</literal> class is used to +display the html documentation. </para> <para> Modified: sofaswitch/trunk/callflow/docs/chap2.sgml ============================================================================== --- sofaswitch/trunk/callflow/docs/chap2.sgml (original) +++ sofaswitch/trunk/callflow/docs/chap2.sgml Mon Jun 11 01:17:26 2007 @@ -20,7 +20,7 @@ <title>Hello World example</title> <para> Perhaps the simplest example of a graph you can create is the standard "Hello -World" example, shown here, in <xref xrefstyle="select: title" linkend="helloworldexample"/>. +World" example, shown here, in figure <xref xrefstyle="select: labelnumber" linkend="helloworldexample"/>. <figure id="helloworldexample"> <title>The standard "Hello World" example</title> <mediaobject><imageobject> @@ -78,7 +78,7 @@ initialisation, increment operator, and termination condition, consist of Python code that is set in the preferences at the beginning of the for loop (right mouse button on the for loop entity). A simple example of a for loop is -shown in <xref linkend="forloopexample"/>. +shown in figure <xref xrefstyle="select: labelnumber" linkend="forloopexample"/>. <figure id="forloopexample"> <title>Example of a for loop</title> <mediaobject> @@ -103,7 +103,7 @@ <title>Event handling</title> <para> We describe the handling of events in this section, with a simple example, -shown in <xref linkend="simpleeventexample"/>. +shown in figure <xref xrefstyle="select: labelnumber" linkend="simpleeventexample"/>. <figure id="simpleeventexample"> <title>Example of event handling</title> <mediaobject> @@ -180,14 +180,14 @@ <sect1> <title>Trivial transfer of audio</title> <para> -Key to the operation of &sofaswitch; is the ability to move -audio from one entity to another. This audio passes directly betweeen -entities, and does not go via the server. The &sofaswitch; -entities themselves worry about the transport of the data. The trivial example in -<xref linkend="trivialtransferexample"/> shows the transfer of audio from -the sound entity back to the sound entity. Consequently, audio that is captured -at the mic will be directed to the speaker. The sound entity has therefore been told to -talk to itself. +Key to the operation of &sofaswitch; is the ability to move audio from one +entity to another. This audio passes directly betweeen entities, and does not +go via the server. The &sofaswitch; entities themselves worry about the +transport of the data. The trivial example in figure <xref xrefstyle="select: +labelnumber" linkend="trivialtransferexample"/> shows the transfer of audio +from the sound entity back to the sound entity. Consequently, audio that is +captured at the mic will be directed to the speaker. The sound entity has +therefore been told to talk to itself. <figure id="trivialtransferexample"> <title>Trivial example of the transfer of audio</title> <mediaobject> @@ -220,7 +220,7 @@ <title>Transfer audio, and timer example</title> <para> We describe the handling of events in this section, with a simple example -(<xref linkend="amtestexample"/>). +(figure <xref xrefstyle="select: labelnumber" linkend="amtestexample"/>). <figure id="amtestexample"> <title>Example of audio transfer between &sofaswitch; nodes, and timers.</title> Modified: sofaswitch/trunk/callflow/docs/chap3.sgml ============================================================================== --- sofaswitch/trunk/callflow/docs/chap3.sgml (original) +++ sofaswitch/trunk/callflow/docs/chap3.sgml Mon Jun 11 01:17:26 2007 @@ -19,11 +19,87 @@ +<sect1> +<title>Accept call (yes/no)</title> +<para> +Consider figure <xref xrefstyle="select: labelnumber" linkend="answercallicon"/> which shows the icon +and graph representation of the control structure used to indicate to a remote +&sofaswitch; node that an incoming voip/TDM call can be answered with a yes (or no). +<figure id="icon"> +<title>Accept call control element</title> +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> +<row><entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="iconimages/QueryAnswer.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry> +<entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="graphimages/QueryAnswer.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry></row> +<row><entry><para>icon </para></entry> + <entry><para>graph representation</para></entry></row> +</tbody> +</tgroup> +</informaltable> +</figure> +</para> + + +<para> +The accept call control structure, on selecting the right mouse button, brings up a properties +box that has multiple fields + +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> + +<row> <entry><literal> +Tool tip +</literal></entry> +<entry><para> +The text which is displayed when the mouse hovers over this object for 3 seconds. +Ideally, you should extend this to contain information about the destination +&sofaswitch; node and the desired call status. +</para></entry></row> + +<row> <entry><literal> +SofaSwitch node to advise (Python code) +</literal></entry> +<entry><para> +This Python code (or string literal) provides the id of the remote &sofaswitch; +node we send this message to. +</para></entry></row> + +<row> <entry><literal> +Accept call yes or no (Python code) +</literal></entry> +<entry><para> +This Python code (or string literal) should contain some textual description on +if the call should be answered. A string could be <literal>"y"</literal> or +<literal>"yes"</literal>. Alternatively you could use a Python expression +yielding a boolean answer, such as <literal>true</literal> or <literal>2 > 1</literal>. +</para></entry></row> + +</tbody> +</tgroup> +</informaltable> +</para> +</sect1> + + <sect1> <title>Conditional execution</title> <para> -Consider the figure <xref linkend="conditionalicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="conditionalicon"/> which shows the icon and graph representation of the control structure used to direct the flow of execution, given the outcome of a boolean Python statement. <figure id="conditionalicon"> @@ -109,12 +185,12 @@ <sect1> <title>Death - terminate processing of this graph</title> <para> -Consider the figure <xref linkend="deathicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="deathicon"/> which shows the icon and graph representation of the control structure used to immediately terminate all processing of this graph. <figure id="deathicon"> <title>Death control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -193,14 +269,14 @@ <sect1> <title>End a call</title> <para> -Consider the figure <xref linkend="endcallicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="endcallicon"/> which shows the icon and graph representation of the control structure used to end a call, or terminate a &sofaswitch; node. Thus, you could use this control structure to terminate a voip call or close down an answering machine worker node. <figure id="endcallicon"> <title>End call control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -267,13 +343,92 @@ does not match any node in existance, nothing will happen - the message server will silenty drop the termination message. </para></entry></row> +</tbody> +</tgroup> +</informaltable> +</para> +</sect1> + + + +<sect1> +<title>End for loop</title> +<para> +Consider figure <xref xrefstyle="select: labelnumber" linkend="endforloopicon"/> which shows the icon +and graph representation of the control structure used to indicate the end of a +for loop. +<figure id="endforloopicon"> +<title>End for loop control element</title> +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> +<row><entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="iconimages/EndFor.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry> +<entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="graphimages/EndFor.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry></row> +<row><entry><para>icon </para></entry> + <entry><para>graph representation</para></entry></row> </tbody> </tgroup> </informaltable> +</figure> +</para> + + <para> +This end for loop structure always returns control to the beginning of the for +loop, where the test for completion is carried out. Should the test for +completion be <literal>true</literal>, execution will jump to the control +structure immediately below this end for loop element. +</para> +<para> +Since the for loop is executed under the software control of generated Python, +it is legal and valid for control to break out of the for loop and skip this control element. +</para> +<para> +The connections to this box are: +<itemizedlist> + <listitem><para>top: is linked to the body of the + loop</para></listitem> + <listitem><para>left: is joined to the left connector of the for loop. + + <listitem><para>bottom: is joined to the control structrues that are + to be executed after the for loop has finished. + </para></listitem> +</itemizedlist> +</para> + +<para> +The end for loop control structure, on selecting the right mouse button, brings up a properties +box that has one field. +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> + +<row> <entry><literal> +Tool tip +</literal></entry> +<entry><para> +The text which is displayed when the mouse hovers over this object for 3 seconds. +You could extend this to contain information about the loop, or set +this field to blank to minimise the amount of pop up text. +</para></entry></row> +</tbody> +</tgroup> +</informaltable> </para> </sect1> @@ -282,17 +437,96 @@ +<sect1> +<title>End timer +</title> +<para> +Consider figure <xref xrefstyle="select: labelnumber" linkend="endtimericon"/> which shows the icon +and graph representation of the control structure used to terminate a running +timer. On using this structure, pending timer events will be removed. +<figure id="endtimericon"> +<title>End call control element</title> +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> +<row><entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="iconimages/EndTimer.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry> +<entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="graphimages/EndTimer.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry></row> +<row><entry><para>icon </para></entry> + <entry><para>graph representation</para></entry></row> +</tbody> +</tgroup> +</informaltable> +</figure> +</para> + +<para> +Should the required timer not be in existance (already expired or specified +incorrectly) no error message is generated. The system will continue processing +as before. +</para> + +<para> +The end timer control structure, on selecting the right mouse button, brings up a properties +box that has multiple fields + +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> + +<row> <entry><literal> +Tool tip +</literal></entry> +<entry><para> +The text which is displayed when the mouse hovers over this object for 3 seconds. +Ideally, you should extend this to contain information about the timer to be stopped. +</para></entry></row> + +<row> <entry><literal> +Timer to stop (Python code) +</literal></entry> +This Python code (or string literal) is used to indicate the timer which is to +be stopped. Should this code be incorrect, a message will be printed to the +console and execution continues. +<entry><para> + +</para></entry></row> + + +</tbody> +</tgroup> +</informaltable> + + +</para> +</sect1> + + + + + <sect1> <title>Event collection and registration</title> <para> -Consider the figure <xref linkend="eventicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="eventicon"/> which shows the icon and graph representation of the control structure used to collect events, and register for events. <figure id="eventicon"> <title>Event control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -416,11 +650,11 @@ <sect1> <title>Join items</title> <para> -Consider the figure <xref linkend="joinlinesicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="joinlinesicon"/> which shows the icon representation of the control structure used to <figure id="joinlinesicon"> <title>Join control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="1"> <tbody> <row> @@ -509,12 +743,12 @@ <sect1> <title>Load new graph</title> <para> -Consider the figure <xref linkend="loadnewgraphicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="loadnewgraphicon"/> which shows the icon and graph representation of the control structure used to load a new graph file into the currently running Python executable. <figure id="loadnewgraphicon"> <title>Load new graph control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -611,12 +845,12 @@ <sect1> <title>Make a call</title> <para> -Consider the figure <xref linkend="makecallicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="makecallicon"/> which shows the icon and graph representation of the control structure used to cause a &sofaswitch; entity to initiate a TDM or voip call. <figure id="makecallicon"> <title>Make call control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -701,12 +935,12 @@ <sect1> <title>Execute arbitrary Python command</title> <para> -Consider the figure <xref linkend="Pythonicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="Pythonicon"/> which shows the icon and graph representation of the control structure used to define and execute an arbitrary Python command. <figure id="Pythonicon"> <title>Execute arbitrary Python code control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -845,13 +1079,13 @@ <sect1> <title>Read from file</title> <para> -Consider the figure <xref linkend="readfromfileicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="readfromfileicon"/> which shows the icon and graph representation of the control structure used to request an answering machine node to read audio from a S16_LE wav file. Audio read from the wav file is sent to the node designated by previous/subsequent transfer media commands. <figure id="readfromfileicon"> <title>Read from file control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -918,13 +1152,91 @@ </literal></entry> <entry><para> </para></entry></row> +</tbody> +</tgroup> +</informaltable> +</para> +</sect1> + + +<sect1> +<title>Master node +</title> +<para> +Consider figure <xref xrefstyle="select: labelnumber" +linkend="masternodeicon"/> which shows the icon and graph representation of the +control structure used to indicate that a remote &sofaswitch; node should send +events (such as <literal>incoming call, answer ?</literal>) to this graph. +<figure id="icon"> +<title>Master node control element</title> +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> +<row><entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="iconimages/MasterNode.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry> +<entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="graphimages/MasterNode.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry></row> +<row><entry><para>icon </para></entry> + <entry><para>graph representation</para></entry></row> </tbody> </tgroup> </informaltable> +</figure> +</para> + +<para> +The master node control entity causes all events from the designated +&sofaswitch; identity to be sent to this graph. Alternatively, this graph is +registerin for all events from the remote &sofaswitch; node. When the remote +&sofaswitch; node dies, the server will send this graph a message to that +effect. +</para> + +<para> +Registration for all events is not "permanent". Should another control graph +issue this command to the same &sofaswitch; identity, this graph will cease to +receive events. +</para> +<para> +The end call control structure, on selecting the right mouse button, brings up a properties +box that has multiple fields + +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> + +<row> <entry><literal> +Tool tip +</literal></entry> +<entry><para> +The text which is displayed when the mouse hovers over this object for 3 seconds. +Ideally, you should extend this to contain information about the remote +&sofaswitch; node. +</para></entry></row> +<row> <entry><literal> +Node to receive events from (Python code) +</literal></entry> +<entry><para> +This python code specifies remote &sofaswitch; identity we wish to receive +events from. It can be a Python variable, or a fixed literal string. +</para></entry></row> +</tbody> +</tgroup> +</informaltable> </para> </sect1> @@ -932,17 +1244,83 @@ +<sect1> +<title>Message - send arbitrary &sofaswitch; command</title> +<para> +Consider figure <xref xrefstyle="select: labelnumber" linkend="messageicon"/> which shows the icon +and graph representation of the control structure used to send an arbitrary +&sofaswitch command +<figure id="icon"> +<title>Message control element</title> +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> +<row><entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="iconimages/Message.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry> +<entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="graphimages/Message.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry></row> +<row><entry><para>icon </para></entry> + <entry><para>graph representation</para></entry></row> +</tbody> +</tgroup> +</informaltable> +</figure> +</para> + + +<para> +The message control structure, on selecting the right mouse button, brings up a properties +box that has multiple fields + +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> + +<row> <entry><literal> +Tool tip +</literal></entry> +<entry><para> +The text which is displayed when the mouse hovers over this object for 3 seconds. +Ideally, you should extend this to contain information +</para></entry></row> + +<row> <entry><literal> +</literal></entry> +<entry><para> + +</para></entry></row> + + +</tbody> +</tgroup> +</informaltable> + + +</para> +</sect1> + + <sect1> <title>Request node</title> <para> -Consider the figure <xref linkend="requestnodeicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="requestnodeicon"/> which shows the icon and graph representation of the control structure used to request a worker node from a &sofaswitch; entity. <figure id="requestnodeicon"> <title>Request node control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -1048,6 +1426,87 @@ &sofaswitch; applications want. For example, the conference utility needs information on which room the requested node should be in. </para></entry></row> +</tbody> +</tgroup> +</informaltable> +</para> +</sect1> + + + + +<sect1> +<title>Send DTMF</title> +<para> +Consider figure <xref xrefstyle="select: labelnumber" linkend="senddtmficon"/> which shows the icon +and graph representation of the control structure used to cause DTMF to be sent +to a TDM or voip &sofaswitch; element, which in turn sends the DTMF to the +remote end of the call. +<figure id="icon"> +<title>Send DTMF control element</title> +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> +<row><entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="iconimages/SendDtmf.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry> +<entry><para> +<mediaobject> +<imageobject> +<imagedata fileref="graphimages/SendDtmf.png" align="center" format="PNG"></imagedata> +</imageobject> +</mediaobject> +</para></entry></row> +<row><entry><para>icon </para></entry> + <entry><para>graph representation</para></entry></row> +</tbody> +</tgroup> +</informaltable> +</figure> +</para> + + +<para> +The Send Dtmf call control structure, on selecting the right mouse button, brings up a properties +box that has multiple fields + +<informaltable frame="all"> +<tgroup cols="2"> +<tbody> + +<row> <entry><literal> +Tool tip +</literal></entry> +<entry><para> +The text which is displayed when the mouse hovers over this object for 3 seconds. +Ideally, you should extend this to contain information about the reason for the +DTMF being sent, or the DTMF being sent, or... +</para></entry></row> + +<row> <entry><literal> +Worker node to activate (Python code) +</literal></entry> +<entry><para> +This code describes the Id of the destination of this message. Using a fixed +string, such as <literal>"voip1"</literal> is unwise, as it means for this to +graph to execute correctly, the voip node has to be present. +The variable describing the id of the &sofaswitch; worker node could +have been initialised on receiving notification of an incoming call, or on +creating an outgoing call. +</para></entry></row> + +<row> <entry><literal> +DTMF to send to the worker node (Python code) +</literal></entry> +This code describes the DTMF that is to be sent. Typically, this would be some +Python variables describing the id of the destination node. +<entry><para> + +</para></entry></row> </tbody> @@ -1062,15 +1521,19 @@ + + + + <sect1> <title>Start for loop</title> <para> -Consider the figure <xref linkend="StartForLoopIcon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="StartForLoopIcon"/> which shows the icon and graph representation of the control structure used to begin a <literal>for loop</literal>. <figure id="StartForLoopIcon"> <title>Start for loop control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -1165,12 +1628,12 @@ <sect1> <title>Start graph processing</title> <para> -Consider the figure <xref linkend="graphprocessicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="graphprocessicon"/> which shows the icon and graph representation of the control structure used to initiate processing of this graph. <figure id="graphprocessicon"> <title>Start graph processing control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -1238,12 +1701,12 @@ <sect1> <title>Suspend graph processing</title> <para> -Consider the figure <xref linkend="suspendprocessingicon"/> which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="suspendprocessingicon"/> which shows the icon and graph representation of the control structure used to suspend the processing of the graph. <figure id="suspendprocessingicon"> <title>Suspend graph processing control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -1314,11 +1777,11 @@ <sect1> <title>Timer</title> <para> -Consider the figure <xref linkend="timericon"/>, which contains the toolbar icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="timericon"/>, which contains the toolbar icon and graph represeentation of the control structure used to create a timer. <figure id="timericon"> <title>Timer control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> @@ -1405,7 +1868,7 @@ <sect1> <title>Transfer of audio between two &sofaswitch; entities</title> <para> -Consider the figure <xref linkend="transfermediaicon"/>, which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="transfermediaicon"/>, which shows the icon and graph representation of the control structure used to enable the flow of audio between two &sofaswitch; entities. <figure id="transfermediaicon"> @@ -1504,12 +1967,12 @@ <sect1> <title>Write to file</title> <para> -Consider the figure <xref linkend="writetofileicon"/>, which shows the icon +Consider the figure <xref xrefstyle="select: labelnumber" linkend="writetofileicon"/>, which shows the icon and graph representation of the control structure used to cause the answering machine to write incoming audio to a file. <figure id="writetofileicon"> <title>Write to file control element</title> -<informaltable frame="none"> +<informaltable frame="all"> <tgroup cols="2"> <tbody> <row><entry><para> Modified: sofaswitch/trunk/callflow/src/acceptcall.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/acceptcall.cpp (original) +++ sofaswitch/trunk/callflow/src/acceptcall.cpp Mon Jun 11 01:17:26 2007 @@ -24,7 +24,7 @@ InformationSection(wxT("Tool tip"), wxT("\"Accept incoming voip call at sofa node \"voip1\"")); displayData[1] = - InformationSection(wxT("SofaSwitch node to advise as to accepting the call (Python code)"), wxT("\"voip1\"")); + InformationSection(wxT("SofaSwitch node to advise (Python code)"), wxT("\"voip1\"")); displayData[displayData.size()] = InformationSection(wxT("Answer call yes or no (Python code)"), wxT("\"yes\"")); @@ -50,3 +50,52 @@ int yPos = m_rect.y + 20 - (h/2); dc.DrawText(text, xPos, yPos); } + + + +bool DndShapeAcceptCall::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Accept_Call(self, sTuple): "); + file.AddLine(" a,b,c = sTuple "); + file.AddLine(" self.aMedia = self.data[a][\"dest node\"] "); + file.AddLine(" try: "); + file.AddLine(" self.rhost = eval(self.aMedia) "); + file.AddLine(" except: "); + file.AddLine(" print \"The SofaSwitch node id \", self.aMedia, \" could not be evaluated\" "); + file.AddLine(" return self.data[a][\"Output\"] "); + + file.AddLine(" self.mesg = self.data[a][\"do answer\"] "); + file.AddLine(" try: "); + file.AddLine(" self.myanswer = eval(self.mesg) "); + file.AddLine(" except: "); + file.AddLine(" print \"The evaluation of \", self.mesg, \" failed - no idea what this means\" "); + file.AddLine(" return self.data[a][\"Output\"] "); + file.AddLine(" self.rhost += \":ANSWERCALL \" + self.myanswer + \"\\0\" "); + file.AddLine(" self.transport.write(self.rhost) "); + file.AddLine(" return self.data[a][\"Output\"] "); + file.AddLine(""); + + return true; +} + +bool DndShapeAcceptCall::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + file.AddLine(wxString::Format(" \"Output\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + file.AddLine(wxString::Format(" \"dest node\" : ")); + wxString dest = ProtectString(displayData[1].data); + file.AddLine(wxString::Format(" \"%s\", ", dest.c_str())); + + file.AddLine(wxString::Format(" \"do answer\" : ")); + dest = ProtectString(displayData[2].data); + file.AddLine(wxString::Format(" \"%s\", ", dest.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} Modified: sofaswitch/trunk/callflow/src/acceptcall.h ============================================================================== --- sofaswitch/trunk/callflow/src/acceptcall.h (original) +++ sofaswitch/trunk/callflow/src/acceptcall.h Mon Jun 11 01:17:26 2007 @@ -19,6 +19,12 @@ /** Used to report the name of this particular class. */ static wxString GetKindName() { return wxString("Accept Call"); } + + /**Write the code generic to this Accept Call code shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); }; Modified: sofaswitch/trunk/callflow/src/stoptimer.cpp ============================================================================== --- sofaswitch/trunk/callflow/src/stoptimer.cpp (original) +++ sofaswitch/trunk/callflow/src/stoptimer.cpp Mon Jun 11 01:17:26 2007 @@ -31,7 +31,7 @@ displayData[displayData.size()] = InformationSection(wxT("Tool Tip"), GetName()); displayData[displayData.size()] = - InformationSection(wxT("Timer to stop"), wxT("thistimer")); + InformationSection(wxT("Timer to stop (Python code)"), wxT("\"thistimer\"")); } @@ -51,11 +51,15 @@ bool DndShapeStopTimer::WriteSystemCode(wxTextFile & file) { - file.AddLine(" def Stop_Timer(self, sTuple): "); - file.AddLine(" a,b,c = sTuple"); - file.AddLine(" killTimer = self.data[a][\"Stop Timer label\"]"); - file.AddLine(" self.DeleteThisEvent(killTimer) "); - file.AddLine(" return self.data[a][\"Output\"]"); + file.AddLine(" def Stop_Timer(self, sTuple): "); + file.AddLine(" a,b,c = sTuple "); + file.AddLine(" try: "); + file.AddLine(" killTimer = eval(self.data[a][\"Stop Timer label\"]) "); + file.AddLine(" except: "); + file.AddLine(" print \"The timer label of \", self.data[a][\"Stop Timer label\"], \" was unintelligible Python\" "); + file.AddLine(" return self.data[a][\"Output\"] "); + file.AddLine(" self.DeleteThisEvent(killTimer) "); + file.AddLine(" return self.data[a][\"Output\"] "); file.AddLine(""); return true; @@ -76,7 +80,8 @@ file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); file.AddLine(wxString::Format(" \"Stop Timer label\" : ")); - file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + wxString dest = ProtectString(displayData[1].data); + file.AddLine(wxString::Format(" \"%s\", ", dest.c_str())); file.AddLine(wxString::Format(" },"));