<!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][14104] </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=14104">14104</a></dd>
<dt>Author</dt> <dd>brian</dd>
<dt>Date</dt> <dd>2009-07-01 19:54:48 -0500 (Wed, 01 Jul 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>commit e8f60761378fe392d80e89d0e3481316119e9809
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Tue Jun 30 14:44:09 2009 +0000

    Further build and install integration
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1030 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 5b410e0dfc1852ee5c0d56d64b326d5130aed18a
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Tue Jun 30 13:24:27 2009 +0000

    Added utility project (preparesphinx) to copy the stuff pocketsphinx requires to run
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1029 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 2457575de160b378affdfa7a37cac1282d0024ca
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Tue Jun 30 13:18:59 2009 +0000

    Added a few more comments in config file
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1028 f001bc3a-424a-0410-80a0-a715b8f413a8

commit ffc40b15b409a79bdea286898ad1e8694fc1623c
Author: garmt.noname@gmail.com &lt;garmt.noname@gmail.com@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Tue Jun 30 10:38:54 2009 +0000

    Added resampling to 8kHz so that it works with freeswitch (specify only L16/96/8000 codec in profile of media_engine/rtpfactory).
    Changed logging to DEBUG level rather than INFO.
    Added channel_guard for stop response.
    
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1027 f001bc3a-424a-0410-80a0-a715b8f413a8

commit d11439611186b46f1bfabc036b7e5d76f33f8b0e
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jun 29 19:46:54 2009 +0000

    Added entries for PocketSphinx (mrcppocketsphinx) and Flite (mrcpflite) plugins into unimrcpserver.xml (disabled by default)
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1026 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 63bc73426ba4efdf648a28cd3c1ff1daaef5bb49
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jun 29 15:04:01 2009 +0000

    Added enumeration of pocketsphinx models (narrowband, wideband), supported wideband either
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1025 f001bc3a-424a-0410-80a0-a715b8f413a8

commit d11439611186b46f1bfabc036b7e5d76f33f8b0e
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jun 29 19:46:54 2009 +0000

    Added entries for PocketSphinx (mrcppocketsphinx) and Flite (mrcpflite) plugins into unimrcpserver.xml (disabled by default)

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

commit 63bc73426ba4efdf648a28cd3c1ff1daaef5bb49
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jun 29 15:04:01 2009 +0000

    Added enumeration of pocketsphinx models (narrowband, wideband), supported wideband either

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

commit 04970484e4357e2a1c3c4385840640caada33468
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jun 29 13:21:35 2009 +0000

    Removed engine-&gt;guard, as all relevant calls are made within the context of the same thread

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

commit 9bac2f3abdcfea5397aca4b86e209af090631e7a
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Mon Jun 29 13:15:30 2009 +0000

    Initialized 16kHz codec descriptor for flite channel, since available flite voice are in 16kHz.

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

commit 4e902eb985b433416723f15646d3e99d385d18cb
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sun Jun 28 20:05:22 2009 +0000

    Do not create bridge if resampling is required.
    Several sampling rates are supported, but there is no resampling yet.

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

commit 6d35b1246a7061e4c8f3f608bb17e146870d63bd
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sun Jun 28 18:14:25 2009 +0000

    Added makefile target to install pocketsphinx.xml with make install

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

commit c2b75c89d57c02bd8d4360aebcb7406ecbf90eb0
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sun Jun 28 18:10:01 2009 +0000

    Set svn props (eol:native)

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

commit dd91ebea823dd2169e8c30f0cfe87fa199e1a0c2
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sun Jun 28 17:46:46 2009 +0000

    Loaded pocketsphinx's properties from config file

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

commit 2ba91890593d7a64136e675bb937efd9a2542cc7
Author: garmt.noname@gmail.com &lt;garmt.noname@gmail.com@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sun Jun 28 12:29:54 2009 +0000

    Removed session tasks, most channel tasks, flite voices are no longer global

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

commit 0d739127f9267b3ad871d1a53a863802f101a6b5
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sat Jun 27 09:15:20 2009 +0000

    Implemented save_waveform, utterance will be saved in the filesystem

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

commit 4ffd282ddf54ad861d73f36567ad201d135feff5
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sat Jun 27 08:24:19 2009 +0000

    Set 2 digits precision (digits after the decimal point) while generating float type values (<a href="http://jira.freeswitch.org/browse/Issue-35">Issue-35</a>).

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

commit 90446f5e6ece40e91fd5b340a45e6773e4e80a0f
Author: achaloyan &lt;achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8&gt;
Date:   Sat Jun 27 07:42:52 2009 +0000

    Set noinut and recognition timeouts if specified in RECOGNIZE request, reset input timer on partial match

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

<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchtrunklibsunimrcpupdate">freeswitch/trunk/libs/unimrcp/.update</a></li>
<li><a href="#freeswitchtrunklibsunimrcpbuildacmacrosflitem4">freeswitch/trunk/libs/unimrcp/build/acmacros/flite.m4</a></li>
<li><a href="#freeswitchtrunklibsunimrcpbuildacmacrospocketsphinxm4">freeswitch/trunk/libs/unimrcp/build/acmacros/pocketsphinx.m4</a></li>
<li><a href="#freeswitchtrunklibsunimrcpconfunimrcpserverxml">freeswitch/trunk/libs/unimrcp/conf/unimrcpserver.xml</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsaprtoolkitincludeapt_text_streamh">freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcplibsmpfsrcmpf_contextc">freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcpflitesrcmrcp_flitec">freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcppocketsphinxMakefileam">freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am</a></li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcppocketsphinxmrcppocketsphinxvcproj">freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj</a></li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcppocketsphinxsrcmrcp_pocketsphinxc">freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c</a></li>
<li><a href="#freeswitchtrunklibsunimrcpunimrcpsln">freeswitch/trunk/libs/unimrcp/unimrcp.sln</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#freeswitchtrunklibsunimrcpbuildtoolspreparesphinxvcproj">freeswitch/trunk/libs/unimrcp/build/tools/preparesphinx.vcproj</a></li>
<li>freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/</li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcppocketsphinxconfpocketsphinxxml">freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml</a></li>
<li>freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/include/</li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcppocketsphinxincludepocketsphinx_propertiesh">freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h</a></li>
<li><a href="#freeswitchtrunklibsunimrcppluginsmrcppocketsphinxsrcpocketsphinx_propertiesc">freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchtrunklibsunimrcpupdate"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/.update (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/.update        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/.update        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -1 +1 @@
</span><del>-Fri Jun 26 15:16:40 CDT 2009
</del><ins>+Wed Jul  1 19:53:07 CDT 2009
</ins></span></pre></div>
<a id="freeswitchtrunklibsunimrcpbuildacmacrosflitem4"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/build/acmacros/flite.m4 (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/build/acmacros/flite.m4        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/build/acmacros/flite.m4        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -6,15 +6,13 @@
</span><span class="cx"> 
</span><span class="cx">     AC_MSG_CHECKING([for Flite])
</span><span class="cx">     AC_ARG_WITH(flite,
</span><del>-                [  --with-flite=PATH     prefix for installed Flite or
-                          path to Flite build tree],
</del><ins>+                [  --with-flite=PATH      path to Flite build tree],
</ins><span class="cx">                 [flite_path=$withval],
</span><del>-                [flite_path=&quot;/usr/local&quot;]
</del><ins>+                [flite_path=&quot;/usr/src/flite&quot;]
</ins><span class="cx">                 )
</span><span class="cx">     
</span><span class="cx">     found_flite=&quot;no&quot;
</span><span class="cx">     
</span><del>-    dnl TO BE DONE
</del><span class="cx">     flite_libdir=&quot;build/libs&quot;
</span><span class="cx">     for dir in $flite_path ; do
</span><span class="cx">         cd $dir &amp;&amp; flite_dir=`pwd` &amp;&amp; cd - &gt; /dev/null
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpbuildacmacrospocketsphinxm4"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/build/acmacros/pocketsphinx.m4 (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/build/acmacros/pocketsphinx.m4        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/build/acmacros/pocketsphinx.m4        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx">             found_pocketsphinx=&quot;yes&quot;
</span><span class="cx">             UNIMRCP_POCKETSPHINX_INCLUDES=&quot;`pkg-config --cflags $dir/$pocketsphinx_config`&quot;
</span><span class="cx">             UNIMRCP_POCKETSPHINX_LIBS=&quot;`pkg-config --libs $dir/$pocketsphinx_config`&quot;
</span><ins>+            UNIMRCP_POCKETSPHINX_MODELS=
</ins><span class="cx">             pocketsphinx_version=&quot;`pkg-config --modversion $dir/$pocketsphinx_config`&quot;
</span><span class="cx">             break
</span><span class="cx">         fi
</span><span class="lines">@@ -28,6 +29,7 @@
</span><span class="cx">             found_pocketsphinx=&quot;yes&quot;
</span><span class="cx">             UNIMRCP_POCKETSPHINX_INCLUDES=&quot;-I$pocketsphinx_dir/include&quot;
</span><span class="cx">             UNIMRCP_POCKETSPHINX_LIBS=&quot;$pocketsphinx_dir/$pocketsphinx_srcdir/libpocketsphinx/libpocketsphinx.la&quot;
</span><ins>+            UNIMRCP_POCKETSPHINX_MODELS=&quot;$pocketsphinx_dir/model&quot;
</ins><span class="cx">             pocketsphinx_version=&quot;`pkg-config --modversion $pocketsphinx_dir/pocketsphinx.pc`&quot;
</span><span class="cx">             break
</span><span class="cx">         fi
</span><span class="lines">@@ -46,5 +48,6 @@
</span><span class="cx"> 
</span><span class="cx">         AC_SUBST(UNIMRCP_POCKETSPHINX_INCLUDES)
</span><span class="cx">         AC_SUBST(UNIMRCP_POCKETSPHINX_LIBS)
</span><ins>+        AC_SUBST(UNIMRCP_POCKETSPHINX_MODELS)
</ins><span class="cx">     fi
</span><span class="cx"> ])
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcpbuildtoolspreparesphinxvcproj"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/unimrcp/build/tools/preparesphinx.vcproj (0 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/build/tools/preparesphinx.vcproj                                (rev 0)
+++ freeswitch/trunk/libs/unimrcp/build/tools/preparesphinx.vcproj        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot; encoding=&quot;Windows-1252&quot;?&gt;
+&lt;VisualStudioProject
+        ProjectType=&quot;Visual C++&quot;
+        Version=&quot;8.00&quot;
+        Name=&quot;preparesphinx&quot;
+        ProjectGUID=&quot;{71D62A04-8EF6-4C6B-AC12-0C15A875E53A}&quot;
+        RootNamespace=&quot;preparesphinx&quot;
+        Keyword=&quot;Win32Proj&quot;
+        &gt;
+        &lt;Platforms&gt;
+                &lt;Platform
+                        Name=&quot;Win32&quot;
+                /&gt;
+        &lt;/Platforms&gt;
+        &lt;ToolFiles&gt;
+        &lt;/ToolFiles&gt;
+        &lt;Configurations&gt;
+                &lt;Configuration
+                        Name=&quot;Debug|Win32&quot;
+                        OutputDirectory=&quot;$(SolutionDir)$(ConfigurationName)&quot;
+                        IntermediateDirectory=&quot;$(ConfigurationName)&quot;
+                        ConfigurationType=&quot;10&quot;
+                        InheritedPropertySheets=&quot;$(ProjectDir)..\..\build\vsprops\pocketsphinx.vsprops&quot;
+                        CharacterSet=&quot;1&quot;
+                        &gt;
+                        &lt;Tool
+                                Name=&quot;VCPreBuildEventTool&quot;
+                                CommandLine=&quot;xcopy &amp;quot;$(PocketSphinxDir)\bin\$(ConfigurationName)\pocketsphinx.dll&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\bin\&amp;quot; /Y&amp;#x0D;&amp;#x0A;xcopy &amp;quot;$(SphinxBaseDir)\lib\$(ConfigurationName)\sphinxbase.dll&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\bin\&amp;quot; /Y&amp;#x0D;&amp;#x0A;&amp;#x0D;&amp;#x0A;xcopy &amp;quot;$(PocketSphinxDir)\model\hmm\wsj1\*&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\data\wsj1\&amp;quot; /Y&amp;#x0D;&amp;#x0A;copy &amp;quot;$(PocketSphinxDir)\model\lm\cmudict.0.6d&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\data\default.dic&amp;quot;&amp;#x0D;&amp;#x0A;&amp;#x0D;&amp;#x0A;if not exist &amp;quot;$(SolutionDir)$(ConfigurationName)\conf\pocketsphinx.xml&amp;quot; xcopy &amp;quot;$(SolutionDir)plugins\mrcp-pocketsphinx\conf\pocketsphinx.xml&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\conf\&amp;quot; /Y&amp;#x0D;&amp;#x0A;&quot;
+                                ExcludedFromBuild=&quot;false&quot;
+                        /&gt;
+                        &lt;Tool
+                                Name=&quot;VCCustomBuildTool&quot;
+                        /&gt;
+                        &lt;Tool
+                                Name=&quot;VCMIDLTool&quot;
+                        /&gt;
+                        &lt;Tool
+                                Name=&quot;VCPostBuildEventTool&quot;
+                        /&gt;
+                &lt;/Configuration&gt;
+                &lt;Configuration
+                        Name=&quot;Release|Win32&quot;
+                        ConfigurationType=&quot;10&quot;
+                        InheritedPropertySheets=&quot;$(ProjectDir)..\..\build\vsprops\pocketsphinx.vsprops&quot;
+                        CharacterSet=&quot;1&quot;
+                        WholeProgramOptimization=&quot;1&quot;
+                        &gt;
+                        &lt;Tool
+                                Name=&quot;VCPreBuildEventTool&quot;
+                                CommandLine=&quot;xcopy &amp;quot;$(PocketSphinxDir)\bin\$(ConfigurationName)\pocketsphinx.dll&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\bin\&amp;quot; /Y&amp;#x0D;&amp;#x0A;xcopy &amp;quot;$(SphinxBaseDir)\lib\$(ConfigurationName)\sphinxbase.dll&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\bin\&amp;quot; /Y&amp;#x0D;&amp;#x0A;&amp;#x0D;&amp;#x0A;xcopy &amp;quot;$(PocketSphinxDir)\model\hmm\wsj1\*&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\data\wsj1\&amp;quot; /Y&amp;#x0D;&amp;#x0A;copy &amp;quot;$(PocketSphinxDir)\model\lm\cmudict.0.6d&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\data\default.dic&amp;quot;&amp;#x0D;&amp;#x0A;&amp;#x0D;&amp;#x0A;if not exist &amp;quot;$(SolutionDir)$(ConfigurationName)\conf\pocketsphinx.xml&amp;quot; xcopy &amp;quot;$(SolutionDir)plugins\mrcp-pocketsphinx\conf\pocketsphinx.xml&amp;quot; &amp;quot;$(SolutionDir)$(ConfigurationName)\conf\&amp;quot; /Y&amp;#x0D;&amp;#x0A;&quot;
+                        /&gt;
+                        &lt;Tool
+                                Name=&quot;VCCustomBuildTool&quot;
+                        /&gt;
+                        &lt;Tool
+                                Name=&quot;VCMIDLTool&quot;
+                        /&gt;
+                        &lt;Tool
+                                Name=&quot;VCPostBuildEventTool&quot;
+                        /&gt;
+                &lt;/Configuration&gt;
+        &lt;/Configurations&gt;
+        &lt;References&gt;
+        &lt;/References&gt;
+        &lt;Files&gt;
+        &lt;/Files&gt;
+        &lt;Globals&gt;
+        &lt;/Globals&gt;
+&lt;/VisualStudioProject&gt;
</ins></span></pre></div>
<a id="freeswitchtrunklibsunimrcpconfunimrcpserverxml"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/conf/unimrcpserver.xml (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/conf/unimrcpserver.xml        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/conf/unimrcpserver.xml        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -54,6 +54,8 @@
</span><span class="cx">     &lt;!-- Resource plugins --&gt;
</span><span class="cx">     &lt;plugin&gt;
</span><span class="cx">       &lt;engine name=&quot;Cepstral-Swift-1&quot; class=&quot;mrcpcepstral&quot; enable=&quot;0&quot;/&gt;
</span><ins>+      &lt;engine name=&quot;PocketSphinx-1&quot; class=&quot;mrcppocketsphinx&quot; enable=&quot;0&quot;/&gt;
+      &lt;engine name=&quot;Flite-1&quot; class=&quot;mrcpflite&quot; enable=&quot;0&quot;/&gt;
</ins><span class="cx">       &lt;engine name=&quot;Demo-Synth-1&quot; class=&quot;demosynth&quot; enable=&quot;1&quot;/&gt;
</span><span class="cx">       &lt;engine name=&quot;Demo-Recog-1&quot; class=&quot;demorecog&quot; enable=&quot;1&quot;/&gt;
</span><span class="cx">     &lt;/plugin&gt;
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsaprtoolkitincludeapt_text_streamh"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx"> /** Generate float value */
</span><span class="cx"> static APR_INLINE apt_bool_t apt_float_value_generate(float value, apt_text_stream_t *stream)
</span><span class="cx"> {
</span><del>-        int length = sprintf(stream-&gt;pos,&quot;%.1f&quot;,value);
</del><ins>+        int length = sprintf(stream-&gt;pos,&quot;%.2f&quot;,value);
</ins><span class="cx">         if(length &lt;= 0) {
</span><span class="cx">                 return FALSE;
</span><span class="cx">         }
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcplibsmpfsrcmpf_contextc"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/libs/mpf/src/mpf_context.c        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -208,6 +208,12 @@
</span><span class="cx">                                 object = mpf_null_bridge_create(source,sink,context-&gt;pool);
</span><span class="cx">                         }
</span><span class="cx">                         else {
</span><ins>+                                if(rx_codec-&gt;descriptor-&gt;sampling_rate != tx_codec-&gt;descriptor-&gt;sampling_rate) {
+                                        apt_log(APT_LOG_MARK,APT_PRIO_WARNING,
+                                                &quot;Resampling is not supported now. &quot;
+                                                &quot;Try to configure and use the same sampling rate on both ends&quot;);
+                                        return NULL;
+                                }
</ins><span class="cx">                                 if(rx_codec-&gt;vtable &amp;&amp; rx_codec-&gt;vtable-&gt;decode) {
</span><span class="cx">                                         /* set decoder before bridge */
</span><span class="cx">                                         mpf_audio_stream_t *decoder = mpf_decoder_create(source,context-&gt;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 (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-flite/src/mrcp_flite.c        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx"> 
</span><span class="cx"> typedef struct flite_synth_engine_t flite_synth_engine_t;
</span><span class="cx"> typedef struct flite_synth_channel_t flite_synth_channel_t;
</span><del>-typedef struct flite_synth_msg_t flite_synth_msg_t;
</del><span class="cx"> 
</span><span class="cx"> /** Declaration of synthesizer engine methods */
</span><span class="cx"> static apt_bool_t flite_synth_engine_destroy(mrcp_resource_engine_t *engine);
</span><span class="lines">@@ -58,6 +57,16 @@
</span><span class="cx"> static apt_bool_t flite_synth_channel_close(mrcp_engine_channel_t *channel);
</span><span class="cx"> static apt_bool_t flite_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request);
</span><span class="cx"> 
</span><ins>+static apt_bool_t flite_synth_channel_close_t(mrcp_engine_channel_t *channel); // wait for speak thread
+
+/** flite channel methods for processing MRCP channel request **/
+static apt_bool_t flite_synth_channel_speak(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+static apt_bool_t flite_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+static apt_bool_t flite_synth_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+static apt_bool_t flite_synth_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+// static apt_bool_t flite_synth_channel_setparams(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+// static apt_bool_t flite_synth_channel_getparams(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response);
+
</ins><span class="cx"> static const struct mrcp_engine_channel_method_vtable_t channel_vtable = {
</span><span class="cx">         flite_synth_channel_destroy,
</span><span class="cx">         flite_synth_channel_open,
</span><span class="lines">@@ -83,35 +92,26 @@
</span><span class="cx"> 
</span><span class="cx"> /** Declaration of flite synthesizer engine */
</span><span class="cx"> struct flite_synth_engine_t {
</span><del>-        apt_consumer_task_t *task;
</del><span class="cx">         int                                         iChannels;
</span><del>-        apr_thread_mutex_t        *guard;         
</del><ins>+        struct {
+                cst_voice *awb;
+                cst_voice *kal;
+                cst_voice *rms;
+                cst_voice *slt;
+        } voices;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-// flite stuff
-APT_BEGIN_EXTERN_C
-
</del><ins>+/** declarations for flite voices **/
</ins><span class="cx"> cst_voice *register_cmu_us_awb(void);
</span><del>-void unregister_cmu_us_awb(cst_voice * v);
-
</del><span class="cx"> cst_voice *register_cmu_us_kal(void);
</span><del>-void unregister_cmu_us_kal(cst_voice * v);
-
</del><span class="cx"> cst_voice *register_cmu_us_rms(void);
</span><del>-void unregister_cmu_us_rms(cst_voice * v);
-
</del><span class="cx"> cst_voice *register_cmu_us_slt(void);
</span><ins>+void unregister_cmu_us_awb(cst_voice * v);
+void unregister_cmu_us_kal(cst_voice * v);
+void unregister_cmu_us_rms(cst_voice * v);
</ins><span class="cx"> void unregister_cmu_us_slt(cst_voice * v);
</span><span class="cx"> 
</span><del>-APT_END_EXTERN_C
</del><span class="cx"> 
</span><del>-static struct {
-        cst_voice *awb;
-        cst_voice *kal;
-        cst_voice *rms;
-        cst_voice *slt;
-} voices;
-
</del><span class="cx"> /** Declaration of flite synthesizer channel */
</span><span class="cx"> struct flite_synth_channel_t {
</span><span class="cx">         flite_synth_engine_t    *flite_engine;        // Back pointer to engine 
</span><span class="lines">@@ -122,27 +122,12 @@
</span><span class="cx">         mpf_buffer_t                        *audio_buffer;        // Audio buffer
</span><span class="cx">         int                                                 iId;                        // Synth channel simultaneous reference count
</span><span class="cx">         cst_voice                                *voice;
</span><del>-        cst_wave                                *wave;
</del><span class="cx">         apr_pool_t                                *pool;
</span><span class="cx">         apt_consumer_task_t     *task;
</span><ins>+        apr_thread_mutex_t            *channel_guard;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-typedef enum flite_synth_msg_type_e {
-        flite_synth_MSG_OPEN_CHANNEL,
-        flite_synth_MSG_CLOSE_CHANNEL,
-        flite_synth_MSG_REQUEST_PROCESS
-} flite_synth_msg_type_e;
-
</del><span class="cx"> /** Declaration of flite synthesizer task message */
</span><del>-struct flite_synth_msg_t {
-        flite_synth_msg_type_e  type;
-        mrcp_engine_channel_t *channel; 
-        mrcp_message_t        *request;
-};
-
-/* mutex: may be flite library is not thread safe*/
-static apr_thread_mutex_t   *flite_mutex;
-
</del><span class="cx"> struct flite_speak_msg_t {
</span><span class="cx">         flite_synth_channel_t *channel; 
</span><span class="cx">         mrcp_message_t        *request;
</span><span class="lines">@@ -150,16 +135,9 @@
</span><span class="cx"> 
</span><span class="cx"> typedef struct flite_speak_msg_t flite_speak_msg_t;
</span><span class="cx"> 
</span><del>-// all calls to the Flite API functions (after initialization) 
-// will be carried out using a separate task
-static apt_bool_t flite_synth_msg_signal(flite_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request);
-static apt_bool_t flite_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg);
-static apt_bool_t flite_synth_channel_open_t(mrcp_engine_channel_t * channel);
-static apt_bool_t flite_synth_channel_close_t(mrcp_engine_channel_t * channel);
-
-// and we have a special task for the actual synthesis - 
</del><ins>+// we have a special task for the actual synthesis - 
</ins><span class="cx"> // the task is created when a mrcp speak message is received
</span><del>-static apt_bool_t flite_speak_msg_process(apt_task_t *task, apt_task_msg_t *msg);
</del><ins>+static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg);
</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">@@ -169,44 +147,9 @@
</span><span class="cx"> {
</span><span class="cx">         /* create flite engine */
</span><span class="cx">         flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) apr_palloc(pool,sizeof(flite_synth_engine_t));
</span><del>-        apt_task_msg_pool_t *msg_pool;
-        apt_task_vtable_t        *task_vtable = 0;
-        
</del><ins>+
</ins><span class="cx">         flite_engine-&gt;iChannels = 0;
</span><span class="cx"> 
</span><del>-        /* create task/thread to run flite engine in the context of this task */
-        msg_pool = apt_task_msg_pool_create_dynamic(sizeof(flite_synth_msg_t),pool);
-        flite_engine-&gt;task = apt_consumer_task_create(flite_engine,msg_pool,pool);
-        if (!flite_engine-&gt;task) 
-        {
-                apt_log(APT_LOG_MARK, APT_PRIO_ERROR, &quot;MRCP_PLUGIN_DECLARE cannot create task&quot;);
-                return NULL;
-        }
-        task_vtable = apt_consumer_task_vtable_get(flite_engine-&gt;task);
-        if (task_vtable) 
-        {
-                task_vtable-&gt;process_msg = flite_synth_msg_process;
-        }
-        else
-        {
-                apt_log(APT_LOG_MARK, APT_PRIO_ERROR, &quot;MRCP_PLUGIN_DECLARE cannot use task vtable&quot;);
-                return NULL;
-        }
-
-        /* create flite mutex */
-        if (apr_thread_mutex_create(&amp;flite_mutex,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS) 
-        {
-                apt_log(APT_LOG_MARK, APT_PRIO_ERROR,&quot;Failed to create flite mutex&quot;);
-                return NULL;
-        }
-
-        /* create channel mutex */
-        if (apr_thread_mutex_create(&amp;flite_engine-&gt;guard,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS) 
-        {
-                apt_log(APT_LOG_MARK, APT_PRIO_ERROR, &quot;Failed to create channel guard&quot;);
-                return NULL;
-        }
-
</del><span class="cx">         /* create resource engine base */
</span><span class="cx">         return mrcp_resource_engine_create(
</span><span class="cx">                                         MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */
</span><span class="lines">@@ -218,17 +161,7 @@
</span><span class="cx"> /** Destroy synthesizer engine */
</span><span class="cx"> static apt_bool_t flite_synth_engine_destroy(mrcp_resource_engine_t *engine)
</span><span class="cx"> {
</span><del>-        flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) engine-&gt;obj;
-
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_engine_destroy&quot;);
-
-        if(flite_engine-&gt;task) {
-                apt_task_t *task = apt_consumer_task_base_get(flite_engine-&gt;task);
-                apt_task_destroy(task);
-                flite_engine-&gt;task = NULL;
-        }
-        
-        apr_thread_mutex_destroy(flite_engine-&gt;guard);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_engine_destroy&quot;);
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -236,19 +169,16 @@
</span><span class="cx"> static apt_bool_t flite_synth_engine_open(mrcp_resource_engine_t *engine)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) engine-&gt;obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_engine_open&quot;);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_engine_open&quot;);
</ins><span class="cx"> 
</span><span class="cx">         flite_init();
</span><del>-        voices.awb = register_cmu_us_awb();
-        voices.kal = register_cmu_us_kal();
-        voices.rms = register_cmu_us_rms();
-        voices.slt = register_cmu_us_slt();
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;fliteInitialize success&quot;);
</del><ins>+        flite_engine-&gt;voices.awb = register_cmu_us_awb();
+        flite_engine-&gt;voices.kal = register_cmu_us_kal();
+        flite_engine-&gt;voices.rms = register_cmu_us_rms();
+        flite_engine-&gt;voices.slt = register_cmu_us_slt();
</ins><span class="cx"> 
</span><del>-        if (flite_engine-&gt;task) {
-                apt_task_t *task = apt_consumer_task_base_get(flite_engine-&gt;task);
-                apt_task_start(task);
-        }
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite init success&quot;);
+
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -256,19 +186,13 @@
</span><span class="cx"> static apt_bool_t flite_synth_engine_close(mrcp_resource_engine_t *engine)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_engine_t *flite_engine = (flite_synth_engine_t *) engine-&gt;obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_engine_close&quot;);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_engine_close&quot;);
</ins><span class="cx"> 
</span><del>-        if (flite_engine-&gt;task) 
-        {
-                apt_task_t *task = apt_consumer_task_base_get(flite_engine-&gt;task);
-                apt_task_terminate(task,TRUE);
-        }
</del><ins>+        unregister_cmu_us_awb(flite_engine-&gt;voices.awb);
+        unregister_cmu_us_kal(flite_engine-&gt;voices.kal);
+        unregister_cmu_us_rms(flite_engine-&gt;voices.rms);
+        unregister_cmu_us_slt(flite_engine-&gt;voices.slt);
</ins><span class="cx"> 
</span><del>-        unregister_cmu_us_awb(voices.awb);
-        unregister_cmu_us_kal(voices.kal);
-        unregister_cmu_us_rms(voices.rms);
-        unregister_cmu_us_slt(voices.slt);
-
</del><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -279,24 +203,31 @@
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) apr_palloc(pool,sizeof(flite_synth_channel_t));
</span><span class="cx">         mpf_codec_descriptor_t *codec_descriptor = NULL;
</span><span class="cx"> 
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_engine_channel_create&quot;);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_engine_channel_create&quot;);
</ins><span class="cx"> 
</span><del>-//  codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
</del><ins>+//        codec_descriptor = (mpf_codec_descriptor_t *) apr_palloc(pool,sizeof(mpf_codec_descriptor_t));
</ins><span class="cx"> //        mpf_codec_descriptor_init(codec_descriptor);
</span><span class="cx"> //        codec_descriptor-&gt;channel_count = 1;
</span><span class="cx"> //        codec_descriptor-&gt;payload_type = 96;
</span><del>-//        apt_string_set(&amp;codec_descriptor-&gt;name,&quot;L16&quot;);
</del><ins>+//        apt_string_set(&amp;codec_descriptor-&gt;name,&quot;LPCM&quot;);
</ins><span class="cx"> //        codec_descriptor-&gt;sampling_rate = 16000;
</span><del>-//
</del><ins>+
</ins><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;stop_response = NULL;
</span><span class="cx">         synth_channel-&gt;paused = FALSE;
</span><span class="cx">         synth_channel-&gt;pool = pool;
</span><del>-        synth_channel-&gt;wave = NULL;
</del><ins>+        synth_channel-&gt;audio_buffer = NULL;
</ins><span class="cx">         synth_channel-&gt;voice = NULL;
</span><span class="cx">         synth_channel-&gt;iId = 0;
</span><span class="cx"> 
</span><ins>+        if (apr_thread_mutex_create(&amp;synth_channel-&gt;channel_guard,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS) 
+        {
+                apt_log(APT_LOG_MARK, APT_PRIO_ERROR, &quot;Failed to create channel guard&quot;);
+                return NULL;
+        }
+
+
</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">@@ -313,9 +244,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         synth_channel-&gt;audio_buffer = mpf_buffer_create(pool);
</span><del>-        apr_thread_mutex_lock(synth_channel-&gt;flite_engine-&gt;guard);
</del><span class="cx">         synth_channel-&gt;iId = ++synth_channel-&gt;flite_engine-&gt;iChannels;
</span><del>-        apr_thread_mutex_unlock(synth_channel-&gt;flite_engine-&gt;guard);
</del><span class="cx"> 
</span><span class="cx">         apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_engine_channel_create created channel %d&quot;, synth_channel-&gt;iId);
</span><span class="cx"> 
</span><span class="lines">@@ -326,25 +255,25 @@
</span><span class="cx"> static apt_bool_t flite_synth_channel_destroy(mrcp_engine_channel_t *channel)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_destroy - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_destroy - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">         if(synth_channel-&gt;task)
</span><span class="cx">         {
</span><span class="cx">                 apt_task_t *task = apt_consumer_task_base_get(synth_channel-&gt;task);
</span><del>-                if (!apt_task_destroy(task))
</del><ins>+                if (!task || !apt_task_destroy(task))
</ins><span class="cx">                 {
</span><span class="cx">                         apt_log(APT_LOG_MARK, APT_PRIO_WARNING, &quot;Speak task destroy failed - channel %d&quot;, synth_channel-&gt;iId);
</span><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><del>-                        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;Speak task destroyed - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+                        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;Speak task destroyed - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><ins>+        
</ins><span class="cx">         synth_channel-&gt;task = NULL;
</span><del>-
-        apr_thread_mutex_lock(synth_channel-&gt;flite_engine-&gt;guard);
</del><span class="cx">         synth_channel-&gt;flite_engine-&gt;iChannels--;
</span><del>-        apr_thread_mutex_unlock(synth_channel-&gt;flite_engine-&gt;guard);
</del><span class="cx"> 
</span><ins>+        apr_thread_mutex_destroy(synth_channel-&gt;channel_guard);
+
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -352,40 +281,82 @@
</span><span class="cx"> static apt_bool_t flite_synth_channel_open(mrcp_engine_channel_t *channel)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_open - channel %d&quot;, synth_channel-&gt;iId);
-        return flite_synth_msg_signal(flite_synth_MSG_OPEN_CHANNEL,channel,NULL);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_open - channel %d&quot;, synth_channel-&gt;iId);
+
+        synth_channel-&gt;voice = synth_channel-&gt;flite_engine-&gt;voices.awb;
+        return mrcp_engine_channel_open_respond(channel,TRUE);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Close engine channel (asynchronous response MUST be sent)*/
</span><span class="cx"> static apt_bool_t flite_synth_channel_close(mrcp_engine_channel_t *channel)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_close - channel %d&quot;, synth_channel-&gt;iId);
-        return flite_synth_msg_signal(flite_synth_MSG_CLOSE_CHANNEL,channel,NULL);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_close - channel %d&quot;, synth_channel-&gt;iId);
+        // create thread to wait for speak thread to terminate
+        flite_synth_channel_close_t(channel);
+        return TRUE; 
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Process MRCP channel request (asynchronous response MUST be sent)*/
</span><span class="cx"> static apt_bool_t flite_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_request_process - channel %d&quot;, synth_channel-&gt;iId);
-        return flite_synth_msg_signal(flite_synth_MSG_REQUEST_PROCESS,channel,request);
-}
</del><ins>+        mrcp_message_t *response = mrcp_response_create(request,request-&gt;pool);
+        apt_bool_t processed = FALSE;
</ins><span class="cx"> 
</span><del>-/** Open engine channel */
-static apt_bool_t flite_synth_channel_open_t(mrcp_engine_channel_t *channel)
-{
-        flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_open_t - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_request_process - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx"> 
</span><del>-        synth_channel-&gt;voice = voices.awb;
</del><ins>+        switch(request-&gt;start_line.method_id) {
+                case SYNTHESIZER_SET_PARAMS:
+                                // TODO set voices
+                                //        if (!strcasecmp(voice_name, &quot;awb&quot;)) {
+                                //                synth_channel-&gt;voice = voices.awb;
+                                //        } else if (!strcasecmp(voice_name, &quot;kal&quot;)) {
+                                //                synth_channel-&gt;voice = voices.kal;
+                                //        } else if (!strcasecmp(voice_name, &quot;rms&quot;)) {
+                                //                synth_channel-&gt;voice = voices.rms;
+                                //        } else if (!strcasecmp(voice_name, &quot;slt&quot;)) {
+                                //                synth_channel-&gt;voice = voices.slt;
+                                //        } else {
+                                //                apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;Valid voice names are awb, kal, rms or slt&quot;);
+                                //        }
+                        break;
+                case SYNTHESIZER_GET_PARAMS:
+                        break;
+                case SYNTHESIZER_SPEAK:
+                        processed = flite_synth_channel_speak(channel,request,response);
+                        break;
+                case SYNTHESIZER_STOP:
+                        processed = flite_synth_channel_stop(channel,request,response);
+                        break;
+                case SYNTHESIZER_PAUSE:
+                        processed = flite_synth_channel_pause(channel,request,response);
+                        break;
+                case SYNTHESIZER_RESUME:
+                        processed = flite_synth_channel_resume(channel,request,response);
+                        break;
+                case SYNTHESIZER_BARGE_IN_OCCURRED:
+                        processed = flite_synth_channel_stop(channel,request,response);
+                        break;
+                case SYNTHESIZER_CONTROL:
+                        break;
+                case SYNTHESIZER_DEFINE_LEXICON:
+                        break;
+                default:
+                        break;
+        }
+        if(processed == FALSE) {
+                /* send asynchronous response for not handled request */
+                mrcp_engine_channel_message_send(channel,response);
+        }
</ins><span class="cx">         return TRUE;
</span><ins>+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static apt_bool_t flite_synth_channel_close_t(mrcp_engine_channel_t *channel)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_close_t - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_close_t - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">         
</span><span class="cx">         if (synth_channel-&gt;task) 
</span><span class="cx">         {
</span><span class="lines">@@ -396,20 +367,12 @@
</span><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><del>-                        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;Speak task terminated - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+                        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;Speak task terminated - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">                         apt_task_destroy(task);
</span><span class="cx">                         synth_channel-&gt;task = 0;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-        if (synth_channel-&gt;wave)
-        {
-                delete_wave(synth_channel-&gt;wave);
-                synth_channel-&gt;wave = 0;
-        }
-        else
-        {
-                apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;No wave buffer to delete - channel %d&quot;, synth_channel-&gt;iId);
-        }
</del><ins>+        mrcp_engine_channel_close_respond(channel);
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -429,7 +392,7 @@
</span><span class="cx">                 flite_speak_msg_t *flite_msg = 0;
</span><span class="cx"> 
</span><span class="cx">                 /* create task/thread to run flite so this function is not blocking */
</span><del>-                apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,&quot;Create flite speak task - channel: %d&quot;, synth_channel-&gt;iId);
</del><ins>+                apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;Create flite speak task - channel: %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">             synth_channel-&gt;task = apt_consumer_task_create(synth_channel, msg_pool, synth_channel-&gt;pool);
</span><span class="cx">                 if (!synth_channel-&gt;task) 
</span><span class="cx">                 {
</span><span class="lines">@@ -444,10 +407,10 @@
</span><span class="cx">                         return FALSE;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                task_vtable-&gt;process_msg = flite_speak_msg_process;
</del><ins>+                task_vtable-&gt;process_msg = flite_speak;
</ins><span class="cx">                 synth_channel-&gt;speak_request = request;
</span><span class="cx">                 
</span><del>-                apt_log(APT_LOG_MARK,APT_PRIO_INFO, &quot;Start task - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+                apt_log(APT_LOG_MARK,APT_PRIO_DEBUG, &quot;Start task - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">                 task = apt_consumer_task_base_get(synth_channel-&gt;task);
</span><span class="cx">                 if (apt_task_start(task) == FALSE) 
</span><span class="cx">                 {
</span><span class="lines">@@ -461,7 +424,7 @@
</span><span class="cx">                 flite_msg = (flite_speak_msg_t*) msg-&gt;data;
</span><span class="cx">                 flite_msg-&gt;channel = synth_channel;
</span><span class="cx">                 flite_msg-&gt;request = request;
</span><del>-                apt_log(APT_LOG_MARK,APT_PRIO_INFO, &quot;Send signal to start speech synthesis - channel:%d&quot;, synth_channel-&gt;iId);
</del><ins>+                apt_log(APT_LOG_MARK,APT_PRIO_DEBUG, &quot;Send signal to start speech synthesis - channel:%d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">                 if (apt_task_msg_signal(task,msg))
</span><span class="cx">                 {
</span><span class="cx">                         response-&gt;start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
</span><span class="lines">@@ -469,7 +432,7 @@
</span><span class="cx">                 }
</span><span class="cx">                 else
</span><span class="cx">                 {
</span><del>-                        apt_log(APT_LOG_MARK,APT_PRIO_INFO, &quot;Failed to send signal to start speech synthesis - channel:%d&quot;, synth_channel-&gt;iId);
</del><ins>+                        apt_log(APT_LOG_MARK,APT_PRIO_WARNING, &quot;Failed to send signal to start speech synthesis - channel:%d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">                         apt_task_destroy(task);
</span><span class="cx">                         return FALSE;
</span><span class="cx">                 }
</span><span class="lines">@@ -477,37 +440,65 @@
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static apt_bool_t flite_speak_msg_process(apt_task_t *task, apt_task_msg_t *msg)
</del><ins>+static apt_bool_t flite_speak(apt_task_t *task, apt_task_msg_t *msg)
</ins><span class="cx"> {
</span><span class="cx">         flite_speak_msg_t *flite_msg = (flite_speak_msg_t*)msg-&gt;data;
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) flite_msg-&gt;channel;
</span><span class="cx">         apr_time_t start = 0;
</span><span class="cx">         apr_time_t elapsed = 0;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;&lt; flite_speak_msg_process speak - channel %d&quot;, synth_channel-&gt;iId);
-        
-        // probably not necessary !?
-        mpf_buffer_restart(synth_channel-&gt;audio_buffer);
</del><ins>+        apr_time_t stamp = 0;
</ins><span class="cx"> 
</span><ins>+        mrcp_message_t *stop_response = 0;
+        mpf_codec_t * codec = mrcp_engine_source_stream_codec_get(synth_channel-&gt;channel);
+        apr_uint16_t rate = codec-&gt;descriptor-&gt;sampling_rate;                        
+
+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;&lt; flite_speak_msg_process speak - channel %d&quot;, synth_channel-&gt;iId);
+        
</ins><span class="cx">         // just sequential stuff
</span><span class="cx">         start = apr_time_now();        // in microsec
</span><span class="cx">         if (synth_channel-&gt;speak_request-&gt;body.length)
</span><span class="cx">         {
</span><del>-                cst_wave * wave = synth_channel-&gt;wave;
</del><ins>+                // TODO 
+                // create small units of text from synth_channel-&gt;speak_request-&gt;body.buf ( , . ? ! but ...
+                // synthesize small unit and store in audio_buffer
+                // check for stop 
+                // pause resume state could improve performance 
+                // you can &quot;pause&quot; generating new speech from a unit of text 
+                // by checking the (decreasing) size of the audio_buffer
+                // no need to generate more speech samples than can be listened to...
+                cst_wave *wave = 0;
</ins><span class="cx">                 wave = flite_text_to_wave(synth_channel-&gt;speak_request-&gt;body.buf, synth_channel-&gt;voice);
</span><ins>+                if (wave &amp;&amp; cst_wave_num_samples(wave)) 
+                {
+                        int generated = (cst_wave_num_samples(wave)/cst_wave_sample_rate(wave)*1000);
+                        stamp = apr_time_now();
+                        elapsed = (stamp - start)/1000;
+                        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;TTS (chan %d) took %&quot;APR_TIME_T_FMT&quot; to generate %d of speech (in millisec)&quot;, synth_channel-&gt;iId, elapsed, generated);
+
+                        if (rate != 16000)
+                        {
+                                cst_wave_resample(wave, rate);
+                                elapsed = (apr_time_now() - stamp)/1000;
+                                apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;TTS resampling to %d on (chan %d) took %&quot;APR_TIME_T_FMT&quot; millisec&quot;, rate, synth_channel-&gt;iId, elapsed);
+                        }
+                        mpf_buffer_audio_write(synth_channel-&gt;audio_buffer, cst_wave_samples(wave), cst_wave_num_samples(wave) * 2);
+                        delete_wave(wave);
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        elapsed = (apr_time_now() - start)/1000;
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;TTS (chan %d) took %ld millisec&quot;, synth_channel-&gt;iId, elapsed);
</del><ins>+        apr_thread_mutex_lock(synth_channel-&gt;channel_guard);
+        stop_response = synth_channel-&gt;stop_response; 
+        apr_thread_mutex_unlock(synth_channel-&gt;channel_guard);
</ins><span class="cx"> 
</span><del>-        if (!synth_channel-&gt;stop_response)
</del><ins>+        if (!stop_response)
</ins><span class="cx">         {
</span><span class="cx">                 // this will notify the callback that feeds the client that synthesis is complete
</span><span class="cx">                 mpf_buffer_event_write(synth_channel-&gt;audio_buffer, MEDIA_FRAME_TYPE_EVENT);
</span><del>-                apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;&gt; flite_speak_msg_process speak - end of TTS - %d&quot;, synth_channel-&gt;iId);
</del><ins>+                apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;&gt; flite_speak_msg_process speak - end of TTS - %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">         }
</span><span class="cx">         else
</span><span class="cx">         {
</span><del>-                apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;&gt; flite_speak_msg_process speak - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+                apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;&gt; flite_speak_msg_process speak - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">         }
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="lines">@@ -516,11 +507,13 @@
</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 class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_stop - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_stop - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">         /* store the request, make sure there is no more activity and only then send the response */
</span><span class="cx"> 
</span><del>-        /* TODO this should probably be mutexed */
</del><ins>+        apr_thread_mutex_lock(synth_channel-&gt;channel_guard);
</ins><span class="cx">         synth_channel-&gt;stop_response = response;
</span><ins>+        apr_thread_mutex_unlock(synth_channel-&gt;channel_guard);
+
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -528,7 +521,7 @@
</span><span class="cx"> static apt_bool_t flite_synth_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_pause - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_pause - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">         
</span><span class="cx">         synth_channel-&gt;paused = TRUE;
</span><span class="cx">         /* send asynchronous response */
</span><span class="lines">@@ -540,7 +533,7 @@
</span><span class="cx"> static apt_bool_t flite_synth_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_resume - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_channel_resume - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx"> 
</span><span class="cx">         synth_channel-&gt;paused = FALSE;
</span><span class="cx">         /* send asynchronous response */
</span><span class="lines">@@ -548,61 +541,6 @@
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/** Dispatch MRCP request */
-static apt_bool_t flite_synth_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
-        flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
-        apt_bool_t processed = FALSE;
-        mrcp_message_t *response = mrcp_response_create(request,request-&gt;pool);
-
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_channel_request_dispatch - channel %d&quot;, synth_channel-&gt;iId);
-
-        switch(request-&gt;start_line.method_id) {
-                case SYNTHESIZER_SET_PARAMS:
-                                // TODO set voices
-                                //        if (!strcasecmp(voice_name, &quot;awb&quot;)) {
-                                //                synth_channel-&gt;voice = voices.awb;
-                                //        } else if (!strcasecmp(voice_name, &quot;kal&quot;)) {
-                                //                synth_channel-&gt;voice = voices.awb;
-                                //        } else if (!strcasecmp(voice_name, &quot;rms&quot;)) {
-                                //                synth_channel-&gt;voice = voices.awb;
-                                //        } else if (!strcasecmp(voice_name, &quot;slt&quot;)) {
-                                //                synth_channel-&gt;voice = voices.awb;
-                                //        } else {
-                                //                apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;Valid voice names are awb, kal, rms or slt&quot;);
-                                //        }
-                        break;
-                case SYNTHESIZER_GET_PARAMS:
-                        break;
-                case SYNTHESIZER_SPEAK:
-                        processed = flite_synth_channel_speak(channel,request,response);
-                        break;
-                case SYNTHESIZER_STOP:
-                        processed = flite_synth_channel_stop(channel,request,response);
-                        break;
-                case SYNTHESIZER_PAUSE:
-                        processed = flite_synth_channel_pause(channel,request,response);
-                        break;
-                case SYNTHESIZER_RESUME:
-                        processed = flite_synth_channel_resume(channel,request,response);
-                        break;
-                case SYNTHESIZER_BARGE_IN_OCCURRED:
-                        processed = flite_synth_channel_stop(channel,request,response);
-                        break;
-                case SYNTHESIZER_CONTROL:
-                        break;
-                case SYNTHESIZER_DEFINE_LEXICON:
-                        break;
-                default:
-                        break;
-        }
-        if(processed == FALSE) {
-                /* send asynchronous response for not handled request */
-                mrcp_engine_channel_message_send(channel,response);
-        }
-        return TRUE;
-}
-
</del><span class="cx"> /** Callback is called from MPF engine context to destroy any additional data associated with audio stream */
</span><span class="cx"> static apt_bool_t flite_synth_stream_destroy(mpf_audio_stream_t *stream)
</span><span class="cx"> {
</span><span class="lines">@@ -613,16 +551,16 @@
</span><span class="cx"> /** Callback is called from MPF engine context to perform any action before open */
</span><span class="cx"> static apt_bool_t flite_synth_stream_open(mpf_audio_stream_t *stream)
</span><span class="cx"> {
</span><del>-        flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream-&gt;obj;
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_stream_open - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+//        flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream-&gt;obj;
+//        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_stream_open - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Callback is called from MPF engine context to perform any action after close */
</span><span class="cx"> static apt_bool_t flite_synth_stream_close(mpf_audio_stream_t *stream)
</span><span class="cx"> {
</span><del>-        flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream-&gt;obj;
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_stream_close - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+//        flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream-&gt;obj;
+//        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_stream_close - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -631,7 +569,7 @@
</span><span class="cx"> {
</span><span class="cx">         mrcp_message_t *message = 0;
</span><span class="cx">         mrcp_synth_header_t * synth_header = 0;
</span><del>-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_speak_complete_raise - channel %d&quot;, synth_channel-&gt;iId);
</del><ins>+        apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_speak_complete_raise - channel %d&quot;, synth_channel-&gt;iId);
</ins><span class="cx"> 
</span><span class="cx">         if (!synth_channel-&gt;speak_request) {
</span><span class="cx">                 return FALSE;
</span><span class="lines">@@ -664,7 +602,6 @@
</span><span class="cx"> static apt_bool_t flite_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
</span><span class="cx"> {
</span><span class="cx">         flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) stream-&gt;obj;
</span><del>-        cst_wave * wave = synth_channel-&gt;wave;
</del><span class="cx">         if (synth_channel-&gt;stop_response &amp;&amp; synth_channel-&gt;speak_request)
</span><span class="cx">         {
</span><span class="cx">                 /* send asynchronous response to STOP request */
</span><span class="lines">@@ -674,17 +611,12 @@
</span><span class="cx">                 return TRUE;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (wave &amp;&amp; cst_wave_num_samples(wave)) 
-        {
-                mpf_buffer_audio_write(synth_channel-&gt;audio_buffer, cst_wave_samples(wave), cst_wave_num_samples(wave) * 2);
-        }
-
</del><span class="cx">         /* check if there is active SPEAK request and it isn't in paused state */
</span><span class="cx">         if (synth_channel-&gt;speak_request &amp;&amp; synth_channel-&gt;paused == FALSE) 
</span><span class="cx">         {
</span><span class="cx">                 /* normal processing */
</span><span class="cx">                 mpf_buffer_frame_read(synth_channel-&gt;audio_buffer,frame);
</span><del>-//                apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_stream_read - channel %d - size %d&quot;, synth_channel-&gt;iId, mpf_buffer_get_size(synth_channel-&gt;audio_buffer));
</del><ins>+//                apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, &quot;flite_synth_stream_read - channel %d - size %d&quot;, synth_channel-&gt;iId, mpf_buffer_get_size(synth_channel-&gt;audio_buffer));
</ins><span class="cx"> 
</span><span class="cx">                 if((frame-&gt;type &amp; MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) 
</span><span class="cx">                 {
</span><span class="lines">@@ -692,58 +624,4 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         return TRUE;
</span><del>-}
-
-static apt_bool_t flite_synth_msg_signal(flite_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request)
-{
-        flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) channel-&gt;method_obj;
-        apt_bool_t status = FALSE;
-        flite_synth_engine_t *flite_engine = synth_channel-&gt;flite_engine;
-        apt_task_t *task = apt_consumer_task_base_get(flite_engine-&gt;task);
-        apt_task_msg_t *msg = apt_task_msg_get(task);
-
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_msg_signal - channel %d&quot;, synth_channel-&gt;iId);
-        
-        if (msg) {
-                flite_synth_msg_t *flite_msg;
-                msg-&gt;type = TASK_MSG_USER;
-                flite_msg = (flite_synth_msg_t*) msg-&gt;data;
-
-                flite_msg-&gt;type = type;
-                flite_msg-&gt;channel = channel;
-                flite_msg-&gt;request = request;
-                status = apt_task_msg_signal(task,msg);
-        }
-        else
-        {
-                apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_msg_signal - task msg not found %d&quot;, synth_channel-&gt;iId);
-        }
-        return status;
-}
-
-static apt_bool_t flite_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg)
-{
-        flite_synth_msg_t *flite_msg = (flite_synth_msg_t*)msg-&gt;data;
-        flite_synth_channel_t *synth_channel = (flite_synth_channel_t *) flite_msg-&gt;channel-&gt;method_obj;
-
-        apt_log(APT_LOG_MARK, APT_PRIO_INFO, &quot;flite_synth_msg_process - channel %d&quot;, synth_channel-&gt;iId);
-
-        switch(flite_msg-&gt;type) {
-                case flite_synth_MSG_OPEN_CHANNEL:
-                        /* open channel and send asynch response */
-                        flite_synth_channel_open_t(flite_msg-&gt;channel);
-                        mrcp_engine_channel_open_respond(flite_msg-&gt;channel,TRUE);
-                        break;
-                case flite_synth_MSG_CLOSE_CHANNEL:
-                        /* close channel, make sure there is no activity and send asynch response */
-                        flite_synth_channel_close_t(flite_msg-&gt;channel);
-                        mrcp_engine_channel_close_respond(flite_msg-&gt;channel);
-                        break;
-                case flite_synth_MSG_REQUEST_PROCESS:
-                        flite_synth_channel_request_dispatch(flite_msg-&gt;channel,flite_msg-&gt;request);
-                        break;
-                default:
-                        break;
-        }
-        return TRUE;
-}
</del><ins>+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcppluginsmrcppocketsphinxMakefileam"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/Makefile.am        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -15,6 +15,15 @@
</span><span class="cx"> 
</span><span class="cx"> plugin_LTLIBRARIES          = mrcppocketsphinx.la
</span><span class="cx"> 
</span><del>-mrcppocketsphinx_la_SOURCES = src/mrcp_pocketsphinx.c
</del><ins>+mrcppocketsphinx_la_SOURCES = src/mrcp_pocketsphinx.c \
+                              src/pocketsphinx_properties.c
</ins><span class="cx"> mrcppocketsphinx_la_LDFLAGS = -module $(PLUGIN_LT_VERSION)
</span><span class="cx"> mrcppocketsphinx_la_LIBADD  = $(UNIMRCP_POCKETSPHINX_LIBS) $(UNIMRCP_SPHINXBASE_LIBS) -lm
</span><ins>+
+
+install-data-local:
+        test -d $(confdir) || $(mkinstalldirs) $(confdir)
+        test -f $(confdir)/pocketsphinx.xml || $(INSTALL) -m 644 conf/pocketsphinx.xml $(confdir)
+        test -d $(datadir)/wsj1 || $(mkinstalldirs) $(datadir)/wsj1; \
+                        $(INSTALL) -m 644 $(UNIMRCP_POCKETSPHINX_MODELS)/hmm/wsj1/* $(datadir)/wsj1; \
+                        $(INSTALL) -m 644 $(UNIMRCP_POCKETSPHINX_MODELS)/lm/cmudict.0.6d $(datadir)/default.dic
</ins></span></pre></div>
<a id="freeswitchtrunklibsunimrcppluginsmrcppocketsphinxconfpocketsphinxxml"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml (0 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml                                (rev 0)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/conf/pocketsphinx.xml        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;!-- PocketSphinx Document --&gt;
+&lt;pocketsphinx&gt;
+  &lt;!-- Senstitivity level and timeout are used for voice activity (speech) detection 
+       reasonable values: level is in [2..250] range, timeout is in [100..500] msec range
+  --&gt;
+  &lt;sensitivity level=&quot;50&quot; timeout=&quot;300&quot;/&gt;
+
+  &lt;!-- Default values for noinput and recognition timeout,
+       these values can be overriden by client's requests
+  --&gt;
+  &lt;timers noinput-timeout=&quot;10000&quot; recognition-timeout=&quot;15000&quot;/&gt;
+
+
+  &lt;!-- PocketSphinx related model and dictionary data.
+       Default dir (dir=&quot;&quot;) is InstallDir/data
+  --&gt;
+  &lt;model dir=&quot;&quot; narrowband=&quot;communicator&quot; wideband=&quot;wsj1&quot; dictionary=&quot;default.dic&quot; preferred=&quot;narrowband&quot;/&gt;
+  &lt;!-- &lt;model dir=&quot;/usr/local/freeswitch/grammar&quot; narrowband=&quot;model/communicator&quot; wideband=&quot;model/wsj1&quot; dictionary=&quot;default.dic&quot;/&gt; --&gt;
+
+  &lt;!-- Enable to save utterance.
+       Default dir (dir=&quot;&quot;) is InstallDir/data
+  --&gt;
+  &lt;save-waveform dir=&quot;&quot; enable=&quot;0&quot;/&gt;
+&lt;/pocketsphinx&gt;
</ins></span></pre></div>
<a id="freeswitchtrunklibsunimrcppluginsmrcppocketsphinxincludepocketsphinx_propertiesh"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h (0 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h                                (rev 0)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/include/pocketsphinx_properties.h        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -0,0 +1,64 @@
</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 __POCKETSPHINX_PROPERTIES_H__
+#define __POCKETSPHINX_PROPERTIES_H__
+
+/**
+ * @file pocketsphinx_properties.h
+ * @brief PocketSphinx Properties
+ */ 
+
+#include &quot;apt_dir_layout.h&quot;
+
+APT_BEGIN_EXTERN_C
+
+typedef enum {
+        POCKETSPHINX_MODEL_NARROWBAND,
+        POCKETSPHINX_MODEL_WIDEBAND
+
+} pocketsphinx_model_e;
+
+/** Declaration of pocketsphinx properties */
+typedef struct pocketsphinx_properties_t pocketsphinx_properties_t;
+
+/** Pocketsphinx properties */
+struct pocketsphinx_properties_t {
+        const char          *data_dir;
+        const char          *dictionary;
+        const char          *model_8k;
+        const char          *model_16k;
+        pocketsphinx_model_e preferred_model;
+
+        apr_size_t           sensitivity_level;
+        apr_size_t           sensitivity_timeout;
+
+        apr_size_t           no_input_timeout;
+        apr_size_t           recognition_timeout;
+        apr_size_t           partial_result_timeout;
+
+        apt_bool_t           save_waveform;
+        const char          *save_waveform_dir;
+};
+
+apt_bool_t pocketsphinx_properties_load(pocketsphinx_properties_t *properties, 
+                                                                                const char *file_path, 
+                                                                                const apt_dir_layout_t *dir_layout,
+                                                                                apr_pool_t *pool);
+
+APT_END_EXTERN_C
+
+#endif /*__POCKETSPHINX_PROPERTIES_H__*/
</ins></span></pre></div>
<a id="freeswitchtrunklibsunimrcppluginsmrcppocketsphinxmrcppocketsphinxvcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/mrcppocketsphinx.vcproj        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -149,6 +149,10 @@
</span><span class="cx">                         Filter=&quot;h;hpp;hxx;hm;inl;inc;xsd&quot;
</span><span class="cx">                         UniqueIdentifier=&quot;{93995380-89BD-4b04-88EB-625FBE52EBFB}&quot;
</span><span class="cx">                         &gt;
</span><ins>+                        &lt;File
+                                RelativePath=&quot;.\include\pocketsphinx_properties.h&quot;
+                                &gt;
+                        &lt;/File&gt;
</ins><span class="cx">                 &lt;/Filter&gt;
</span><span class="cx">                 &lt;Filter
</span><span class="cx">                         Name=&quot;src&quot;
</span><span class="lines">@@ -158,6 +162,10 @@
</span><span class="cx">                                 RelativePath=&quot;.\src\mrcp_pocketsphinx.c&quot;
</span><span class="cx">                                 &gt;
</span><span class="cx">                         &lt;/File&gt;
</span><ins>+                        &lt;File
+                                RelativePath=&quot;.\src\pocketsphinx_properties.c&quot;
+                                &gt;
+                        &lt;/File&gt;
</ins><span class="cx">                 &lt;/Filter&gt;
</span><span class="cx">         &lt;/Files&gt;
</span><span class="cx">         &lt;Globals&gt;
</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 (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/mrcp_pocketsphinx.c        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -35,14 +35,15 @@
</span><span class="cx"> #include &quot;mrcp_generic_header.h&quot;
</span><span class="cx"> #include &quot;mrcp_message.h&quot;
</span><span class="cx"> #include &quot;mpf_activity_detector.h&quot;
</span><ins>+#include &quot;pocketsphinx_properties.h&quot;
</ins><span class="cx"> #include &quot;apt_log.h&quot;
</span><span class="cx"> 
</span><ins>+#define POCKETSPHINX_CONFFILE_NAME &quot;pocketsphinx.xml&quot;
</ins><span class="cx"> 
</span><span class="cx"> #define RECOGNIZER_SIDRES(recognizer) (recognizer)-&gt;channel-&gt;id.buf, &quot;pocketsphinx&quot;
</span><span class="cx"> 
</span><span class="cx"> typedef struct pocketsphinx_engine_t pocketsphinx_engine_t;
</span><span class="cx"> typedef struct pocketsphinx_recognizer_t pocketsphinx_recognizer_t;
</span><del>-typedef struct pocketsphinx_properties_t pocketsphinx_properties_t;
</del><span class="cx"> 
</span><span class="cx"> /** Methods of recognition engine */
</span><span class="cx"> static apt_bool_t pocketsphinx_engine_destroy(mrcp_resource_engine_t *engine);
</span><span class="lines">@@ -86,23 +87,14 @@
</span><span class="cx"> 
</span><span class="cx"> /** Pocketsphinx engine (engine is an aggregation of recognizers) */
</span><span class="cx"> struct pocketsphinx_engine_t {
</span><del>-        mrcp_resource_engine_t *base;
</del><ins>+        /* Resource engine base */
+        mrcp_resource_engine_t   *base;
+        /** Properties loaded from config file */
+        pocketsphinx_properties_t properties;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-/** Pocketsphinx properties */
-struct pocketsphinx_properties_t {
-        const char *dictionary;
-        const char *model_8k;
-        const char *model_16k;
-        apr_size_t  noinput_timeout;
-        apr_size_t  recognition_timeout;
-        apr_size_t  partial_result_timeout;
-};
-
</del><span class="cx"> /** Pocketsphinx channel (recognizer) */
</span><span class="cx"> struct pocketsphinx_recognizer_t {
</span><del>-        /** Back pointer to engine */
-        pocketsphinx_engine_t    *engine;
</del><span class="cx">         /** Engine channel base */
</span><span class="cx">         mrcp_engine_channel_t    *channel;
</span><span class="cx"> 
</span><span class="lines">@@ -110,12 +102,12 @@
</span><span class="cx">         ps_decoder_t             *decoder;
</span><span class="cx">         /** Configuration */
</span><span class="cx">         cmd_ln_t                 *config;
</span><del>-        /** Properties (to be loaded from config file) */
</del><ins>+        /** Recognizer properties coppied from defualt engine properties */
</ins><span class="cx">         pocketsphinx_properties_t properties;
</span><span class="cx">         /** Is input timer started */
</span><span class="cx">         apt_bool_t                is_input_timer_on;
</span><span class="cx">         /** Noinput timeout */
</span><del>-        apr_size_t                noinput_timeout;
</del><ins>+        apr_size_t                no_input_timeout;
</ins><span class="cx">         /** Recognition timeout */
</span><span class="cx">         apr_size_t                recognition_timeout;
</span><span class="cx">         /** Timeout elapsed since the last partial result checking */
</span><span class="lines">@@ -126,6 +118,8 @@
</span><span class="cx">         const char               *grammar_id;
</span><span class="cx">         /** Table of defined grammars (key=content-id, value=grammar-file-path) */
</span><span class="cx">         apr_table_t              *grammar_table;
</span><ins>+        /** File to write waveform to if save_waveform is on */
+        apr_file_t               *waveform;
</ins><span class="cx"> 
</span><span class="cx">         /** Voice activity detector */
</span><span class="cx">         mpf_activity_detector_t  *detector;
</span><span class="lines">@@ -170,33 +164,42 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Destroy pocketsphinx engine */
</span><del>-static apt_bool_t pocketsphinx_engine_destroy(mrcp_resource_engine_t *engine)
</del><ins>+static apt_bool_t pocketsphinx_engine_destroy(mrcp_resource_engine_t *resource_engine)
</ins><span class="cx"> {
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Open pocketsphinx engine */
</span><del>-static apt_bool_t pocketsphinx_engine_open(mrcp_resource_engine_t *engine)
</del><ins>+static apt_bool_t pocketsphinx_engine_open(mrcp_resource_engine_t *resource_engine)
</ins><span class="cx"> {
</span><ins>+        pocketsphinx_engine_t *engine = resource_engine-&gt;obj;
+        const apt_dir_layout_t *dir_layout = resource_engine-&gt;dir_layout;
+
+        char *file_path = NULL;
+        apr_filepath_merge(&amp;file_path,dir_layout-&gt;conf_dir_path,POCKETSPHINX_CONFFILE_NAME,0,resource_engine-&gt;pool);
+
+        /* load properties */
+        pocketsphinx_properties_load(&amp;engine-&gt;properties,file_path,dir_layout,resource_engine-&gt;pool);
</ins><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Close pocketsphinx engine */
</span><del>-static apt_bool_t pocketsphinx_engine_close(mrcp_resource_engine_t *engine)
</del><ins>+static apt_bool_t pocketsphinx_engine_close(mrcp_resource_engine_t *resource_engine)
</ins><span class="cx"> {
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /** Create pocketsphinx recognizer */
</span><del>-static mrcp_engine_channel_t* pocketsphinx_engine_recognizer_create(mrcp_resource_engine_t *engine, apr_pool_t *pool)
</del><ins>+static mrcp_engine_channel_t* pocketsphinx_engine_recognizer_create(mrcp_resource_engine_t *resource_engine, apr_pool_t *pool)
</ins><span class="cx"> {
</span><span class="cx">         mrcp_engine_channel_t *channel;
</span><ins>+        mpf_codec_descriptor_t *codec_descriptor;
+        pocketsphinx_engine_t *engine = resource_engine-&gt;obj;
</ins><span class="cx">         pocketsphinx_recognizer_t *recognizer = apr_palloc(pool,sizeof(pocketsphinx_recognizer_t));
</span><del>-//        recognizer-&gt;engine = engine;
</del><span class="cx">         recognizer-&gt;decoder = NULL;
</span><span class="cx">         recognizer-&gt;config = NULL;
</span><span class="cx">         recognizer-&gt;is_input_timer_on = FALSE;
</span><del>-        recognizer-&gt;noinput_timeout = 0;
</del><ins>+        recognizer-&gt;no_input_timeout = 0;
</ins><span class="cx">         recognizer-&gt;recognition_timeout = 0;
</span><span class="cx">         recognizer-&gt;partial_result_timeout = 0;
</span><span class="cx">         recognizer-&gt;last_result = NULL;
</span><span class="lines">@@ -211,10 +214,24 @@
</span><span class="cx">         recognizer-&gt;close_requested = FALSE;
</span><span class="cx">         recognizer-&gt;grammar_id = NULL;
</span><span class="cx">         recognizer-&gt;grammar_table = apr_table_make(pool,1);
</span><del>-        
</del><ins>+        recognizer-&gt;waveform = NULL;
+
+        /* copy default properties loaded from config */
+        recognizer-&gt;properties = engine-&gt;properties;
+
+        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 = 8000;
+        if(recognizer-&gt;properties.preferred_model == POCKETSPHINX_MODEL_WIDEBAND) {
+                codec_descriptor-&gt;sampling_rate = 16000;
+        }
+
</ins><span class="cx">         /* create engine channel base */
</span><span class="cx">         channel = mrcp_engine_sink_channel_create(
</span><del>-                        engine,               /* resource engine */
</del><ins>+                        resource_engine,      /* resource engine */
</ins><span class="cx">                         &amp;channel_vtable,      /* virtual methods table of engine channel */
</span><span class="cx">                         &amp;audio_stream_vtable, /* virtual methods table of audio stream */
</span><span class="cx">                         recognizer,           /* object to associate */
</span><span class="lines">@@ -295,33 +312,23 @@
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-
-
-/** Load pocketsphinx properties [RECOG] */
-static apt_bool_t pocketsphinx_properties_load(pocketsphinx_recognizer_t *recognizer)
-{
-        mrcp_engine_channel_t *channel = recognizer-&gt;channel;
-        const apt_dir_layout_t *dir_layout = channel-&gt;engine-&gt;dir_layout;
-        pocketsphinx_properties_t *properties = &amp;recognizer-&gt;properties;
-
-        properties-&gt;dictionary = apt_datadir_filepath_get(dir_layout,&quot;pocketsphinx/default.dic&quot;,channel-&gt;pool);
-        properties-&gt;model_8k = apt_datadir_filepath_get(dir_layout,&quot;pocketsphinx/communicator&quot;,channel-&gt;pool);
-        properties-&gt;model_16k = apt_datadir_filepath_get(dir_layout,&quot;pocketsphinx/wsj1&quot;,channel-&gt;pool);
-
-        properties-&gt;noinput_timeout = 5000;
-        properties-&gt;recognition_timeout = 15000;
-        properties-&gt;partial_result_timeout = 100;
-
-        return TRUE;
-}
-
</del><span class="cx"> /** Initialize pocketsphinx decoder [RECOG] */
</span><span class="cx"> static apt_bool_t pocketsphinx_decoder_init(pocketsphinx_recognizer_t *recognizer, const char *grammar)
</span><span class="cx"> {
</span><del>-        apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,&quot;Init Config &quot;APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
</del><ins>+        const char *model = recognizer-&gt;properties.model_8k;
+        const char *rate = &quot;8000&quot;;
+        if(recognizer-&gt;properties.preferred_model == POCKETSPHINX_MODEL_WIDEBAND) {
+                model = recognizer-&gt;properties.model_16k;
+                rate = &quot;16000&quot;;
+        }
+
+        apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,&quot;Init Config rate [%s] dictionary [%s] &quot;APT_SIDRES_FMT,
+                rate,
+                recognizer-&gt;properties.dictionary,
+                RECOGNIZER_SIDRES(recognizer));
</ins><span class="cx">         recognizer-&gt;config = cmd_ln_init(recognizer-&gt;config, ps_args(), FALSE,
</span><del>-                                                         &quot;-samprate&quot;, &quot;8000&quot;,
-                                                         &quot;-hmm&quot;, recognizer-&gt;properties.model_8k,
</del><ins>+                                                         &quot;-samprate&quot;, rate,
+                                                         &quot;-hmm&quot;, model,
</ins><span class="cx">                                                          &quot;-jsgf&quot;, grammar,
</span><span class="cx">                                                          &quot;-dict&quot;, recognizer-&gt;properties.dictionary,
</span><span class="cx">                                                          &quot;-frate&quot;, &quot;50&quot;,
</span><span class="lines">@@ -469,7 +476,7 @@
</span><span class="cx">                         return FALSE;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                grammar_file_name = apr_psprintf(channel-&gt;pool,&quot;pocketsphinx/%s-%s.gram&quot;,channel-&gt;id.buf,content_id);
</del><ins>+                grammar_file_name = apr_psprintf(channel-&gt;pool,&quot;%s-%s.gram&quot;,channel-&gt;id.buf,content_id);
</ins><span class="cx">                 grammar_file_path = apt_datadir_filepath_get(dir_layout,grammar_file_name,channel-&gt;pool);
</span><span class="cx"> 
</span><span class="cx">                 apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Create Grammar File [%s] &quot;APT_SIDRES_FMT,
</span><span class="lines">@@ -519,6 +526,7 @@
</span><span class="cx"> /** Process RECOGNIZE request [RECOG] */
</span><span class="cx"> static apt_bool_t pocketsphinx_recognize(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
</span><span class="cx"> {
</span><ins>+        mrcp_engine_channel_t *channel = recognizer-&gt;channel;
</ins><span class="cx">         mrcp_recog_header_t *request_recog_header;
</span><span class="cx">         mrcp_recog_header_t *response_recog_header = mrcp_resource_header_prepare(response);
</span><span class="cx">         if(!response_recog_header) {
</span><span class="lines">@@ -541,16 +549,43 @@
</span><span class="cx">                 if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_START_INPUT_TIMERS) == TRUE) {
</span><span class="cx">                         recognizer-&gt;is_input_timer_on = request_recog_header-&gt;start_input_timers;
</span><span class="cx">                 }
</span><ins>+                if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT) == TRUE) {
+                        recognizer-&gt;properties.no_input_timeout = request_recog_header-&gt;no_input_timeout;
+                }
+                if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT) == TRUE) {
+                        recognizer-&gt;properties.recognition_timeout = request_recog_header-&gt;recognition_timeout;
+                }
+                if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_SAVE_WAVEFORM) == TRUE) {
+                        recognizer-&gt;properties.save_waveform = request_recog_header-&gt;save_waveform;
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        /* check if waveform (utterance) should be saved */
+        if(recognizer-&gt;properties.save_waveform == TRUE) {
+                apr_status_t rv;
+                const char *waveform_file_name = apr_psprintf(channel-&gt;pool,&quot;utter-%s-%d.pcm&quot;,
+                        channel-&gt;id.buf,request-&gt;start_line.request_id);
+                char *waveform_file_path = NULL;
+                apr_filepath_merge(&amp;waveform_file_path,recognizer-&gt;properties.save_waveform_dir,
+                        waveform_file_name,0,channel-&gt;pool);
+
+                apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Open Waveform File [%s] &quot;APT_SIDRES_FMT,
+                        waveform_file_path,RECOGNIZER_SIDRES(recognizer));
+                rv = apr_file_open(&amp;recognizer-&gt;waveform,waveform_file_path,APR_CREATE|APR_TRUNCATE|APR_WRITE|APR_BINARY,
+                        APR_OS_DEFAULT,channel-&gt;pool);
+                if(rv != APR_SUCCESS) {
+                        apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Cannot Open Waveform File to Write [%s] &quot;APT_SIDRES_FMT,
+                                waveform_file_path,RECOGNIZER_SIDRES(recognizer));
+                }
+        }
+
</ins><span class="cx">         response-&gt;start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
</span><span class="cx">         /* send asynchronous response */
</span><del>-        mrcp_engine_channel_message_send(recognizer-&gt;channel,response);
</del><ins>+        mrcp_engine_channel_message_send(channel,response);
</ins><span class="cx"> 
</span><del>-
</del><span class="cx">         /* reset */
</span><span class="cx">         mpf_activity_detector_reset(recognizer-&gt;detector);
</span><del>-        recognizer-&gt;noinput_timeout = 0;
</del><ins>+        recognizer-&gt;no_input_timeout = 0;
</ins><span class="cx">         recognizer-&gt;recognition_timeout = 0;
</span><span class="cx">         recognizer-&gt;partial_result_timeout = 0;
</span><span class="cx">         recognizer-&gt;last_result = NULL;
</span><span class="lines">@@ -560,7 +595,7 @@
</span><span class="cx">         return TRUE;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/** Process GET-RESULTS request [RECOG] */
</del><ins>+/** Process GET-RESULT request [RECOG] */
</ins><span class="cx"> static apt_bool_t pocketsphinx_get_result(pocketsphinx_recognizer_t *recognizer, mrcp_message_t *request, mrcp_message_t *response)
</span><span class="cx"> {
</span><span class="cx">         if(pocketsphinx_result_build(recognizer,response) != TRUE) {
</span><span class="lines">@@ -609,6 +644,11 @@
</span><span class="cx">         recognizer-&gt;inprogress_recog = NULL;
</span><span class="cx">         ps_end_utt(recognizer-&gt;decoder);
</span><span class="cx"> 
</span><ins>+        if(recognizer-&gt;waveform) {
+                apr_file_close(recognizer-&gt;waveform);
+                recognizer-&gt;waveform = NULL;
+        }
+
</ins><span class="cx">         if(recognizer-&gt;stop_response) {
</span><span class="cx">                 /* recognition has been stopped, send STOP response instead */
</span><span class="cx">                 mrcp_message_t *response = recognizer-&gt;stop_response;
</span><span class="lines">@@ -690,13 +730,10 @@
</span><span class="cx"> static void* APR_THREAD_FUNC pocketsphinx_recognizer_run(apr_thread_t *thread, void *data)
</span><span class="cx"> {
</span><span class="cx">         pocketsphinx_recognizer_t *recognizer = data;
</span><del>-        apt_bool_t status;
</del><span class="cx"> 
</span><span class="cx">         apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Run Recognition Thread &quot;APT_SIDRES_FMT, RECOGNIZER_SIDRES(recognizer));
</span><del>-        status = pocketsphinx_properties_load(recognizer);
-
</del><span class="cx">         /** Send response to channel_open request */
</span><del>-        mrcp_engine_channel_open_respond(recognizer-&gt;channel,status);
</del><ins>+        mrcp_engine_channel_open_respond(recognizer-&gt;channel,TRUE);
</ins><span class="cx"> 
</span><span class="cx">         do {
</span><span class="cx">                 /** Wait for MRCP requests */
</span><span class="lines">@@ -760,7 +797,7 @@
</span><span class="cx"> 
</span><span class="cx">         /* set request state */
</span><span class="cx">         message-&gt;start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS;
</span><del>-        /* send asynch event */
</del><ins>+        /* send asynchronous event */
</ins><span class="cx">         return mrcp_engine_channel_message_send(recognizer-&gt;channel,message);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -811,6 +848,12 @@
</span><span class="cx">                         return TRUE;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><ins>+                if(recognizer-&gt;waveform) {
+                        /* write utterance to file */
+                        apr_size_t size = frame-&gt;codec_frame.size;
+                        apr_file_write(recognizer-&gt;waveform,frame-&gt;codec_frame.buffer,&amp;size);
+                }
+
</ins><span class="cx">                 if(ps_process_raw(
</span><span class="cx">                                         recognizer-&gt;decoder, 
</span><span class="cx">                                         (const int16 *)frame-&gt;codec_frame.buffer, 
</span><span class="lines">@@ -835,13 +878,18 @@
</span><span class="cx">                                         recognizer-&gt;last_result = apr_pstrdup(recognizer-&gt;channel-&gt;pool,hyp);
</span><span class="cx">                                         apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Get Recognition Partial Result [%s] Score [%d] &quot;APT_SIDRES_FMT,
</span><span class="cx">                                                 hyp,score,RECOGNIZER_SIDRES(recognizer));
</span><ins>+
+                                        /* reset input timer as we have partial match now */
+                                        if(score != 0 &amp;&amp; recognizer-&gt;is_input_timer_on) {
+                                                recognizer-&gt;is_input_timer_on = FALSE;
+                                        }
</ins><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if(recognizer-&gt;is_input_timer_on) {
</span><del>-                        recognizer-&gt;noinput_timeout += CODEC_FRAME_TIME_BASE;
-                        if(recognizer-&gt;noinput_timeout == recognizer-&gt;properties.noinput_timeout) {
</del><ins>+                        recognizer-&gt;no_input_timeout += CODEC_FRAME_TIME_BASE;
+                        if(recognizer-&gt;no_input_timeout == recognizer-&gt;properties.no_input_timeout) {
</ins><span class="cx">                                 apt_log(APT_LOG_MARK,APT_PRIO_INFO,&quot;Noinput Timeout Elapsed &quot;APT_SIDRES_FMT,
</span><span class="cx">                                                 RECOGNIZER_SIDRES(recognizer));
</span><span class="cx">                                 pocketsphinx_end_of_input(recognizer,RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT);
</span></span></pre></div>
<a id="freeswitchtrunklibsunimrcppluginsmrcppocketsphinxsrcpocketsphinx_propertiesc"></a>
<div class="addfile"><h4>Added: freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c (0 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c                                (rev 0)
+++ freeswitch/trunk/libs/unimrcp/plugins/mrcp-pocketsphinx/src/pocketsphinx_properties.c        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -0,0 +1,209 @@
</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 &lt;apr_xml.h&gt;
+#include &quot;pocketsphinx_properties.h&quot;
+#include &quot;apt_log.h&quot;
+
+static const apr_xml_elem* pocketsphinx_document_load(const char *file_path, apr_pool_t *pool)
+{
+        apr_xml_parser *parser = NULL;
+        apr_xml_doc *doc = NULL;
+        const apr_xml_elem *root;
+        apr_file_t *fd = NULL;
+        apr_status_t rv;
+
+        apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,&quot;Open PocketSphinx Config File [%s]&quot;,file_path);
+        rv = apr_file_open(&amp;fd,file_path,APR_READ|APR_BINARY,0,pool);
+        if(rv != APR_SUCCESS) {
+                apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Failed to Open PocketSphinx Config File [%s]&quot;,file_path);
+                return FALSE;
+        }
+
+        rv = apr_xml_parse_file(pool,&amp;parser,&amp;doc,fd,2000);
+        if(rv != APR_SUCCESS) {
+                apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Failed to Parse PocketSphinx Config File [%s]&quot;,file_path);
+                apr_file_close(fd);
+                return FALSE;
+        }
+
+        root = doc-&gt;root;
+        if(!root || strcasecmp(root-&gt;name,&quot;pocketsphinx&quot;) != 0) {
+                apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Unknown Document &lt;%s&gt;&quot;,root-&gt;name);
+                apr_file_close(fd);
+                return FALSE;
+        }
+
+        apr_file_close(fd);
+        return root;
+}
+
+static apt_bool_t sensitivity_properties_load(pocketsphinx_properties_t *properties, const apr_xml_elem *elem, apr_pool_t *pool)
+{
+        const apr_xml_attr *attr;
+        for(attr = elem-&gt;attr; attr; attr = attr-&gt;next) {
+                if(strcasecmp(attr-&gt;name,&quot;level&quot;) == 0) {
+                        properties-&gt;sensitivity_level = atol(attr-&gt;value);
+                }
+                else if(strcasecmp(attr-&gt;name,&quot;timeout&quot;) == 0) {
+                        properties-&gt;sensitivity_timeout = atol(attr-&gt;value);
+                }
+                else {
+                        apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Unknown Attribute &lt;%s&gt;&quot;,attr-&gt;name);
+                }
+        }
+        return TRUE;
+}
+
+static apt_bool_t timer_properties_load(pocketsphinx_properties_t *properties, const apr_xml_elem *elem, apr_pool_t *pool)
+{
+        const apr_xml_attr *attr;
+        for(attr = elem-&gt;attr; attr; attr = attr-&gt;next) {
+                if(strcasecmp(attr-&gt;name,&quot;noinput-timeout&quot;) == 0) {
+                        properties-&gt;no_input_timeout = atol(attr-&gt;value);
+                }
+                else if(strcasecmp(attr-&gt;name,&quot;recognition-timeout&quot;) == 0) {
+                        properties-&gt;recognition_timeout = atol(attr-&gt;value);
+                }
+                else {
+                        apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Unknown Attribute &lt;%s&gt;&quot;,attr-&gt;name);
+                }
+        }
+        return TRUE;
+}
+
+static apt_bool_t model_properties_load(pocketsphinx_properties_t *properties, const apr_xml_elem *elem, apr_pool_t *pool)
+{
+        const apr_xml_attr *attr;
+        for(attr = elem-&gt;attr; attr; attr = attr-&gt;next) {
+                if(strcasecmp(attr-&gt;name,&quot;dir&quot;) == 0) {
+                        properties-&gt;data_dir = apr_pstrdup(pool,attr-&gt;value);
+                }
+                else if(strcasecmp(attr-&gt;name,&quot;narrowband&quot;) == 0) {
+                        properties-&gt;model_8k = apr_pstrdup(pool,attr-&gt;value);
+                }
+                else if(strcasecmp(attr-&gt;name,&quot;wideband&quot;) == 0) {
+                        properties-&gt;model_16k = apr_pstrdup(pool,attr-&gt;value);
+                }
+                else if(strcasecmp(attr-&gt;name,&quot;dictionary&quot;) == 0) {
+                        properties-&gt;dictionary = apr_pstrdup(pool,attr-&gt;value);
+                }
+                else if(strcasecmp(attr-&gt;name,&quot;preferred&quot;) == 0) {
+                        if(strcasecmp(attr-&gt;value,&quot;narrowband&quot;) == 0) {
+                                properties-&gt;preferred_model = POCKETSPHINX_MODEL_NARROWBAND;
+                        }
+                        else if(strcasecmp(attr-&gt;value,&quot;wideband&quot;) == 0) {
+                                properties-&gt;preferred_model = POCKETSPHINX_MODEL_WIDEBAND;
+                        }
+                }
+                else {
+                        apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Unknown Attribute &lt;%s&gt;&quot;,attr-&gt;name);
+                }
+        }
+        return TRUE;
+}
+
+static apt_bool_t save_waveform_properties_load(pocketsphinx_properties_t *properties, const apr_xml_elem *elem, apr_pool_t *pool)
+{
+        const apr_xml_attr *attr;
+        for(attr = elem-&gt;attr; attr; attr = attr-&gt;next) {
+                if(strcasecmp(attr-&gt;name,&quot;dir&quot;) == 0) {
+                        properties-&gt;save_waveform_dir = apr_pstrdup(pool,attr-&gt;value);
+                }
+                else if(strcasecmp(attr-&gt;name,&quot;enable&quot;) == 0) {
+                        properties-&gt;save_waveform = atoi(attr-&gt;value);
+                }
+                else {
+                        apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Unknown Attribute &lt;%s&gt;&quot;,attr-&gt;name);
+                }
+        }
+        return TRUE;
+}
+
+apt_bool_t pocketsphinx_properties_load(pocketsphinx_properties_t *properties, 
+                                                                                const char *file_path, 
+                                                                                const apt_dir_layout_t *dir_layout, 
+                                                                                apr_pool_t *pool)
+{
+        const apr_xml_elem *elem;
+        const apr_xml_elem *root;
+        char *path = NULL;
+
+        /* reset or set default properties */
+        properties-&gt;data_dir = NULL;
+        properties-&gt;dictionary = NULL;
+        properties-&gt;model_8k = NULL;
+        properties-&gt;model_16k = NULL;
+        properties-&gt;preferred_model = POCKETSPHINX_MODEL_NARROWBAND;
+
+        properties-&gt;no_input_timeout = 10000;
+        properties-&gt;recognition_timeout = 15000;
+        properties-&gt;partial_result_timeout = 100;
+
+        properties-&gt;save_waveform = TRUE;
+        properties-&gt;save_waveform_dir = NULL;
+
+        root = pocketsphinx_document_load(file_path,pool);
+        if(root) {
+                for(elem = root-&gt;first_child; elem; elem = elem-&gt;next) {
+                        if(strcasecmp(elem-&gt;name,&quot;sensitivity&quot;) == 0) {
+                                sensitivity_properties_load(properties,elem,pool);
+                        }
+                        else if(strcasecmp(elem-&gt;name,&quot;timers&quot;) == 0) {
+                                timer_properties_load(properties,elem,pool);
+                        }
+                        else if(strcasecmp(elem-&gt;name,&quot;model&quot;) == 0) {
+                                model_properties_load(properties,elem,pool);
+                        }
+                        else if(strcasecmp(elem-&gt;name,&quot;save-waveform&quot;) == 0) {
+                                save_waveform_properties_load(properties,elem,pool);
+                        }
+                        else {
+                                apt_log(APT_LOG_MARK,APT_PRIO_WARNING,&quot;Unknown Element &lt;%s&gt;&quot;,elem-&gt;name);
+                        }
+                }
+        }
+
+        /* verify loaded properties */
+        if(!properties-&gt;data_dir || *properties-&gt;data_dir == '\0') {
+                properties-&gt;data_dir = dir_layout-&gt;data_dir_path;
+        }
+        if(!properties-&gt;save_waveform_dir || *properties-&gt;save_waveform_dir == '\0') {
+                properties-&gt;save_waveform_dir = dir_layout-&gt;data_dir_path;
+        }
+
+        if(!properties-&gt;dictionary) {
+                properties-&gt;dictionary = &quot;default.dic&quot;;
+        }
+        if(!properties-&gt;model_8k) {
+                properties-&gt;model_8k = &quot;communicator&quot;;
+        }
+        if(!properties-&gt;model_16k) {
+                properties-&gt;model_16k = &quot;wsj1&quot;;
+        }
+
+        if(apr_filepath_merge(&amp;path,properties-&gt;data_dir,properties-&gt;dictionary,0,pool) == APR_SUCCESS) {
+                properties-&gt;dictionary = path;
+        }
+        if(apr_filepath_merge(&amp;path,properties-&gt;data_dir,properties-&gt;model_8k,0,pool) == APR_SUCCESS) {
+                properties-&gt;model_8k = path;
+        }
+        if(apr_filepath_merge(&amp;path,properties-&gt;data_dir,properties-&gt;model_16k,0,pool) == APR_SUCCESS) {
+                properties-&gt;model_16k = path;
+        }
+
+        return TRUE;
+}
</ins></span></pre></div>
<a id="freeswitchtrunklibsunimrcpunimrcpsln"></a>
<div class="modfile"><h4>Modified: freeswitch/trunk/libs/unimrcp/unimrcp.sln (14103 => 14104)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/trunk/libs/unimrcp/unimrcp.sln        2009-07-02 00:24:29 UTC (rev 14103)
+++ freeswitch/trunk/libs/unimrcp/unimrcp.sln        2009-07-02 00:54:48 UTC (rev 14104)
</span><span class="lines">@@ -148,6 +148,8 @@
</span><span class="cx">                 {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}
</span><span class="cx">         EndProjectSection
</span><span class="cx"> EndProject
</span><ins>+Project(&quot;{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}&quot;) = &quot;preparesphinx&quot;, &quot;build\tools\preparesphinx.vcproj&quot;, &quot;{71D62A04-8EF6-4C6B-AC12-0C15A875E53A}&quot;
+EndProject
</ins><span class="cx"> Global
</span><span class="cx">         GlobalSection(SolutionConfigurationPlatforms) = preSolution
</span><span class="cx">                 Debug|Win32 = Debug|Win32
</span><span class="lines">@@ -252,6 +254,8 @@
</span><span class="cx">                 {3C614AE8-B611-4D43-A9AF-1CAA440A9F69}.Release|Win32.ActiveCfg = Release|Win32
</span><span class="cx">                 {56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}.Debug|Win32.ActiveCfg = Debug|Win32
</span><span class="cx">                 {56F6FB96-2BC7-4CAE-A8BF-6A0FAEC90556}.Release|Win32.ActiveCfg = Release|Win32
</span><ins>+                {71D62A04-8EF6-4C6B-AC12-0C15A875E53A}.Debug|Win32.ActiveCfg = Debug|Win32
+                {71D62A04-8EF6-4C6B-AC12-0C15A875E53A}.Release|Win32.ActiveCfg = Release|Win32
</ins><span class="cx">         EndGlobalSection
</span><span class="cx">         GlobalSection(SolutionProperties) = preSolution
</span><span class="cx">                 HideSolutionNode = FALSE
</span><span class="lines">@@ -284,5 +288,6 @@
</span><span class="cx">                 {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}
</span><span class="cx">                 {01D63BF5-7798-4746-852A-4B45229BB735} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
</span><span class="cx">                 {4714EF49-BFD5-4B22-95F7-95A07F1EAC25} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
</span><ins>+                {71D62A04-8EF6-4C6B-AC12-0C15A875E53A} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C}
</ins><span class="cx">         EndGlobalSection
</span><span class="cx"> EndGlobal
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>

</body>
</html>