<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][14260] </title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=14260">14260</a></dd>
<dt>Author</dt> <dd>mikej</dd>
<dt>Date</dt> <dd>2009-07-15 15:30:39 -0500 (Wed, 15 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>commit 027047ed7b07832456cd5d13f4c85da24aca26b5
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Tue Jul 14 18:17:37 2009 +0000

    Added missing UNIMRCP_APU_INCLUDES in pkg-config files
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1054 f001bc3a-424a-0410-80a0-a715b8f413a8

commit b0e1c8251f8039a8a22662120e5a362340733a9e
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jul 13 17:25:34 2009 +0000

    if state != RECOGNIZING, there is nothing to do on deactivation
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1053 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 3581b9d3ba59177f4aaced327e20b8dc53e234e3
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jul 13 16:14:38 2009 +0000

    Do not include Completion-Cause header field in the IN-PROGRESS response sent by PocketSphinx plugin
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1052 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 831f43f9071e491169d4d5a7e3d0cb2009c3af21
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jul 13 15:27:33 2009 +0000

    Using MRCP_SESSION_SID(session) macro wherever session id is logged
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1051 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 9349bd2b393ee0b300942bfa8cacc264687ecea9
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sat Jul 11 15:17:42 2009 +0000

    Sent async channel_open and channel_close responses
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1050 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 5775dfc74e8fe982735da32dfa12dc05f0d20892
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sat Jul 11 15:15:47 2009 +0000

    Sent async channel_close response
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1049 f001bc3a-424a-0410-80a0-a715b8f413a8

commit efa4d10b2dc3de238dfb4a26b25ef3a580fb0bf0
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sat Jul 11 12:54:47 2009 +0000

    Enhanced state machine to STOP in-progress SPEAK or RECOGNIZE requests on session termination, thus guarantee there is no remaining request, when plugin cha
nnel_close() method is called.

    channel_open() -&gt; SPEAK -&gt; STOP -&gt; channel_close()
    channel_open() -&gt; SPEAK -&gt; SPEAK-COMPLETE -&gt; channel_close()

    This allows to simplify implementation of plugins (nothing has to be changed).

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1048 f001bc3a-424a-0410-80a0-a715b8f413a8

commit aaf53907ea0705bc2a44fe785c8f7762e20e52cf
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Fri Jul 10 12:57:33 2009 +0000

    Added utility function to get attributes of NLSML results such as confidence and grammar

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1047 f001bc3a-424a-0410-80a0-a715b8f413a8

commit f7c4dff83199cb9af8dc7ec6f121c384d2b6cea0
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Fri Jul 10 09:51:23 2009 +0000

    Added missing includes for &lt;stdlib.h&gt; and &lt;stdio.h&gt; required on some platforms

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1046 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 1cb7ccb6e63f4d34b6cfcbdc386446a36d052af1
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Thu Jul 9 19:05:18 2009 +0000

    Using NLSML processor in demo

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1045 f001bc3a-424a-0410-80a0-a715b8f413a8

commit cd74eee440dd94cabe814c7d4f64dfef187b7445
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Thu Jul 9 18:52:49 2009 +0000

    Added basic NLSML document processor

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1044 f001bc3a-424a-0410-80a0-a715b8f413a8</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunklibsunimrcpbuildpkgconfigunimrcpclientpcin">freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in</a></li>
<li><a href="#freeswitchtrunklibsunimrcpbuildpkgconfigunimrcppluginpcin">freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in</a></li>
<li><a href="#freeswitchtrunklibsunimrcpbuildpkgconfigunimrcpserverpcin">freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsaprtoolkitMakefileam">freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/Makefile.am</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsaprtoolkitaprtoolkitvcproj">freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpcontrolincludemrcp_resourceh">freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpcontrolincludemrcp_state_machineh">freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpresourcesincludemrcp_recog_state_machineh">freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpresourcesincludemrcp_synth_state_machineh">freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_recog_client_state_machinec">freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_recog_headerc">freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_recog_server_state_machinec">freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_synth_client_state_machinec">freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_synth_headerc">freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_synth_server_state_machinec">freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpserverincludemrcp_server_sessionh">freeswitch/trunk/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpserversrcmrcp_serverc">freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmrcpserversrcmrcp_server_sessionc">freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcpmodulesmrcpsofiasipsrcmrcp_sdpc">freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcpmodulesmrcpunirtspsrcmrcp_unirtsp_sdpc">freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcpplatformslibunimrcpclientsrcunimrcp_clientc">freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcpplatformslibunimrcpserversrcunimrcp_serverc">freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcpplatformsunimrcpclientincludedemo_utilh">freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcpplatformsunimrcpclientsrcdemo_recog_applicationc">freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcpplatformsunimrcpclientsrcdemo_utilc">freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcpflitesrcmrcp_flitec">freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcppocketsphinxsrcmrcp_pocketsphinxc">freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#freeswitchtrunklibsunimrcplibsaprtoolkitincludeapt_nlsml_doch">freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsaprtoolkitsrcapt_nlsml_docc">freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunklibsunimrcpbuildpkgconfigunimrcpclientpcin"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> prefix=@prefix@
</span><span class="cx"> exec_prefix=@exec_prefix@
</span><span class="cx"> libdir=@libdir@
</span><del>-includedir=@includedir@ @UNIMRCP_APR_INCLUDES@
</del><ins>+includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ @UNIMRCP_APU_INCLUDES@
</ins><span class="cx"> 
</span><span class="cx"> Name: unimrcpclient
</span><span class="cx"> Description: UniMRCP Client Stack
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpbuildpkgconfigunimrcppluginpcin"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> prefix=@prefix@
</span><span class="cx"> exec_prefix=@exec_prefix@
</span><span class="cx"> libdir=@libdir@
</span><del>-includedir=@includedir@ @UNIMRCP_APR_INCLUDES@
</del><ins>+includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ @UNIMRCP_APU_INCLUDES@
</ins><span class="cx"> 
</span><span class="cx"> Name: unimrcpplugin
</span><span class="cx"> Description: UniMRCP Server Plugin
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpbuildpkgconfigunimrcpserverpcin"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> prefix=@prefix@
</span><span class="cx"> exec_prefix=@exec_prefix@
</span><span class="cx"> libdir=@libdir@
</span><del>-includedir=@includedir@ @UNIMRCP_APR_INCLUDES@
</del><ins>+includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ @UNIMRCP_APU_INCLUDES@
</ins><span class="cx"> 
</span><span class="cx"> Name: unimrcpserver
</span><span class="cx"> Description: UniMRCP Server Stack
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsaprtoolkitMakefileam"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/Makefile.am (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/Makefile.am        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/Makefile.am        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx">                            include/apt_string_table.h \
</span><span class="cx">                            include/apt_text_stream.h \
</span><span class="cx">                            include/apt_net.h \
</span><ins>+                           include/apt_nlsml_doc.h \
</ins><span class="cx">                            include/apt_dir_layout.h \
</span><span class="cx">                            include/apt_test_suite.h
</span><span class="cx"> 
</span><span class="lines">@@ -38,6 +39,7 @@
</span><span class="cx">                            src/apt_string_table.c \
</span><span class="cx">                            src/apt_text_stream.c \
</span><span class="cx">                            src/apt_net.c \
</span><ins>+                           src/apt_nlsml_doc.c \
</ins><span class="cx">                            src/apt_dir_layout.c \
</span><span class="cx">                            src/apt_test_suite.c
</span><span class="cx">                            
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsaprtoolkitaprtoolkitvcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -162,6 +162,10 @@
</span><span class="cx">                                 &gt;
</span><span class="cx">                         &lt;/File&gt;
</span><span class="cx">                         &lt;File
</span><ins>+                                RelativePath=&quot;.\include\apt_nlsml_doc.h&quot;
+                                &gt;
+                        &lt;/File&gt;
+                        &lt;File
</ins><span class="cx">                                 RelativePath=&quot;.\include\apt_obj_list.h&quot;
</span><span class="cx">                                 &gt;
</span><span class="cx">                         &lt;/File&gt;
</span><span class="lines">@@ -235,6 +239,10 @@
</span><span class="cx">                                 &gt;
</span><span class="cx">                         &lt;/File&gt;
</span><span class="cx">                         &lt;File
</span><ins>+                                RelativePath=&quot;.\src\apt_nlsml_doc.c&quot;
+                                &gt;
+                        &lt;/File&gt;
+                        &lt;File
</ins><span class="cx">                                 RelativePath=&quot;.\src\apt_obj_list.c&quot;
</span><span class="cx">                                 &gt;
</span><span class="cx">                         &lt;/File&gt;
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsaprtoolkitincludeapt_nlsml_doch"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h (0 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h                                (rev 0)
+++ freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __APT_NLSML_DOC_H__
+#define __APT_NLSML_DOC_H__
+
+/**
+ * @file apt_nlsml_doc.h
+ * @brief Basic NLSML Routine
+ */ 
+
+#include &quot;apr_xml.h&quot;
+#include &quot;apt_string.h&quot;
+
+APT_BEGIN_EXTERN_C
+
+/** Load NLSML document */
+APT_DECLARE(apr_xml_doc*) nlsml_doc_load(const apt_str_t *data, apr_pool_t *pool);
+
+/** Get the first &lt;interpretation&gt; element */
+APT_DECLARE(apr_xml_elem*) nlsml_first_interpret_get(const apr_xml_doc *doc);
+
+/** Get the next &lt;interpretation&gt; element */
+APT_DECLARE(apr_xml_elem*) nlsml_next_interpret_get(const apr_xml_elem *interpret);
+
+/** Get &lt;instance&gt; and &lt;input&gt; elements of &lt;interpretation&gt; element */
+APT_DECLARE(apt_bool_t) nlsml_interpret_results_get(const apr_xml_elem *interpret, apr_xml_elem **instance, apr_xml_elem **input);
+
+/** Get specified atrribute of &lt;input&gt; */
+APT_DECLARE(const char *) nlsml_input_attrib_get(const apr_xml_elem *input, const char *attrib, apt_bool_t recursive);
+
+
+APT_END_EXTERN_C
+
+#endif /*__APT_NLSML_DOC_H__*/
</ins></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsaprtoolkitsrcapt_nlsml_docc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c (0 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c                                (rev 0)
+++ freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -0,0 +1,108 @@
</span><ins>+/*
+ * Copyright 2008 Arsen Chaloyan
+ *
+ * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include &quot;apt_nlsml_doc.h&quot;
+
+/** Load NLSML document */
+APT_DECLARE(apr_xml_doc*) nlsml_doc_load(const apt_str_t *data, apr_pool_t *pool)
+{
+        apr_xml_parser *parser;
+        apr_xml_doc *doc = NULL;
+        const apr_xml_elem *root;
+
+        /* create XML parser */
+        parser = apr_xml_parser_create(pool);
+        if(apr_xml_parser_feed(parser,data-&gt;buf,data-&gt;length) != APR_SUCCESS) {
+                return NULL;
+        }
+
+        /* done with XML tree creation */
+        if(apr_xml_parser_done(parser,&amp;doc) != APR_SUCCESS) {
+                return NULL;
+        }
+
+        if(!doc || !doc-&gt;root) {
+                return NULL;
+        }
+        root = doc-&gt;root;
+
+        /* NLSML validity check: root element must be &lt;result&gt; */
+        if(strcmp(root-&gt;name,&quot;result&quot;) != 0) {
+                return NULL;
+        }
+
+        return doc;
+}
+
+/** Get the first &lt;interpretation&gt; element */
+APT_DECLARE(apr_xml_elem*) nlsml_first_interpret_get(const apr_xml_doc *doc)
+{
+        apr_xml_elem *child_elem;
+        for(child_elem = doc-&gt;root-&gt;first_child; child_elem; child_elem = child_elem-&gt;next) {
+                if(strcmp(child_elem-&gt;name,&quot;interpretation&quot;) == 0) {
+                        return child_elem;
+                }
+        }
+
+        return NULL;
+}
+
+/** Get the next &lt;interpretation&gt; element */
+APT_DECLARE(apr_xml_elem*) nlsml_next_interpret_get(const apr_xml_elem *elem)
+{
+        apr_xml_elem *child_elem;
+        for(child_elem = elem-&gt;next; child_elem; child_elem = child_elem-&gt;next) {
+                if(strcmp(child_elem-&gt;name,&quot;interpretation&quot;) == 0) {
+                        return child_elem;
+                }
+        }
+
+        return NULL;
+}
+
+/** Get &lt;instance&gt; and &lt;input&gt; elements of &lt;interpretation&gt; element */
+APT_DECLARE(apt_bool_t) nlsml_interpret_results_get(const apr_xml_elem *interpret, apr_xml_elem **instance, apr_xml_elem **input)
+{
+        apr_xml_elem *child_elem;
+        *input = NULL;
+        *instance = NULL;
+        for(child_elem = interpret-&gt;first_child; child_elem; child_elem = child_elem-&gt;next) {
+                if(strcmp(child_elem-&gt;name,&quot;input&quot;) == 0) {
+                        *input = child_elem;
+                }
+                else if(strcmp(child_elem-&gt;name,&quot;instance&quot;) == 0) {
+                        *instance = child_elem;
+                }
+        }
+        return TRUE;
+}
+
+/** Get specified atrribute of &lt;input&gt; */
+APT_DECLARE(const char *) nlsml_input_attrib_get(const apr_xml_elem *input, const char *attrib, apt_bool_t recursive)
+{
+        const apr_xml_attr *xml_attr;
+        for(xml_attr = input-&gt;attr; xml_attr; xml_attr = xml_attr-&gt;next) {
+                if(strcasecmp(xml_attr-&gt;name,attrib) == 0) {
+                        return xml_attr-&gt;value;
+                }
+        }
+
+        if(recursive &amp;&amp; input-&gt;parent) {
+                return nlsml_input_attrib_get(input-&gt;parent,attrib,recursive);
+        }
+
+        return NULL;
+}
</ins></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpcontrolincludemrcp_resourceh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -40,9 +40,9 @@
</span><span class="cx">         apt_bool_t (*resourcify_message_by_name)(mrcp_resource_t *resource, mrcp_message_t *message);
</span><span class="cx"> 
</span><span class="cx">         /** Create client side state machine */
</span><del>-        mrcp_state_machine_t* (*create_client_state_machine)(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool);
</del><ins>+        mrcp_state_machine_t* (*create_client_state_machine)(void *obj, mrcp_version_e version, apr_pool_t *pool);
</ins><span class="cx">         /** Create server side state machine */
</span><del>-        mrcp_state_machine_t* (*create_server_state_machine)(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool);
</del><ins>+        mrcp_state_machine_t* (*create_server_state_machine)(void *obj, mrcp_version_e version, apr_pool_t *pool);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /** Initialize MRCP resource */
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpcontrolincludemrcp_state_machineh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/control/include/mrcp_state_machine.h        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -29,34 +29,56 @@
</span><span class="cx"> /** MRCP state machine declaration */
</span><span class="cx"> typedef struct mrcp_state_machine_t mrcp_state_machine_t;
</span><span class="cx"> 
</span><del>-/** MRCP message dispatcher */
-typedef apt_bool_t (*mrcp_message_dispatcher_f)(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
</del><span class="cx"> 
</span><del>-
</del><span class="cx"> /** MRCP state machine */
</span><span class="cx"> struct mrcp_state_machine_t {
</span><span class="cx">         /** External object associated with state machine */
</span><span class="cx">         void *obj;
</span><del>-        /** Message dispatcher */
-        mrcp_message_dispatcher_f dispatcher;
</del><ins>+        /** State either active or deactivating */
+        apt_bool_t active;
</ins><span class="cx"> 
</span><span class="cx">         /** Virtual update */
</span><span class="cx">         apt_bool_t (*update)(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
</span><ins>+        /** Deactivate */
+        apt_bool_t (*deactivate)(mrcp_state_machine_t *state_machine);
+
+
+        /** Message dispatcher */
+        apt_bool_t (*on_dispatch)(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
+        /** Deactivated */
+        apt_bool_t (*on_deactivate)(mrcp_state_machine_t *state_machine);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /** Initialize MRCP state machine */
</span><del>-static APR_INLINE void mrcp_state_machine_init(mrcp_state_machine_t *state_machine, void *obj, mrcp_message_dispatcher_f dispatcher)
</del><ins>+static APR_INLINE void mrcp_state_machine_init(mrcp_state_machine_t *state_machine, void *obj)
</ins><span class="cx"> {
</span><span class="cx">         state_machine-&gt;obj = obj;
</span><del>-        state_machine-&gt;dispatcher = dispatcher;
</del><ins>+        state_machine-&gt;active = TRUE;
+        state_machine-&gt;on_dispatch = NULL;
+        state_machine-&gt;on_deactivate = NULL;
+        state_machine-&gt;update = NULL;
+        state_machine-&gt;deactivate = NULL;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Update MRCP state machine */
</span><span class="cx"> static APR_INLINE apt_bool_t mrcp_state_machine_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><del>-        return state_machine-&gt;update(state_machine,message);
</del><ins>+        if(state_machine-&gt;update) {
+                return state_machine-&gt;update(state_machine,message);
+        }
+        return FALSE;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/** Deactivate MRCP state machine */
+static APR_INLINE apt_bool_t mrcp_state_machine_deactivate(mrcp_state_machine_t *state_machine)
+{
+        if(state_machine-&gt;deactivate) {
+                state_machine-&gt;active = FALSE;
+                return state_machine-&gt;deactivate(state_machine);
+        }
+        return FALSE;
+}
+
</ins><span class="cx"> APT_END_EXTERN_C
</span><span class="cx"> 
</span><span class="cx"> #endif /*__MRCP_STATE_MACHINE_H__*/
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpresourcesincludemrcp_recog_state_machineh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_state_machine.h        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -27,10 +27,10 @@
</span><span class="cx"> APT_BEGIN_EXTERN_C
</span><span class="cx"> 
</span><span class="cx"> /** Create MRCP recognizer server state machine */
</span><del>-mrcp_state_machine_t* mrcp_recog_server_state_machine_create(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool);
</del><ins>+mrcp_state_machine_t* mrcp_recog_server_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
</ins><span class="cx"> 
</span><span class="cx"> /** Create MRCP recognizer client state machine */
</span><del>-mrcp_state_machine_t* mrcp_recog_client_state_machine_create(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool);
</del><ins>+mrcp_state_machine_t* mrcp_recog_client_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
</ins><span class="cx"> 
</span><span class="cx"> APT_END_EXTERN_C
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpresourcesincludemrcp_synth_state_machineh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_state_machine.h        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -27,10 +27,10 @@
</span><span class="cx"> APT_BEGIN_EXTERN_C
</span><span class="cx"> 
</span><span class="cx"> /** Create MRCP synthesizer server state machine */
</span><del>-mrcp_state_machine_t* mrcp_synth_server_state_machine_create(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool);
</del><ins>+mrcp_state_machine_t* mrcp_synth_server_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
</ins><span class="cx"> 
</span><span class="cx"> /** Create MRCP synthesizer client state machine */
</span><del>-mrcp_state_machine_t* mrcp_synth_client_state_machine_create(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool);
</del><ins>+mrcp_state_machine_t* mrcp_synth_client_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool);
</ins><span class="cx"> 
</span><span class="cx"> APT_END_EXTERN_C
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_recog_client_state_machinec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_client_state_machine.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -23,14 +23,14 @@
</span><span class="cx"> static apt_bool_t recog_state_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><span class="cx">         /* no actual state machine processing yet, dispatch whatever received */
</span><del>-        return state_machine-&gt;dispatcher(state_machine,message);
</del><ins>+        return state_machine-&gt;on_dispatch(state_machine,message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Create MRCP recognizer client state machine */
</span><del>-mrcp_state_machine_t* mrcp_recog_client_state_machine_create(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool)
</del><ins>+mrcp_state_machine_t* mrcp_recog_client_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
</ins><span class="cx"> {
</span><span class="cx">         mrcp_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_state_machine_t));
</span><del>-        mrcp_state_machine_init(state_machine,obj,dispatcher);
</del><ins>+        mrcp_state_machine_init(state_machine,obj);
</ins><span class="cx">         state_machine-&gt;update = recog_state_update;
</span><span class="cx">         return state_machine;
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_recog_headerc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -14,6 +14,7 @@
</span><span class="cx">  * limitations under the License.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+#include &lt;stdio.h&gt;
</ins><span class="cx"> #include &quot;mrcp_recog_header.h&quot;
</span><span class="cx"> 
</span><span class="cx"> /** String table of MRCPv1 recognizer headers (mrcp_recog_header_id) */
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_recog_server_state_machinec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_server_state_machine.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -61,18 +61,26 @@
</span><span class="cx"> static APR_INLINE apt_bool_t recog_request_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><span class="cx">         state_machine-&gt;active_request = message;
</span><del>-        return state_machine-&gt;base.dispatcher(&amp;state_machine-&gt;base,message);
</del><ins>+        return state_machine-&gt;base.on_dispatch(&amp;state_machine-&gt;base,message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static APR_INLINE apt_bool_t recog_response_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><span class="cx">         state_machine-&gt;active_request = NULL;
</span><del>-        return state_machine-&gt;base.dispatcher(&amp;state_machine-&gt;base,message);
</del><ins>+        if(state_machine-&gt;base.active == FALSE) {
+                /* this is the response to deactivation (STOP) request */
+                return state_machine-&gt;base.on_deactivate(&amp;state_machine-&gt;base);
+        }
+        return state_machine-&gt;base.on_dispatch(&amp;state_machine-&gt;base,message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static APR_INLINE apt_bool_t recog_event_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><del>-        return state_machine-&gt;base.dispatcher(&amp;state_machine-&gt;base,message);
</del><ins>+        if(state_machine-&gt;base.active == FALSE) {
+                /* do nothing, state machine has already been deactivated */
+                return FALSE;
+        }
+        return state_machine-&gt;base.on_dispatch(&amp;state_machine-&gt;base,message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static APR_INLINE void recog_state_change(mrcp_recog_state_machine_t *state_machine, mrcp_recog_state_e state)
</span><span class="lines">@@ -286,10 +294,10 @@
</span><span class="cx">         mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
</span><span class="cx">         recog_pending_requests_remove(state_machine,state_machine-&gt;active_request,message);
</span><span class="cx">         recog_state_change(state_machine,RECOGNIZER_STATE_IDLE);
</span><ins>+        pending_request = apt_list_pop_front(state_machine-&gt;queue);
</ins><span class="cx">         recog_response_dispatch(state_machine,message);
</span><span class="cx"> 
</span><span class="cx">         /* process pending RECOGNIZE requests / if any */
</span><del>-        pending_request = apt_list_pop_front(state_machine-&gt;queue);
</del><span class="cx">         if(pending_request) {
</span><span class="cx">                 apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Process Pending RECOGNIZE Request [%d]&quot;,pending_request-&gt;start_line.request_id);
</span><span class="cx">                 state_machine-&gt;is_pending = TRUE;
</span><span class="lines">@@ -432,19 +440,19 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Update state according to request received from MRCP client or response/event received from recognition engine */
</span><del>-static apt_bool_t recog_state_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
</del><ins>+static apt_bool_t recog_state_update(mrcp_state_machine_t *base, mrcp_message_t *message)
</ins><span class="cx"> {
</span><del>-        mrcp_recog_state_machine_t *recog_state_machine = (mrcp_recog_state_machine_t*)state_machine;
</del><ins>+        mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base;
</ins><span class="cx">         apt_bool_t status = TRUE;
</span><span class="cx">         switch(message-&gt;start_line.message_type) {
</span><span class="cx">                 case MRCP_MESSAGE_TYPE_REQUEST:
</span><del>-                        status = recog_request_state_update(recog_state_machine,message);
</del><ins>+                        status = recog_request_state_update(state_machine,message);
</ins><span class="cx">                         break;
</span><span class="cx">                 case MRCP_MESSAGE_TYPE_RESPONSE:
</span><del>-                        status = recog_response_state_update(recog_state_machine,message);
</del><ins>+                        status = recog_response_state_update(state_machine,message);
</ins><span class="cx">                         break;
</span><span class="cx">                 case MRCP_MESSAGE_TYPE_EVENT:
</span><del>-                        status = recog_event_state_update(recog_state_machine,message);
</del><ins>+                        status = recog_event_state_update(state_machine,message);
</ins><span class="cx">                         break;
</span><span class="cx">                 default:
</span><span class="cx">                         status = FALSE;
</span><span class="lines">@@ -453,13 +461,42 @@
</span><span class="cx">         return status;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/** Deactivate state machine */
+static apt_bool_t recog_state_deactivate(mrcp_state_machine_t *base)
+{
+        mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base;
+        mrcp_message_t *message;
+        mrcp_message_t *source;
+        if(state_machine-&gt;state != RECOGNIZER_STATE_RECOGNIZING) {
+                /* no in-progress RECOGNIZE request to deactivate */
+                return FALSE;
+        }
+        source = state_machine-&gt;recog;
+        if(!source) {
+                return FALSE;
+        }
+
+        /* create internal STOP request */
+        message = mrcp_request_create(
+                                                source-&gt;channel_id.resource_id,
+                                                RECOGNIZER_STOP,
+                                                source-&gt;pool);
+        message-&gt;channel_id = source-&gt;channel_id;
+        message-&gt;start_line.request_id = source-&gt;start_line.request_id + 1;
+        apt_string_set(&amp;message-&gt;start_line.method_name,&quot;DEACTIVATE&quot;); /* informative only */
+        message-&gt;header = source-&gt;header;
+        apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Create and Process STOP Request [%d]&quot;,message-&gt;start_line.request_id);
+        return recog_request_dispatch(state_machine,message);
+}
+
</ins><span class="cx"> /** Create MRCP recognizer server state machine */
</span><del>-mrcp_state_machine_t* mrcp_recog_server_state_machine_create(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool)
</del><ins>+mrcp_state_machine_t* mrcp_recog_server_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
</ins><span class="cx"> {
</span><span class="cx">         mrcp_message_header_t *properties;
</span><span class="cx">         mrcp_recog_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_recog_state_machine_t));
</span><del>-        mrcp_state_machine_init(&amp;state_machine-&gt;base,obj,dispatcher);
</del><ins>+        mrcp_state_machine_init(&amp;state_machine-&gt;base,obj);
</ins><span class="cx">         state_machine-&gt;base.update = recog_state_update;
</span><ins>+        state_machine-&gt;base.deactivate = recog_state_deactivate;
</ins><span class="cx">         state_machine-&gt;state = RECOGNIZER_STATE_IDLE;
</span><span class="cx">         state_machine-&gt;is_pending = FALSE;
</span><span class="cx">         state_machine-&gt;active_request = NULL;
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_synth_client_state_machinec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_client_state_machine.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -23,14 +23,14 @@
</span><span class="cx"> static apt_bool_t synth_state_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><span class="cx">         /* no actual state machine processing yet, dispatch whatever received */
</span><del>-        return state_machine-&gt;dispatcher(state_machine,message);
</del><ins>+        return state_machine-&gt;on_dispatch(state_machine,message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Create MRCP synthesizer client state machine */
</span><del>-mrcp_state_machine_t* mrcp_synth_client_state_machine_create(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool)
</del><ins>+mrcp_state_machine_t* mrcp_synth_client_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
</ins><span class="cx"> {
</span><span class="cx">         mrcp_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_state_machine_t));
</span><del>-        mrcp_state_machine_init(state_machine,obj,dispatcher);
</del><ins>+        mrcp_state_machine_init(state_machine,obj);
</ins><span class="cx">         state_machine-&gt;update = synth_state_update;
</span><span class="cx">         return state_machine;
</span><span class="cx"> }
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_synth_headerc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -14,6 +14,7 @@
</span><span class="cx">  * limitations under the License.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+#include &lt;stdio.h&gt;
</ins><span class="cx"> #include &quot;mrcp_synth_header.h&quot;
</span><span class="cx"> 
</span><span class="cx"> /** String table of MRCP synthesizer headers (mrcp_synthesizer_header_id) */
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpresourcessrcmrcp_synth_server_state_machinec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_server_state_machine.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -61,18 +61,26 @@
</span><span class="cx"> static APR_INLINE apt_bool_t synth_request_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><span class="cx">         state_machine-&gt;active_request = message;
</span><del>-        return state_machine-&gt;base.dispatcher(&amp;state_machine-&gt;base,message);
</del><ins>+        return state_machine-&gt;base.on_dispatch(&amp;state_machine-&gt;base,message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static APR_INLINE apt_bool_t synth_response_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><span class="cx">         state_machine-&gt;active_request = NULL;
</span><del>-        return state_machine-&gt;base.dispatcher(&amp;state_machine-&gt;base,message);
</del><ins>+        if(state_machine-&gt;base.active == FALSE) {
+                /* this is the response to deactivation (STOP) request */
+                return state_machine-&gt;base.on_deactivate(&amp;state_machine-&gt;base);
+        }
+        return state_machine-&gt;base.on_dispatch(&amp;state_machine-&gt;base,message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static APR_INLINE apt_bool_t synth_event_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message)
</span><span class="cx"> {
</span><del>-        return state_machine-&gt;base.dispatcher(&amp;state_machine-&gt;base,message);
</del><ins>+        if(state_machine-&gt;base.active == FALSE) {
+                /* do nothing, state machine has already been deactivated */
+                return FALSE;
+        }
+        return state_machine-&gt;base.on_dispatch(&amp;state_machine-&gt;base,message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static APR_INLINE void synth_state_change(mrcp_synth_state_machine_t *state_machine, mrcp_synth_state_e state)
</span><span class="lines">@@ -220,10 +228,10 @@
</span><span class="cx">         mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST);
</span><span class="cx">         synth_pending_requests_remove(state_machine,state_machine-&gt;active_request,message);
</span><span class="cx">         synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE);
</span><ins>+        pending_request = apt_list_pop_front(state_machine-&gt;queue);
</ins><span class="cx">         synth_response_dispatch(state_machine,message);
</span><span class="cx"> 
</span><span class="cx">         /* process pending SPEAK requests / if any */
</span><del>-        pending_request = apt_list_pop_front(state_machine-&gt;queue);
</del><span class="cx">         if(pending_request) {
</span><span class="cx">                 apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Process Pending SPEAK Request [%d]&quot;,pending_request-&gt;start_line.request_id);
</span><span class="cx">                 state_machine-&gt;is_pending = TRUE;
</span><span class="lines">@@ -522,9 +530,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Update state according to request received from MRCP client or response/event received from synthesizer engine */
</span><del>-static apt_bool_t synth_state_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
</del><ins>+static apt_bool_t synth_state_update(mrcp_state_machine_t *base, mrcp_message_t *message)
</ins><span class="cx"> {
</span><del>-        mrcp_synth_state_machine_t *synth_state_machine = (mrcp_synth_state_machine_t*)state_machine;
</del><ins>+        mrcp_synth_state_machine_t *synth_state_machine = (mrcp_synth_state_machine_t*)base;
</ins><span class="cx">         apt_bool_t status = TRUE;
</span><span class="cx">         switch(message-&gt;start_line.message_type) {
</span><span class="cx">                 case MRCP_MESSAGE_TYPE_REQUEST:
</span><span class="lines">@@ -543,13 +551,39 @@
</span><span class="cx">         return status;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/** Deactivate state machine */
+static apt_bool_t synth_state_deactivate(mrcp_state_machine_t *base)
+{
+        mrcp_synth_state_machine_t *state_machine = (mrcp_synth_state_machine_t*)base;
+        mrcp_message_t *message;
+        mrcp_message_t *source;
+        if(!state_machine-&gt;speaker) {
+                /* no in-progress SPEAK request to deactivate */
+                return FALSE;
+        }
+        source = state_machine-&gt;speaker;
+
+        /* create internal STOP request */
+        message = mrcp_request_create(
+                                                source-&gt;channel_id.resource_id,
+                                                SYNTHESIZER_STOP,
+                                                source-&gt;pool);
+        message-&gt;channel_id = source-&gt;channel_id;
+        message-&gt;start_line.request_id = source-&gt;start_line.request_id + 1;
+        apt_string_set(&amp;message-&gt;start_line.method_name,&quot;DEACTIVATE&quot;); /* informative only */
+        message-&gt;header = source-&gt;header;
+        apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Create and Process STOP Request [%d]&quot;,message-&gt;start_line.request_id);
+        return synth_request_dispatch(state_machine,message);
+}
+
</ins><span class="cx"> /** Create MRCP synthesizer server state machine */
</span><del>-mrcp_state_machine_t* mrcp_synth_server_state_machine_create(void *obj, mrcp_message_dispatcher_f dispatcher, mrcp_version_e version, apr_pool_t *pool)
</del><ins>+mrcp_state_machine_t* mrcp_synth_server_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool)
</ins><span class="cx"> {
</span><span class="cx">         mrcp_message_header_t *properties;
</span><span class="cx">         mrcp_synth_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_synth_state_machine_t));
</span><del>-        mrcp_state_machine_init(&amp;state_machine-&gt;base,obj,dispatcher);
</del><ins>+        mrcp_state_machine_init(&amp;state_machine-&gt;base,obj);
</ins><span class="cx">         state_machine-&gt;base.update = synth_state_update;
</span><ins>+        state_machine-&gt;base.deactivate = synth_state_deactivate;
</ins><span class="cx">         state_machine-&gt;state = SYNTHESIZER_STATE_IDLE;
</span><span class="cx">         state_machine-&gt;is_pending = FALSE;
</span><span class="cx">         state_machine-&gt;active_request = NULL;
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpserverincludemrcp_server_sessionh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -93,6 +93,8 @@
</span><span class="cx">         apr_size_t                 answer_flag_count;
</span><span class="cx">         /** Number of in-progress terminate requests (flags) */
</span><span class="cx">         apr_size_t                 terminate_flag_count;
</span><ins>+        /** Number of in-progress deactivare requests (flags) */
+        apr_size_t                 deactivate_flag_count;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /** MRCP profile */
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpserversrcmrcp_serverc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -595,7 +595,7 @@
</span><span class="cx"> void mrcp_server_session_add(mrcp_server_session_t *session)
</span><span class="cx"> {
</span><span class="cx">         if(session-&gt;base.id.buf) {
</span><del>-                apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,&quot;Add Session &quot;APT_SID_FMT,session-&gt;base.id.buf);
</del><ins>+                apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,&quot;Add Session &quot;APT_SID_FMT,MRCP_SESSION_SID(&amp;session-&gt;base));
</ins><span class="cx">                 apr_hash_set(session-&gt;server-&gt;session_table,session-&gt;base.id.buf,session-&gt;base.id.length,session);
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="lines">@@ -603,7 +603,7 @@
</span><span class="cx"> void mrcp_server_session_remove(mrcp_server_session_t *session)
</span><span class="cx"> {
</span><span class="cx">         if(session-&gt;base.id.buf) {
</span><del>-                apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,&quot;Remove Session &quot;APT_SID_FMT,session-&gt;base.id.buf);
</del><ins>+                apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,&quot;Remove Session &quot;APT_SID_FMT,MRCP_SESSION_SID(&amp;session-&gt;base));
</ins><span class="cx">                 apr_hash_set(session-&gt;server-&gt;session_table,session-&gt;base.id.buf,session-&gt;base.id.length,NULL);
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="lines">@@ -820,7 +820,7 @@
</span><span class="cx">                         return profile;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Cannot Find Profile by Agent &quot;APT_SID_FMT,session-&gt;base.id.buf);
</del><ins>+        apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Cannot Find Profile by Agent &quot;APT_SID_FMT,MRCP_SESSION_SID(&amp;session-&gt;base));
</ins><span class="cx">         return NULL;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmrcpserversrcmrcp_server_sessionc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -93,7 +93,10 @@
</span><span class="cx">                                                 mpf_termination_t *termination, 
</span><span class="cx">                                                 void *descriptor);
</span><span class="cx"> 
</span><ins>+static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message);
+static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine);
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> mrcp_server_session_t* mrcp_server_session_create()
</span><span class="cx"> {
</span><span class="cx">         mrcp_server_session_t *session = (mrcp_server_session_t*) mrcp_session_create(sizeof(mrcp_server_session_t)-sizeof(mrcp_session_t));
</span><span class="lines">@@ -106,6 +109,7 @@
</span><span class="cx">         session-&gt;answer = NULL;
</span><span class="cx">         session-&gt;answer_flag_count = 0;
</span><span class="cx">         session-&gt;terminate_flag_count = 0;
</span><ins>+        session-&gt;deactivate_flag_count = 0;
</ins><span class="cx">         return session;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -123,47 +127,6 @@
</span><span class="cx">         return resource_engine-&gt;method_vtable-&gt;create_channel(resource_engine,session-&gt;base.pool);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static apt_bool_t mrcp_server_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
-{
-        mrcp_channel_t *channel = state_machine-&gt;obj;
-
-        if(message-&gt;start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
-                /* send request message to resource engine for actual processing */
-                if(channel-&gt;engine_channel) {
-                        mrcp_engine_channel_request_process(channel-&gt;engine_channel,message);
-                }
-        }
-        else if(message-&gt;start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
-                mrcp_server_session_t *session = (mrcp_server_session_t*)channel-&gt;session;
-                /* send response message to client */
-                if(channel-&gt;control_channel) {
-                        /* MRCPv2 */
-                        mrcp_server_control_message_send(channel-&gt;control_channel,message);
-                }
-                else {
-                        /* MRCPv1 */
-                        mrcp_session_control_response(channel-&gt;session,message);
-                }
-
-                session-&gt;active_request = apt_list_pop_front(session-&gt;request_queue);
-                if(session-&gt;active_request) {
-                        mrcp_server_signaling_message_dispatch(session,session-&gt;active_request);
-                }
-        }
-        else { 
-                /* send event message to client */
-                if(channel-&gt;control_channel) {
-                        /* MRCPv2 */
-                        mrcp_server_control_message_send(channel-&gt;control_channel,message);
-                }
-                else {
-                        /* MRCPv1 */
-                        mrcp_session_control_response(channel-&gt;session,message);
-                }
-        }
-        return TRUE;
-}
-
</del><span class="cx"> static mrcp_channel_t* mrcp_server_channel_create(mrcp_server_session_t *session, const apt_str_t *resource_name, apr_size_t id)
</span><span class="cx"> {
</span><span class="cx">         mrcp_channel_t *channel;
</span><span class="lines">@@ -200,9 +163,12 @@
</span><span class="cx">                         }
</span><span class="cx">                         channel-&gt;state_machine = resource-&gt;create_server_state_machine(
</span><span class="cx">                                                                 channel,
</span><del>-                                                                mrcp_server_message_dispatch,
</del><span class="cx">                                                                 session-&gt;base.signaling_agent-&gt;mrcp_version,
</span><span class="cx">                                                                 pool);
</span><ins>+                        if(channel-&gt;state_machine) {
+                                channel-&gt;state_machine-&gt;on_dispatch = state_machine_on_message_dispatch;
+                                channel-&gt;state_machine-&gt;on_deactivate = state_machine_on_deactivate;
+                        }
</ins><span class="cx"> 
</span><span class="cx">                         engine_channel = mrcp_server_engine_channel_create(session,resource_name);
</span><span class="cx">                         if(engine_channel) {
</span><span class="lines">@@ -413,7 +379,7 @@
</span><span class="cx">                 session-&gt;context = mpf_context_create(session,5,session-&gt;base.pool);
</span><span class="cx">         }
</span><span class="cx">         apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Receive Offer &quot;APT_SID_FMT&quot; [c:%d a:%d v:%d]&quot;,
</span><del>-                session-&gt;base.id.buf,
</del><ins>+                MRCP_SESSION_SID(&amp;session-&gt;base),
</ins><span class="cx">                 descriptor-&gt;control_media_arr-&gt;nelts,
</span><span class="cx">                 descriptor-&gt;audio_media_arr-&gt;nelts,
</span><span class="cx">                 descriptor-&gt;video_media_arr-&gt;nelts);
</span><span class="lines">@@ -447,7 +413,7 @@
</span><span class="cx">         mrcp_channel_t *channel;
</span><span class="cx">         mrcp_termination_slot_t *slot;
</span><span class="cx">         int i;
</span><del>-        apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Receive Terminate Request &quot;APT_SID_FMT,session-&gt;base.id.buf);
</del><ins>+        apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Receive Terminate Request &quot;APT_SID_FMT,MRCP_SESSION_SID(&amp;session-&gt;base));
</ins><span class="cx">         for(i=0; i&lt;session-&gt;channels-&gt;nelts; i++) {
</span><span class="cx">                 channel = ((mrcp_channel_t**)session-&gt;channels-&gt;elts)[i];
</span><span class="cx">                 if(!channel) continue;
</span><span class="lines">@@ -499,6 +465,27 @@
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static apt_bool_t mrcp_server_session_deactivate(mrcp_server_session_t *session)
+{
+        mrcp_channel_t *channel;
+        int i;
+        apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Deactivate Session &quot;APT_SID_FMT,MRCP_SESSION_SID(&amp;session-&gt;base));
+        for(i=0; i&lt;session-&gt;channels-&gt;nelts; i++) {
+                channel = ((mrcp_channel_t**)session-&gt;channels-&gt;elts)[i];
+                if(!channel || !channel-&gt;state_machine) continue;
+
+                if(mrcp_state_machine_deactivate(channel-&gt;state_machine) == TRUE) {
+                        session-&gt;deactivate_flag_count++;
+                }
+        }
+        
+        if(!session-&gt;deactivate_flag_count) {
+                mrcp_server_session_terminate_process(session);
+        }
+
+        return TRUE;
+}
+
</ins><span class="cx"> static apt_bool_t mrcp_server_on_message_receive(mrcp_server_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
</span><span class="cx"> {
</span><span class="cx">         if(!channel) {
</span><span class="lines">@@ -528,7 +515,7 @@
</span><span class="cx">                         mrcp_server_on_message_receive(signaling_message-&gt;session,signaling_message-&gt;channel,signaling_message-&gt;message);
</span><span class="cx">                         break;
</span><span class="cx">                 case SIGNALING_MESSAGE_TERMINATE:
</span><del>-                        mrcp_server_session_terminate_process(signaling_message-&gt;session);
</del><ins>+                        mrcp_server_session_deactivate(signaling_message-&gt;session);
</ins><span class="cx">                         break;
</span><span class="cx">                 default:
</span><span class="cx">                         break;
</span><span class="lines">@@ -749,7 +736,7 @@
</span><span class="cx">         apt_bool_t status;
</span><span class="cx">         mrcp_session_descriptor_t *descriptor = session-&gt;answer;
</span><span class="cx">         apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Send Answer &quot;APT_SID_FMT&quot; [c:%d a:%d v:%d] Status %s&quot;,
</span><del>-                session-&gt;base.id.buf,
</del><ins>+                MRCP_SESSION_SID(&amp;session-&gt;base),
</ins><span class="cx">                 descriptor-&gt;control_media_arr-&gt;nelts,
</span><span class="cx">                 descriptor-&gt;audio_media_arr-&gt;nelts,
</span><span class="cx">                 descriptor-&gt;video_media_arr-&gt;nelts,
</span><span class="lines">@@ -782,7 +769,7 @@
</span><span class="cx">                         channel-&gt;engine_channel = NULL;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Send Terminate Response &quot;APT_SID_FMT,session-&gt;base.id.buf);
</del><ins>+        apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Send Terminate Response &quot;APT_SID_FMT,MRCP_SESSION_SID(&amp;session-&gt;base));
</ins><span class="cx">         mrcp_session_terminate_response(&amp;session-&gt;base);
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="lines">@@ -912,6 +899,60 @@
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message)
+{
+        mrcp_channel_t *channel = state_machine-&gt;obj;
+
+        if(message-&gt;start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) {
+                /* send request message to resource engine for actual processing */
+                if(channel-&gt;engine_channel) {
+                        mrcp_engine_channel_request_process(channel-&gt;engine_channel,message);
+                }
+        }
+        else if(message-&gt;start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
+                mrcp_server_session_t *session = (mrcp_server_session_t*)channel-&gt;session;
+                /* send response message to client */
+                if(channel-&gt;control_channel) {
+                        /* MRCPv2 */
+                        mrcp_server_control_message_send(channel-&gt;control_channel,message);
+                }
+                else {
+                        /* MRCPv1 */
+                        mrcp_session_control_response(channel-&gt;session,message);
+                }
+
+                session-&gt;active_request = apt_list_pop_front(session-&gt;request_queue);
+                if(session-&gt;active_request) {
+                        mrcp_server_signaling_message_dispatch(session,session-&gt;active_request);
+                }
+        }
+        else { 
+                /* send event message to client */
+                if(channel-&gt;control_channel) {
+                        /* MRCPv2 */
+                        mrcp_server_control_message_send(channel-&gt;control_channel,message);
+                }
+                else {
+                        /* MRCPv1 */
+                        mrcp_session_control_response(channel-&gt;session,message);
+                }
+        }
+        return TRUE;
+}
+
+static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine)
+{
+        mrcp_channel_t *channel = state_machine-&gt;obj;
+        mrcp_server_session_t *session = (mrcp_server_session_t*)channel-&gt;session;
+        if(session-&gt;deactivate_flag_count) {
+                session-&gt;deactivate_flag_count --;
+                if(!session-&gt;deactivate_flag_count) {
+                        mrcp_server_session_terminate_process(session);
+                }
+        }
+        return TRUE;
+}
+
</ins><span class="cx"> static apt_bool_t mrcp_server_mpf_request_send(
</span><span class="cx">                                                 mrcp_server_session_t *session, 
</span><span class="cx">                                                 mpf_command_type_e command_id, 
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpmodulesmrcpsofiasipsrcmrcp_sdpc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx">  * limitations under the License.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-
</del><ins>+#include &lt;stdlib.h&gt;
</ins><span class="cx"> #include &lt;apr_general.h&gt;
</span><span class="cx"> #include &lt;sofia-sip/sdp.h&gt;
</span><span class="cx"> #include &quot;mrcp_sdp.h&quot;
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpmodulesmrcpunirtspsrcmrcp_unirtsp_sdpc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -14,6 +14,7 @@
</span><span class="cx">  * limitations under the License.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+#include &lt;stdlib.h&gt;
</ins><span class="cx"> #include &lt;apr_general.h&gt;
</span><span class="cx"> #include &lt;sofia-sip/sdp.h&gt;
</span><span class="cx"> #include &quot;rtsp_message.h&quot;
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpplatformslibunimrcpclientsrcunimrcp_clientc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -14,6 +14,7 @@
</span><span class="cx">  * limitations under the License.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+#include &lt;stdlib.h&gt;
</ins><span class="cx"> #include &lt;apr_xml.h&gt;
</span><span class="cx"> #include &quot;unimrcp_client.h&quot;
</span><span class="cx"> #include &quot;uni_version.h&quot;
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpplatformslibunimrcpserversrcunimrcp_serverc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -14,6 +14,7 @@
</span><span class="cx">  * limitations under the License.
</span><span class="cx">  */
</span><span class="cx"> 
</span><ins>+#include &lt;stdlib.h&gt;
</ins><span class="cx"> #include &lt;apr_xml.h&gt;
</span><span class="cx"> #include &quot;unimrcp_server.h&quot;
</span><span class="cx"> #include &quot;uni_version.h&quot;
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpplatformsunimrcpclientincludedemo_utilh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> /** Create demo MRCP message (RECOGNIZE request) */
</span><span class="cx"> mrcp_message_t* demo_recognize_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout);
</span><span class="cx"> 
</span><ins>+/** Parse NLSML result */
+apt_bool_t demo_nlsml_result_parse(mrcp_message_t *message);
</ins><span class="cx"> 
</span><span class="cx"> /** Create demo RTP termination descriptor */
</span><span class="cx"> mpf_rtp_termination_descriptor_t* demo_rtp_descriptor_create(apr_pool_t *pool);
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpplatformsunimrcpclientsrcdemo_recog_applicationc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -291,6 +291,7 @@
</span><span class="cx">         }
</span><span class="cx">         else if(message-&gt;start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
</span><span class="cx">                 if(message-&gt;start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
</span><ins>+                        demo_nlsml_result_parse(message);
</ins><span class="cx">                         if(recog_channel) {
</span><span class="cx">                                 recog_channel-&gt;streaming = FALSE;
</span><span class="cx">                         }
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpplatformsunimrcpclientsrcdemo_utilc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -25,6 +25,10 @@
</span><span class="cx"> /* recognizer includes */
</span><span class="cx"> #include &quot;mrcp_recog_header.h&quot;
</span><span class="cx"> #include &quot;mrcp_recog_resource.h&quot;
</span><ins>+/* NLSML doc include */
+#include &quot;apt_nlsml_doc.h&quot;
+/* logger include */
+#include &quot;apt_log.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> static void demo_message_body_set(mrcp_message_t *mrcp_message, const apt_dir_layout_t *dir_layout, const char *file_name)
</span><span class="cx"> {
</span><span class="lines">@@ -127,6 +131,8 @@
</span><span class="cx">                         mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
</span><span class="cx">                         recog_header-&gt;start_input_timers = TRUE;
</span><span class="cx">                         mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_START_INPUT_TIMERS);
</span><ins>+                        recog_header-&gt;confidence_threshold = 0.87f;
+                        mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
</ins><span class="cx">                 }
</span><span class="cx">                 /* set message body */
</span><span class="cx">                 apt_string_assign(&amp;mrcp_message-&gt;body,text,mrcp_message-&gt;pool);
</span><span class="lines">@@ -134,6 +140,37 @@
</span><span class="cx">         return mrcp_message;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/** Parse NLSML result */
+apt_bool_t demo_nlsml_result_parse(mrcp_message_t *message)
+{
+        apr_xml_elem *interpret;
+        apr_xml_elem *instance;
+        apr_xml_elem *input;
+        apr_xml_doc *doc = nlsml_doc_load(&amp;message-&gt;body,message-&gt;pool);
+        if(!doc) {
+                return FALSE;
+        }
+        
+        /* walk through interpreted results */
+        interpret = nlsml_first_interpret_get(doc);
+        for(; interpret; interpret = nlsml_next_interpret_get(interpret)) {
+                /* get instance and input */
+                nlsml_interpret_results_get(interpret,&amp;instance,&amp;input);
+                if(instance) {
+                        /* process instance */
+                        if(instance-&gt;first_cdata.first) {
+                                apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Interpreted Instance [%s]&quot;,instance-&gt;first_cdata.first-&gt;text);
+                        }
+                }
+                if(input) {
+                        /* process input */
+                        if(input-&gt;first_cdata.first) {
+                                apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Interpreted Input [%s]&quot;,input-&gt;first_cdata.first-&gt;text);
+                        }
+                }
+        }
+        return TRUE;
+}
</ins><span class="cx"> 
</span><span class="cx"> /** Create demo RTP termination descriptor */
</span><span class="cx"> mpf_rtp_termination_descriptor_t* demo_rtp_descriptor_create(apr_pool_t *pool)
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcppluginsmrcpflitesrcmrcp_flitec"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -119,6 +119,8 @@
</span><span class="cx"> /* we have a special task for the actual synthesis - 
</span><span class="cx">    the task is created when a mrcp speak message is received */
</span><span class="cx"> static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg);
</span><ins>+static apt_bool_t flite_on_start(apt_task_t *task);
+static apt_bool_t flite_on_terminate(apt_task_t *task);
</ins><span class="cx"> 
</span><span class="cx"> /** Declare this macro to use log routine of the server where the plugin is loaded from */
</span><span class="cx"> MRCP_PLUGIN_LOGGER_IMPLEMENT
</span><span class="lines">@@ -184,14 +186,16 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         task_vtable = apt_consumer_task_vtable_get(consumer_task);
</span><del>-        if(!task_vtable) {
-                apt_log(APT_LOG_MARK,APT_PRIO_ERROR, &quot;flite_synth_channel_speak cannot use flite speak task vtable - channel:%d&quot;, synth_channel-&gt;iId);
-                return FALSE;
</del><ins>+        if(task_vtable) {
+                task_vtable-&gt;process_msg = flite_speak;
+                task_vtable-&gt;on_pre_run = flite_on_start;
+                task_vtable-&gt;on_post_run = flite_on_terminate;
</ins><span class="cx">         }
</span><del>-
-        task_vtable-&gt;process_msg = flite_speak;
</del><span class="cx">         synth_channel-&gt;msg_pool = msg_pool;
</span><span class="cx">         synth_channel-&gt;task = apt_consumer_task_base_get(consumer_task);
</span><ins>+        if(synth_channel-&gt;task) {
+                apt_task_name_set(synth_channel-&gt;task,&quot;Flite Task&quot;);
+        }
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -199,19 +203,10 @@
</span><span class="cx"> static mrcp_engine_channel_t* flite_synth_engine_channel_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
</span><span class="cx"> {
</span><span class="cx">         /* create flite synth channel */
</span><ins>+        mpf_codec_descriptor_t *codec_descriptor = NULL;
</ins><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) apr_palloc(pool,sizeof(flite_synth_channel_t));
</span><del>-        mpf_codec_descriptor_t *codec_descriptor = NULL;
</del><span class="cx"> 
</span><span class="cx">         apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_engine_channel_create&quot;);
</span><del>-#if 0
-        codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
-        mpf_codec_descriptor_init(codec_descriptor);
-        codec_descriptor-&gt;channel_count = 1;
-        codec_descriptor-&gt;payload_type = 96;
-        apt_string_set(&amp;codec_descriptor-&gt;name,&quot;LPCM&quot;);
-        codec_descriptor-&gt;sampling_rate = 16000;
-#endif
-
</del><span class="cx">         synth_channel-&gt;flite_engine = (flite_synth_engine_t *) engine-&gt;obj;
</span><span class="cx">         synth_channel-&gt;speak_request = NULL; // no active speak request in progress
</span><span class="cx">         synth_channel-&gt;speak_response = NULL;
</span><span class="lines">@@ -228,6 +223,15 @@
</span><span class="cx">                 return NULL;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+#if 0
+        codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
+        mpf_codec_descriptor_init(codec_descriptor);
+        codec_descriptor-&gt;channel_count = 1;
+        codec_descriptor-&gt;payload_type = 96;
+        apt_string_set(&amp;codec_descriptor-&gt;name,&quot;LPCM&quot;);
+        codec_descriptor-&gt;sampling_rate = 16000;
+#endif
+
</ins><span class="cx">         /* create engine channel base */
</span><span class="cx">         synth_channel-&gt;channel = mrcp_engine_source_channel_create(
</span><span class="cx">                         engine,               /* resource engine */
</span><span class="lines">@@ -272,14 +276,15 @@
</span><span class="cx"> 
</span><span class="cx">         if(synth_channel-&gt;task) {
</span><span class="cx">                 if(apt_task_start(synth_channel-&gt;task) == TRUE) {
</span><del>-                        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;Speak task started - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+                        /* async response will be sent */
+                        return TRUE;
</ins><span class="cx">                 }
</span><span class="cx">                 else {
</span><span class="cx">                         apt_log(APT_LOG_MARK, APT_PRIO_WARNING, &quot;Speak task start failed - channel %d&quot;, synth_channel-&gt;iId);
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return mrcp_engine_channel_open_respond(channel,TRUE);
</del><ins>+        return mrcp_engine_channel_open_respond(channel,FALSE);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Close engine channel (asynchronous response MUST be sent)*/
</span><span class="lines">@@ -289,15 +294,15 @@
</span><span class="cx">         apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_close - channel %d&quot;, synth_channel-&gt;iId);
</span><span class="cx"> 
</span><span class="cx">         if(synth_channel-&gt;task) {
</span><del>-                if(apt_task_terminate(synth_channel-&gt;task,TRUE) == TRUE) {
-                        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;Speak task terminated - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+                if(apt_task_terminate(synth_channel-&gt;task,FALSE) == TRUE) {
+                        /* async response will be sent */
+                        return TRUE;
</ins><span class="cx">                 }
</span><span class="cx">                 else {
</span><span class="cx">                         apt_log(APT_LOG_MARK, APT_PRIO_WARNING, &quot;Speak task terminate failed - channel %d&quot;, synth_channel-&gt;iId);
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        mrcp_engine_channel_close_respond(channel);
-        return TRUE; 
</del><ins>+        return mrcp_engine_channel_close_respond(channel);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Process MRCP channel request (asynchronous response MUST be sent)*/
</span><span class="lines">@@ -428,7 +433,7 @@
</span><span class="cx">         apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;&lt; flite_speak_msg_process speak - channel %d&quot;, synth_channel-&gt;iId);
</span><span class="cx">         
</span><span class="cx">         /* just sequential stuff */
</span><del>-        start = apr_time_now();        // in microsec
</del><ins>+        start = apr_time_now();        /* in microsec */
</ins><span class="cx">         if(!body-&gt;length) {
</span><span class="cx">                 synth_channel-&gt;speak_request = NULL;
</span><span class="cx">                 synth_response_construct(response,MRCP_STATUS_CODE_MISSING_PARAM,SYNTHESIZER_COMPLETION_CAUSE_ERROR);
</span><span class="lines">@@ -479,7 +484,7 @@
</span><span class="cx">                 delete_wave(wave);
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        // this will notify the callback that feeds the client that synthesis is complete
</del><ins>+        /* this will notify the callback that feeds the client that synthesis is complete */
</ins><span class="cx">         mpf_buffer_event_write(synth_channel-&gt;audio_buffer, MEDIA_FRAME_TYPE_EVENT);
</span><span class="cx">         synth_channel-&gt;synthesizing = FALSE;
</span><span class="cx"> 
</span><span class="lines">@@ -487,6 +492,26 @@
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static APR_INLINE flite_synth_channel_t* flite_synth_channel_get(apt_task_t *task)
+{
+        apt_consumer_task_t *consumer_task = apt_task_object_get(task);
+        return apt_consumer_task_object_get(consumer_task);
+}
+
+static apt_bool_t flite_on_start(apt_task_t *task)
+{
+        flite_synth_channel_t *synth_channel = flite_synth_channel_get(task);
+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;Speak task started - channel %d&quot;, synth_channel-&gt;iId);
+        return mrcp_engine_channel_open_respond(synth_channel-&gt;channel,TRUE);
+}
+
+static apt_bool_t flite_on_terminate(apt_task_t *task)
+{
+        flite_synth_channel_t *synth_channel = flite_synth_channel_get(task);
+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;Speak task terminated - channel %d&quot;, synth_channel-&gt;iId);
+        return mrcp_engine_channel_close_respond(synth_channel-&gt;channel);
+}
+
</ins><span class="cx"> /** Process STOP request */
</span><span class="cx"> static apt_bool_t flite_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
</span><span class="cx"> {
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcppluginsmrcppocketsphinxsrcmrcp_pocketsphinxc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c (14259 => 14260)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c        2009-07-15 16:54:20 UTC (rev 14259)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c        2009-07-15 20:30:39 UTC (rev 14260)
</span><span class="lines">@@ -237,7 +237,10 @@
</span><span class="cx">                         recognizer,           /* object to associate */
</span><span class="cx">                         NULL,                 /* codec descriptor might be NULL by default */
</span><span class="cx">                         pool);                /* pool to allocate memory from */
</span><del>-        
</del><ins>+
+        apr_thread_mutex_create(&amp;recognizer-&gt;mutex,APR_THREAD_MUTEX_DEFAULT,channel-&gt;pool);
+        apr_thread_cond_create(&amp;recognizer-&gt;wait_object,channel-&gt;pool);
+
</ins><span class="cx">         recognizer-&gt;channel = channel;
</span><span class="cx">         return channel;
</span><span class="cx"> }
</span><span class="lines">@@ -245,6 +248,15 @@
</span><span class="cx"> /** Destroy pocketsphinx recognizer */
</span><span class="cx"> static apt_bool_t pocketsphinx_recognizer_destroy(mrcp_engine_channel_t *channel)
</span><span class="cx"> {
</span><ins>+        pocketsphinx_recognizer_t *recognizer = channel-&gt;method_obj;
+        if(recognizer-&gt;mutex) {
+                apr_thread_mutex_destroy(recognizer-&gt;mutex);
+                recognizer-&gt;mutex = NULL;
+        }
+        if(recognizer-&gt;wait_object) {
+                apr_thread_cond_destroy(recognizer-&gt;wait_object);
+                recognizer-&gt;wait_object = NULL;
+        }
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -256,17 +268,10 @@
</span><span class="cx"> 
</span><span class="cx">         apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Open Channel &quot;APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
</span><span class="cx"> 
</span><del>-        apr_thread_mutex_create(&amp;recognizer-&gt;mutex,APR_THREAD_MUTEX_DEFAULT,channel-&gt;pool);
-        apr_thread_cond_create(&amp;recognizer-&gt;wait_object,channel-&gt;pool);
-
</del><span class="cx">         /* Launch a thread to run recognition in */
</span><span class="cx">         rv = apr_thread_create(&amp;recognizer-&gt;thread,NULL,pocketsphinx_recognizer_run,recognizer,channel-&gt;pool);
</span><span class="cx">         if(rv != APR_SUCCESS) {
</span><span class="cx">                 apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Failed to Launch Thread &quot;APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
</span><del>-                apr_thread_mutex_destroy(recognizer-&gt;mutex);
-                recognizer-&gt;mutex = NULL;
-                apr_thread_cond_destroy(recognizer-&gt;wait_object);
-                recognizer-&gt;wait_object = NULL;
</del><span class="cx">                 return mrcp_engine_channel_open_respond(channel,FALSE);
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -278,25 +283,16 @@
</span><span class="cx"> {
</span><span class="cx">         pocketsphinx_recognizer_t *recognizer = channel-&gt;method_obj;
</span><span class="cx">         apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Close Channel &quot;APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
</span><del>-        if(recognizer-&gt;thread) {
-                apr_status_t rv;
-                
-                /* Signal recognition thread to terminate */
-                apr_thread_mutex_lock(recognizer-&gt;mutex);
-                recognizer-&gt;close_requested = TRUE;
-                apr_thread_cond_signal(recognizer-&gt;wait_object);
-                apr_thread_mutex_unlock(recognizer-&gt;mutex);
-
-                apr_thread_join(&amp;rv,recognizer-&gt;thread);
-                recognizer-&gt;thread = NULL;
-
-                apr_thread_mutex_destroy(recognizer-&gt;mutex);
-                recognizer-&gt;mutex = NULL;
-                apr_thread_cond_destroy(recognizer-&gt;wait_object);
-                recognizer-&gt;wait_object = NULL;
</del><ins>+        if(!recognizer-&gt;thread) {
+                return mrcp_engine_channel_close_respond(channel);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        return mrcp_engine_channel_close_respond(channel);
</del><ins>+        /* Signal recognition thread to terminate */
+        apr_thread_mutex_lock(recognizer-&gt;mutex);
+        recognizer-&gt;close_requested = TRUE;
+        apr_thread_cond_signal(recognizer-&gt;wait_object);
+        apr_thread_mutex_unlock(recognizer-&gt;mutex);
+        return TRUE;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Process MRCP request (asynchronous response MUST be sent)*/
</span><span class="lines">@@ -533,12 +529,10 @@
</span><span class="cx">                 return FALSE;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        response_recog_header-&gt;completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
-        mrcp_resource_header_property_add(response,RECOGNIZER_HEADER_COMPLETION_CAUSE);
-
</del><span class="cx">         if(!recognizer-&gt;decoder || ps_start_utt(recognizer-&gt;decoder, NULL) &lt; 0) {
</span><span class="cx">                 response-&gt;start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
</span><span class="cx">                 response_recog_header-&gt;completion_cause = RECOGNIZER_COMPLETION_CAUSE_ERROR;
</span><ins>+                mrcp_resource_header_property_add(response,RECOGNIZER_HEADER_COMPLETION_CAUSE);
</ins><span class="cx">                 return FALSE;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -755,17 +749,6 @@
</span><span class="cx">         }
</span><span class="cx">         while(recognizer-&gt;close_requested == FALSE);
</span><span class="cx"> 
</span><del>-        /* check if recognition is still active */
-        if(recognizer-&gt;inprogress_recog) {
-                apr_thread_mutex_lock(recognizer-&gt;mutex);
-                recognizer-&gt;stop_response = recognizer-&gt;inprogress_recog;
-                apr_thread_cond_wait(recognizer-&gt;wait_object,recognizer-&gt;mutex);
-                apr_thread_mutex_unlock(recognizer-&gt;mutex);
-                if(recognizer-&gt;complete_event) {
-                        pocketsphinx_recognition_complete(recognizer,recognizer-&gt;complete_event);
-                }
-        }
-
</del><span class="cx">         /** Clear all the defined grammars */
</span><span class="cx">         pocketsphinx_grammars_clear(recognizer);
</span><span class="cx">         
</span><span class="lines">@@ -776,6 +759,10 @@
</span><span class="cx">                 recognizer-&gt;decoder = NULL;
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        recognizer-&gt;thread = NULL;
+        /** Finally send response to channel_close request */
+        mrcp_engine_channel_close_respond(recognizer-&gt;channel);
+
</ins><span class="cx">         /** Exit thread */
</span><span class="cx">         apr_thread_exit(thread,APR_SUCCESS);
</span><span class="cx">         return NULL;
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>