<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>EricP56</title>
  <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/" />
  <link rel="self" href="http://www.nextivr.com/ericp/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2011-05-27T10:53:12.6947125-07:00</updated>
  <author>
    <name>Eric Phetteplace</name>
  </author>
  <subtitle>IVR Programming</subtitle>
  <id>http://www.nextivr.com/ericp/</id>
  <generator uri="http://dasblog.info/" version="2.3.9074.18820">DasBlog</generator>
  <entry>
    <title>Eclipse Plug-ins</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2011/05/27/EclipsePlugins.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,919ad0e6-cb63-48ab-9c58-fa0550d93916.aspx</id>
    <published>2011-05-27T10:53:12.6947125-07:00</published>
    <updated>2011-05-27T10:53:12.6947125-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">I'm currently writing Eclipse plug-ins,
leveraging the <a href="http://eclipse.org/jwt">JWT</a> project.<br /><br />
There's a great book for learning how to program plug-ins, and they have a site for
it: <a href="http://www.qualityeclipse.com/">http://www.qualityeclipse.com/</a><br /><br />
If you use Eclipse, you should read <a href="http://www.qualityeclipse.com/PDFs/Clayberg-Rubel-Ch01.pdf">Chapter
One</a> on the site (free); even if you aren't programming plug-ins!  They go
over all the features of Eclipse that you should know about.  There's plenty
of interesting reading in the other chapters - the previous IDE technologies that
made their way into the app, how plug-ins work, how to build a basic plug-in, using
SWT to develop great GUIs.<br /><br />
I'll be releasing a project soon, complete with a help section, an update site, and
all that you'd expect from an Eclipse plugin.  More on that in June!<br /><br />
Eric<br /><p></p><img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=919ad0e6-cb63-48ab-9c58-fa0550d93916" /></div>
    </content>
  </entry>
  <entry>
    <title>Updates to the Phone Service</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2011/05/13/UpdatesToThePhoneService.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,308a6c68-6c80-45fa-8b32-8accbf6caf08.aspx</id>
    <published>2011-05-13T13:10:15.3086032-07:00</published>
    <updated>2011-05-13T13:10:15.3086032-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">Since the last posting, I've had some worthwhile
experiences with my VOIP.<br /><br />
First, the HT286 worked perfectly.  I'm working toward switching over my home
phone services, too.  I picked up the Gransdstream HandyTone 503, which provides
2 phone lines for 2 SIP trunks.<br /><br />
The first thing I noticed during the echo test, was that the latency was much lower
then the 286's.  That joy was short-lived, though.  My outgoing sound path
started having lots of jitter.  The incoming sound was perfectly clear, but people
would tell me my voice was breaking up.  I could recreate this in the echo test. 
After a minute or two, the sound quality was pitiful.<br /><br />
Basically, it was a QOS problem.  I tried setting the QOS properties on the 503,
but it didn't help.  Even though my router had VOIP QOS settings, they didn't
seem to work.  I replaced the stock firmware on my wireless router with dd-wrt,
configured QOS, and the problem disappeared!  I even performed a bandwidth download/upload
test, and there was no loss of quality.<br /><br />
I'll be porting my home phone number to my SIP trunk provider real soon:)<br /><br />
Eric<br /><p></p><img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=308a6c68-6c80-45fa-8b32-8accbf6caf08" /></div>
    </content>
  </entry>
  <entry>
    <title>You are paying too much for your phone service.</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2011/03/14/YouArePayingTooMuchForYourPhoneService.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,95d8c8e1-86fa-4262-b0b0-971c2c77f09d.aspx</id>
    <published>2011-03-14T06:21:08.83-07:00</published>
    <updated>2011-04-25T09:16:59.0819575-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">I wanted to test the quality of using a
VOIP adapter with Google Voice (GV).  I have to say it is excellent.  The
latency is not noticeable, compared with a 1s-2s potential delay if you are using
a soft-phone (especially one on your smart phone).  You can also send and receive
faxes!<br /><br />
Overall, I think with a little effort, you can drop your phone services bill to $5/month,
with no loss in service or quality.<br /><br />
Simple (but technical) steps to reduce/remove your telephone service:<br /><ol><li>
Set up a <a href="http://bit.ly/h0BwkE">Google Voice</a> account.</li><li>
Set up a <a href="http://bit.ly/gUme40">pbxes.org</a> account.  You will have
your own Asterisk PBX in the cloud for $5/month.  You need to have a paid account
to get access to GV You'll have to look in the forums for details on how to set up
your GV trunk, set up your inbound/outbound paths.  Email me if I should document
the steps:)<br /></li><li>
Buy a VOIP Adapter.  I got the <a href="http://bit.ly/eldXbj">HT286</a> from <a href="http://bit.ly/gY7qad">Telephony
Depot</a> for $25</li><li>
Plug in the adapter in your home network (ethernet/wired connection is needed). 
Figure out its IP address (look on your router for DHCP leases, and find the newest
entry) and configure it.<br /></li><li>
Call *43 to echo test the line. 
<br /></li><li>
Call a friend.  Have a friend call you.  It's all good!</li></ol>
Reasons (GV limitations) to go with <a href="http://bit.ly/e3vJyl">voip.ms</a> instead
of steps 1 and 2 above:<br /><ol><li>
1 hour max call length?</li><li>
E911 Support.<br /></li><li>
Number portability<br /></li></ol><br /><p></p><script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script><img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=95d8c8e1-86fa-4262-b0b0-971c2c77f09d" /></div>
    </content>
  </entry>
  <entry>
    <title>Building a LYME server - Linux Yaws Mnesia Erlang</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2011/03/14/BuildingALYMEServerLinuxYawsMnesiaErlang.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,912d53d4-3432-43c5-91cf-48a5de42d9dd.aspx</id>
    <published>2011-03-14T05:15:19.913-07:00</published>
    <updated>2011-04-25T09:14:31.3575351-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">A LYME server is Linux Yaws Mnesia Erlang
- similar to how LAMP is Linux Apache (Tomcat) MySQL PHP, but of course, this system
focuses on functional programming.<br /><br />
I started studying functional programming awhile ago.  It's pretty interesting.<br />
Here are some resources for you:<br /><ul><li>
The <a href="http://en.wikipedia.org/wiki/Erlang_%28programming_language%29">Wikipedia</a> entry
- it's not Erlang, the person, or the measurements, thus the link (to go off on a
tangent, here, look at <a href="http://en.wikipedia.org/wiki/Agner_Krarup_Erlang">Erlang</a> and <a href="http://en.wikipedia.org/wiki/Andrey_Markov">Markov</a> early
20th century mathematicians who still influence our lives today).<br /></li><li>
The official <a href="http://www.erlang.org/">Erlang</a> site.<br /></li><li><a temp_href="http://lisperati.com/ " href="http://lisperati.com/%20">http://lisperati.com/</a> -
This is a fun tour of functional programming in Lisp.<br /></li><ul><li>
go through the "Casting SPELs to learn what a Lisp program looks like.</li><li>
go through the "Land of Lisp" cartoon to learn the tech points of Lisp - read it and
click on the links as you go.</li></ul><li><a href="http://mitpress.mit.edu/sicp/">http://mitpress.mit.edu/sicp/</a> - 
This is the "not fun" tour of functional programming in Scheme.  It's comprehensive,
and you need to have an aptitude for math (or be able to ignore it and focus on the
concepts).</li><li><a href="http://www.sics.se/%7Ejoe/apachevsyaws.html">http://www.sics.se/~joe/apachevsyaws.html</a> -
This is what really got me interested in using Erlang: Apache dies at about 4,000
parallel sessions. Yaws is still functioning at over 80,000 parallel connections. 
<br /></li></ul>
You can create your own LYME server in about 5 minutes.  
<br /><br />
On Ubuntu, you can install yaws "apt-get install yaws"  That'll create an http
Yaws server pretty quickly.  However, there is no https.<br /><br />
On Fedora, you can do "yum install yaws" However, the http example site is not configured.<br /><br />
If you want to use CentOS, or https, then you are in for a longer setup.  The
good thing about the following setup is:<br /><ol><li>
It is the latest code release</li><li>
It includes https and all example code.<br /></li></ol>
These are my notes for building a LYME server using CentOS.  I hope you like
the command line;)<br /><br />
yum install make wget gcc m4  openssl openssl-devel pam-devel ncurses-devel git
automake glibc-devel.i386<br /><br />
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm;
wget http://erlang.org/download/otp_src_R14B01.tar.gz; wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz<br /><br />
tar -xvzf otp_src_R14B01.tar.gz ; tar -vxzf autoconf-2.68.tar.gz 
<br /><br />
cd autoconf-2.68; ./configure; make; make install;<br /><br />
cd ../otp_src_R14B01; ./configure --with-ssl; make; make install<br /><br />
cd ..; git clone git://github.com/klacke/yaws.git<br /><br />
cd yaws; autoconf ; ./configure; make; make install<br /><br />
edit /etc/sysconfig/iptables  and add a rule to allow ports 80 and 443<br />
  -A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT<br />
  -A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT<br /><br />
/etc/init.d/iptables restart<br /><br />
yaws 
<br /><br />
http://[your machine IP or FQDN]/  you should see the yaws server page, with
examples<br /><br />
back in yaws, cctrl-g, then q [enter]<br /><br />
That's it!  All done!  On a decent server, if you are cutting and pasting
commands, it'll probably take &lt; 30 minutes to complete.  On an slower machine,
plan on taking some coffee breaks during the configure and make commands.<br /><br />
Also, on my latest run of the above script, the https port wasn't showing the yaws
app page.  I edited /usr/local/etc/yaws/yaws.conf as follows:<br />
In the ssl configuration, I added the following lines under the line with "port=443":<br />
        docroot = /usr/local/var/yaws/www<br />
        appmods = &lt;cgi-bin, yaws_appmod_cgi&gt;<br />
Replace the existing docroot entry, of course...<br /><br />
Eric<br /><br /><br /><p></p><script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script><img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=912d53d4-3432-43c5-91cf-48a5de42d9dd" /></div>
    </content>
  </entry>
  <entry>
    <title>Transcribing for MS Speech Server</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2008/04/09/TranscribingForMSSpeechServer.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,a1f1c1eb-b3db-4da6-9c11-7bf3d544edeb.aspx</id>
    <published>2008-04-09T11:49:04.669-07:00</published>
    <updated>2011-04-25T09:17:30.8800535-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
        </p>
Transcribing speech utterances is a highly repetitive task, usually performed by a
pool of people who are good at typing.<br /><br />
Out of the box, the speech server tools for transcribing are accessible through Visual
Studio, and are not good for transcribing any volume of utterances.<br /><br />
The following attachment contains two Visual Studio 2005 projects that can get you
on your way towards a fast transcription process for non developers (no Visual Studio
needed for them).<br /><br /><br /><a href="http://www.nextivr.com/ericp/content/binary/MSSTranscriptionService.zip">MSSTranscriptionService.zip
(3.75 MB)</a><script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script><img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=a1f1c1eb-b3db-4da6-9c11-7bf3d544edeb" /></div>
    </content>
  </entry>
  <entry>
    <title>Unit Testing Managed Speech Server Applications</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2008/04/03/UnitTestingManagedSpeechServerApplications.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,f7f2d34b-368c-476d-8ac3-86a71f217f7f.aspx</id>
    <published>2008-04-03T10:13:06.431-07:00</published>
    <updated>2011-04-25T09:18:03.9438231-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Unit testing code is important.  If you make code changes in a library that other
people are using, you want to make sure all of the code works as expected.  Using
NUnit is great for that.
</p>
        <p>
However, when it comes to speech applications, you probably manually test your applications
before each release.
</p>
        <p>
If you are writing managed code for Office Communications Server 2007 Speech Server,
and you are using a SIP for your telephony lines, I have something that will help
you automate your testing.  I created a simple class that will send SIP INFO
requests to the caller if they include "log=true" in the SIP URI parameters. 
It basically works like this:
</p>
        <ol>
          <li>
Call into your application and then generate a test script based on the call log. 
</li>
          <li>
Run the customized OutboundCalls application, passing your newly generated script
as the script to run. 
</li>
          <li>
The OutboundCalls application will automatically go through the application, following
the same path. 
</li>
        </ol>
        <p>
Attached is the unit testing code, a demo and some basic instructions.  Open
the UnitTesting solution and read the ReadMe.htm file for all the details.
</p>
        <p>
Happy Testing!
</p>
        <a href="http://www.nextivr.com/ericp/content/binary/UnitTesting.zip">UnitTesting.zip
(8 MB)</a>
        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
        </script>
        <script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script>
        <img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=f7f2d34b-368c-476d-8ac3-86a71f217f7f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>A Grammar for AlphaNumeric IDs</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2007/06/05/AGrammarForAlphaNumericIDs.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,fb6fd509-52db-47fa-9dc3-3e343cbc8113.aspx</id>
    <published>2007-06-05T08:02:22.215-07:00</published>
    <updated>2011-04-25T09:18:43.6484727-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
In the health industry, I've frequently run into the following predicament: 
User IDs are no longer simple numeric fields.  Traditionally, an employee's Social
Security number may have been used as an id, but HIPAA has put an end to that.
</p>
        <p>
For speech recognition, this could present a common tuning and maintenance issue. 
The following XSLT document is designed to automate this maintenance.
</p>
        <p>
First, let's take a look at some simple user IDs stored in my sample database.
</p>
        <p>
          <span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">
            <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">SELECT</span> UserIDs <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">FROM</span> SampleIDs</span>
        </p>
        <p>
UserIDs                                                      
<br />
------<br />
119821<br />
319871<br />
31987M<br />
D19821<br />
D1982M<br />
D19871<br />
...
</p>
        <p>
You can see there are a few alphanumeric patterns being used with these IDs. 
Using a simple replacement, we can get all the non-numeric patterns in the database:
</p>
        <p>
          <span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">
            <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">SELECT</span>
            <span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(UserIDs, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'1'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'2'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'3'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'4'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'5'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'6'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'7'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'8'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'9'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'0'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>) <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">AS</span> Pattern, 
<br /><span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">COUNT</span>(*) <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">AS</span> RecordCount 
<br /><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">FROM</span> SampleIDs<br /><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">GROUP</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">BY</span><span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(<span style="font-size: 11px; color: fuchsia; font-family: Courier New; background-color: transparent;">REPLACE</span>(UserIDs, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'1'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'2'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'3'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'4'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'5'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'6'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'7'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'8'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'9'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>), <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'0'</span>, <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">'_'</span>)<br /><br /></span>
        </p>
        <p>
Pattern RecordCount 
<br />
------------------- 
<br />
D_____  71680<br />
_____M  57344<br />
X____M  14336<br />
D____M  71680<br />
X_____  14336<br />
______  57344
</p>
        <p>
With this, we'll simply assume there is an even chance for any of these patterns being
used on a call.  So, D_____ has the probability of 71680/286720 or a 25% chance
of being provided.  Using this information, we can weight the probability of
this pattern matching an utterance for a user ID.
</p>
        <p>
First, I run the above SQL statement and put the results into a dataset.  You
can simply create the XML from the recordset, too.  My XML results look like
this:
</p>
        <p>
          <span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">&lt;records&gt;<br />
&lt;record&gt;<br />
&lt;Pattern&gt;D_____&lt;/Pattern&gt;<br />
&lt;RecordCount&gt;71680&lt;/RecordCount&gt;<br />
&lt;/record&gt;<br />
&lt;record&gt;<br />
&lt;Pattern&gt;_____M&lt;/Pattern&gt;<br />
&lt;RecordCount&gt;57344&lt;/RecordCount&gt;<br />
&lt;/record&gt;<br />
&lt;record&gt;<br />
&lt;Pattern&gt;X____M&lt;/Pattern&gt;<br />
&lt;RecordCount&gt;14336&lt;/RecordCount&gt;<br />
&lt;/record&gt;<br />
&lt;record&gt;<br />
&lt;Pattern&gt;D____M&lt;/Pattern&gt;<br />
&lt;RecordCount&gt;71680&lt;/RecordCount&gt;<br />
&lt;/record&gt;<br />
&lt;record&gt;<br />
&lt;Pattern&gt;X_____&lt;/Pattern&gt;<br />
&lt;RecordCount&gt;14336&lt;/RecordCount&gt;<br />
&lt;/record&gt;<br />
&lt;record&gt;<br />
&lt;Pattern&gt;______&lt;/Pattern&gt;<br />
&lt;RecordCount&gt;57344&lt;/RecordCount&gt;<br />
&lt;/record&gt;<br />
&lt;/records&gt;<br /><br /></span>
        </p>
        <p>
Now comes the fun part - using XSLT to create a GRXML grammar file.
</p>
        <p>
A couple of points about the XSL file:
</p>
        <ol>
          <li>
For the JavaScript function buildCharacterArray(s1), you could probably slim the function
down to "return s1.split('');"  It splits a string into a character array. 
</li>
          <li>
XSLT doesn't have a for-each loop, so I recursively call the buildItem template. 
</li>
          <li>
In this example, the TAG is set as an attribute of the related ITEM element. 
For other platforms, this may need to be an element trailing the ITEM element. 
Of course, the tag syntax is different on each platform:( 
</li>
          <li>
In the real world you may find, through transcriptions and tuning, that people may
utter dashes and spaces, too, or say, "B as in boy."  They may also truncate
leading 0's (00001214V may be spoken 1214V). 
</li>
          <li>
It doesn't handle robust recognition for utterances like "nine double oh one seven"
or "nine thirty nine twenty two."  Unless you find patterns through transcriptions
and tuning, effectively accommodating this will drop your accuracy and performance
through the floor. 
</li>
          <li>
Use your web server to cache the GRXML output; there's no need to run it too often.</li>
        </ol>
        <p>
The resulting grammar looks like this :<br /></p>
        <p>
          <span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">&lt;?xml
version=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"1.0"</span> encoding=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"utf-8"</span> ?&gt; 
<br />
&lt;grammar xml:lang=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"en-US"</span> version=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"1.0"</span> root=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"main"</span> mode=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"voice"</span> xmlns:msxsl=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"urn:schemas-microsoft-com:xslt"</span> xmlns:nextivr=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"http://www.nextivr.com/XSLFunctions"</span> xmlns:rs=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"urn:schemas-microsoft-com:rowset"</span>&gt;<br />
&lt;rule id=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"main"</span> scope=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"public"</span>&gt;<br />
&lt;one-of&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> weight=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"0.25"</span>&gt;<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#D_____"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> weight=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"0.2"</span>&gt;<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#_____M"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> weight=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"0.05"</span>&gt;<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#X____M"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> weight=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"0.25"</span>&gt;<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#D____M"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> weight=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"0.05"</span>&gt;<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#X_____"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> weight=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"0.2"</span>&gt;<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#______"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt;<br />
&lt;/one-of&gt;<br />
&lt;/rule&gt;<br />
&lt;rule scope=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"private"</span> id=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"D_____"</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"D"</span>&gt;D&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/rule&gt;<br />
&lt;rule scope=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"private"</span> id=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"_____M"</span>&gt;<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"M"</span>&gt;M&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;/rule&gt;<br />
&lt;rule scope=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"private"</span> id=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"X____M"</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"X"</span>&gt;X&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"M"</span>&gt;M&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;/rule&gt;<br />
&lt;rule scope=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"private"</span> id=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"D____M"</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"D"</span>&gt;D&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"M"</span>&gt;M&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;/rule&gt;<br />
&lt;rule scope=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"private"</span> id=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"X_____"</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"X"</span>&gt;X&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/rule&gt;<br />
&lt;rule scope=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"private"</span> id=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"______"</span>&gt;<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;ruleref type=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"application/srgs+xml"</span> uri=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"#number"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt; 
<br />
&lt;/rule&gt;<br />
&lt;rule scope=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"private"</span> id=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"number"</span>&gt;<br />
&lt;one-of&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"1"</span>&gt;one&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"2"</span>&gt;two&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"3"</span>&gt;three&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"4"</span>&gt;four&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"5"</span>&gt;five&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"6"</span>&gt;six&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"7"</span>&gt;seven&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"8"</span>&gt;eight&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"9"</span>&gt;nine&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span> tag=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"0"</span>&gt;zero&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt; 
<br />
&lt;/one-of&gt;<br />
&lt;/rule&gt;<br />
&lt;/grammar&gt;<br /><br /><a href="content/binary/AlphaNumIDsToGrammar.zip">Download the code!</a><br /><br /></span>
        </p>
        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
        </script>
        <script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script>
        <img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=fb6fd509-52db-47fa-9dc3-3e343cbc8113" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Url2Fax, free FAX software with source code, converting web pages to FAX documents.</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2007/05/11/Url2FaxFreeFAXSoftwareWithSourceCodeConvertingWebPagesToFAXDocuments.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,9f15277b-bebf-4c17-8181-87eb8ceb7ede.aspx</id>
    <published>2007-05-11T08:21:20.991-07:00</published>
    <updated>2011-04-25T09:19:34.9785687-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I needed to add some simple, free FAX functionality to an application, so I invested
a little time in doing it with <a href="http://msdn.microsoft.com/vstudio/express">Visual
C# 2005 Express Edition</a>. 
</p>
        <p>
Source from the web: 
<br /><a href="http://www.nextivr.com/ericp/content/binary/news.google.com.JPG"><img style="width: 33.11%; height: 78.13%;" src="http://www.nextivr.com/ericp/content/binary/news.google.com.JPG" border="0" /></a><br />
Resulting image: 
<br /><a href="http://www.nextivr.com/ericp/content/binary/news.google.com.gif"><img style="width: 33.11%; height: 78.13%;" src="http://www.nextivr.com/ericp/content/binary/news.google.com.gif" border="0" /></a></p>
        <p>
I decided to make it use web browser content; seeing that it's pretty easy to format
a web page, no FAX imaging tools are required. Thanks to <a href="http://www.codeproject.com/script/Articles/list_articles.asp?userid=564301">Michael
McCloskey's</a>  Bitonal article <a href="http://www.codeproject.com/cs/media/BitonalImageConverter.asp">Bitonal
(TIFF) Image Converter for .NET</a>, I was able to accomplish my goal rather easily! 
</p>
        <p>
I added in some random dithering to produce a decent balance between text pages and
pages with images. I was tempted to implement <a href="http://www.visgraf.impa.br/Courses/ip00/proj/Dithering1/floyd_steinberg_dithering.html">Floyd-Steinberg
Dithering</a>, but my random results are good enough for my project. 
</p>
        <p>
I also added in code for generating the image from a web page, and creating the multi-page
TIFF document.
</p>
        <p>
I reference FaxComEx.dll, the Windows FAX server, in the code.  This makes it
easy to generate a FAX by the command line, <em>(e.g. <u>Url2Fax http://localhost/reportapp/report.jsp?repnum=1
18885551212 FAXSVR100 will send a report to 8885551212, using the fax printer on FAXSVR100
(don't use "localhost")</u>)</em>   If you don't want to use the FAX service,
leave off the parameters.  You can grab the image from your %TEMP% directory.
</p>
        <p>
Here's the source code: <a href="http://www.nextivr.com/ericp/content/binary/Url2Fax.zip">Url2Fax.zip</a>. 
The exe is located in the release folder, in case you want to try it as is. 
You'll need Windows XP or 2003 to use the built-in Fax delivery.  For Windows
2000, you can generate the image and then send it with the Windows 2000 fax server.
(I have a script for that, too).
</p>
        <p>
          <br />
Enjoy! 
</p>
        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
        </script>
        <script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script>
        <img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=9f15277b-bebf-4c17-8181-87eb8ceb7ede" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Creating Dynamic GRXML Grammars with c# and ASP.NET</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2007/05/02/CreatingDynamicGRXMLGrammarsWithCAndASPNET.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,953266f9-21db-45ae-bb08-9c524b6edfd4.aspx</id>
    <published>2007-05-02T16:58:11.816-07:00</published>
    <updated>2011-04-25T09:20:18.7614999-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the fundamental tasks in creating speech applications is building the grammars
for automated speech recognition (ASR).  This entry features techniques to make
your grammar-building code fast, efficient and maintainable.
</p>
        <p>
In many situations, it is unrealistic to design and build your grammars in development
and deploy them as static grammars in production.  For example, if you are writing
an address verification application, you may want to ask the caller for the state,
then the city, then the street and so on.  Instead of building many grammars
(all the streets in each city, all the cities in each state), you may want to let
the user activity decide which of the most popular cities have their street grammars
created, and the most popular states have their city grammars cached, too, and so
on. 
</p>
        <p>
I tried three methods for performing this task.  In all the examples, I connected
to a database to retrieve choices for the <a href="http://www.nextivr.com/ericp/EditEntry.aspx#f5">grammar</a>.<br />
In the <a href="http://www.nextivr.com/ericp/EditEntry.aspx#f1">first example</a>,
I wrote directly to a stream, writing the xml using strings.  In the <a href="http://www.nextivr.com/ericp/EditEntry.aspx#f2">next
example</a>, I used an XML dataset and an <a href="http://www.nextivr.com/ericp/EditEntry.aspx#f4">XSL
stylesheet</a> to transform the data to a grammar.  In the <a href="http://www.nextivr.com/ericp/EditEntry.aspx#f3">third
example</a>, I did the same as the second example, but I sent the results directly
to a Response stream in ASP.NET.  Figures 1, 2 and 3 repsectively provide samples
of the code.
</p>
        <p>
All 3 performed well.  Using a simple performance measurement of the total processor
time used, they were all a fraction of a second.  The top performer by far was
using ASP.NET and the response stream.  Of course, IO is the performance killer
for the first two; writing the file to a disk address is slow compared to writing
to a memory address.
</p>
        <h5>Total seconds of processor time.
</h5>
        <table border="1">
          <tbody>
            <tr>
              <td bgcolor="#cccccc">
              </td>
              <td colspan="3" bgcolor="#aaaaaa">
Code sample</td>
            </tr>
            <tr>
              <td bgcolor="#cccccc">
Grammar Items</td>
              <td bgcolor="#aaaaaa">
Code 1</td>
              <td bgcolor="#aaaaaa">
Code 2</td>
              <td bgcolor="#aaaaaa">
Code 3</td>
            </tr>
            <tr>
              <td bgcolor="#cccccc">
10</td>
              <td>
0.891</td>
              <td>
0.938</td>
              <td>
0.000!</td>
            </tr>
            <tr>
              <td bgcolor="#cccccc">
100</td>
              <td>
0.906</td>
              <td>
0.984</td>
              <td>
0.012</td>
            </tr>
            <tr>
              <td bgcolor="#cccccc">
1000</td>
              <td>
0.938</td>
              <td>
1.141</td>
              <td>
0.141</td>
            </tr>
          </tbody>
        </table>
        <p>
          <br />
So of course, I suggest you use the code in Figure 3.  Here are some tips on
why I think you should prefer it over the code in Figure 1.
</p>
        <ul>
          <li>
If you need to customize the grammar, you can change the XSL file without recompiling
the code.  Let's say you need to change the TAG element in the grammar (and for
each VoiceXML platform, tags are implemented differently!), you can adjust the XSL
file and see visually how you're affecting the grammar. 
</li>
          <li>
By using the XML from the DataSet, you don't have to worry about data types as they're
all converted to text.  If a database field changes in size or precision, the
code still works without recompiling. 
</li>
          <li>
XSL is easier to read.  Mind you, to master it takes some work, but which code
is easier for an IVR programmer to pick up...<br /><u>This:</u>               
<p><span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;"><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">while</span>(TestDataReader.Read())<br />
{<br />
TestWriter.Write(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;item&gt;{0}&lt;/item&gt;&lt;tag&gt;colorid
= {1};&lt;/tag&gt;"</span>, TestDataReader.GetString(1), TestDataReader.GetInt32(0));<br />
} </span><br /><u>Or this?</u><br /><span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">&lt;xsl:<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">for</span>-<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">each</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">select</span>=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"//record"</span>&gt;<br />
&lt;<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt;&lt;xsl:value-of <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">select</span>=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"description"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt;&lt;/<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">item</span>&gt;&lt;tag&gt;colorid <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> &lt;xsl:value-of <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">select</span>=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"id"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">/</span>&gt;;&lt;/tag&gt; 
<br />
&lt;/xsl:<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">for</span>-<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">each</span>&gt;<br /></span></p></li>
          <li>
Using Page Output Caching <a href="http://msdn2.microsoft.com/en-us/library/ms972362.aspx">http://msdn2.microsoft.com/en-us/library/ms972362.aspx</a> you
can get great performance from the dynamic grammars.  Cache the files fresh every
day, based on the URL parameters.  Schedule a task to call the common URLs, so
the first caller of the day doesn't have to wait for the first compile (even though
it's a fraction of a second).  Cache based on a database dependency - there's
examples out there on how to do this. 
</li>
          <li>
Use web.config to store the SQL queries and XSL file names.  That'll make this
code grammar builder really flexible.</li>
        </ul>
        <blockquote dir="ltr" style="margin-right: 0px;">
          <p>
 <u>In web.config</u><br />
 &lt;configuration&gt;<br />
  &lt;appSettings&gt;<br />
   &lt;add key="colors" value="SELECT id, description FROM colors"
/&gt;<br />
   &lt;add key="colorsxsl" value="SimpleGrammarTransformer.xsl" /&gt;
</p>
          <p>
 <u>In your code replace the SQL query with the following:<br /></u>  System.Configuration.ConfigurationSettings.AppSettings[Request.QueryString.Get("grammar_id")]
</p>
          <p>
            <u> URL to get the colors grammar: </u>
            <br />
  <a href="http://servername/BuildGrammar?grammar_id=colors">http://servername/BuildGrammar?grammar_id=colors</a></p>
        </blockquote>
        <ul>
          <li>
Use a SCRIPT block in the XSL to manipulate the data, instead of doing it in the compiled
code.  Using script makes it easy to perform Javascript on the XML as it's being
processed by the XSL stylesheet.  I've used Javascript to parse comma-delimited
strings into grammar items, clean up data, and more.  Perhaps if you need an
example, I can post one...</li>
        </ul>
        <p>
In conclusion, you should use ASP.NET and XSLT to create your dynamic grammars. 
It's fast, flexible and easy.  Let me know what you think.  Should I include
a download, or can you take if from here?
</p>
        <p>
Have fun!
</p>
        <p>
          <a name="f1">
            <strong>Figure 1 - Reading from a DB, writing strings to a stream<br /></strong>
          </a>
        </p>
        <p>
          <span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">
            <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">
              <a name="f1">static</a>
            </span>
            <a name="f1">
              <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">void</span> Main(<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">string</span>[]
args)<br />
{<br />
TimeSpan TS1 <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;<br /><br />
MySqlConnection DatabaseConnection <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> MySqlConnection(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"Database=;Data
Source=;User Id=;Password="</span>);<br />
DatabaseConnection.Open();<br />
MySqlCommand TestCommand <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> MySqlCommand(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"SELECT
id, description FROM colors"</span>, DatabaseConnection);<br />
MySql.Data.MySqlClient.MySqlDataReader TestDataReader <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> TestCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection);<br />
System.IO.StreamWriter TestWriter <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> System.IO.StreamWriter(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"c:\\temp\\Grammar2.grxml"</span>);<br /><br />
TestWriter.Write(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;?xml
version=\"1.0\" encoding=\"utf-8\"?&gt;&lt;grammar mode=\"voice\" version=\"1.0\"
root=\"main\"&gt;&lt;rule id=\"main\"&gt;&lt;one-of&gt;"</span>);<br /><br /><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">if</span> (TestDataReader.HasRows)<br />
{<br /><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">while</span>(TestDataReader.Read())<br />
{<br />
TestWriter.Write(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;item&gt;{0}&lt;/item&gt;&lt;tag&gt;colorid
= {1};&lt;/tag&gt;"</span>, TestDataReader.GetString(1), TestDataReader.GetInt32(0));<br />
} 
<br /><br />
}<br /><br />
TestWriter.Write(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;/one-of&gt;&lt;/rule&gt;&lt;/grammar&gt;"</span>);<br />
TestWriter.Close();<br /><br />
TimeSpan TS2 <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;<br />
Console.WriteLine(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"Done.
Total ticks = {0}."</span>, TS2.Subtract(TS1).Ticks.ToString());<br />
Console.ReadLine();<br /><br />
}<br /></a>
          </span>
        </p>
        <a name="f2">
        </a>
        <p>
          <a name="f2">
            <strong>Figure 2 - Reading from a DB to a DataSet, then transforming
with XSLT.<br /></strong>
          </a>
        </p>
        <p>
          <span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">
            <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">
              <a name="f2">static</a>
            </span>
            <a name="f2">
              <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">void</span> Main(<span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">string</span>[]
args)<br />
{<br />
TimeSpan TS1 <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;<br /><br />
MySqlConnection DatabaseConnection <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> MySqlConnection(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"Database=;Data
Source=;User Id=;Password="</span>);<br />
MySqlDataAdapter DataAdapter <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> MySqlDataAdapter(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"SELECT
id, description FROM colors"</span>, DatabaseConnection);<br />
System.Data.DataSet DBDataSet <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> System.Data.DataSet();<br />
DataAdapter.Fill(DBDataSet, <span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"record"</span>);<br />
XmlDocument XMLTarget <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> XmlDocument();<br />
XMLTarget.LoadXml(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;records&gt;"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">+</span> DBDataSet.GetXml() <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">+</span><span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;/records&gt;"</span>);<br /><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">string</span> XmlTempFile <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"c:\\temp\\temprecords.xml"</span>;<br />
XMLTarget.Save(XmlTempFile);<br /><br /><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">string</span> XslFile <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"file://c:/temp/SimpleGrammarTransformer.xsl"</span>;<br />
System.Xml.Xsl.XslTransform StyleSheet <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> System.Xml.Xsl.XslTransform();<br />
XmlUrlResolver URLResolver <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> XmlUrlResolver();<br />
StyleSheet.Load(XslFile);<br />
StyleSheet.Transform(XmlTempFile, <span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"c:\\temp\\Grammar1.grxml"</span>);<br /><br />
TimeSpan TS2 <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;<br />
Console.WriteLine(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"Done.
Total ticks = {0}."</span>, TS2.Subtract(TS1).Ticks.ToString());<br />
Console.ReadLine();<br />
}<br /><br /></a>
          </span>
        </p>
        <a name="f3">
        </a>
        <p>
          <a name="f3">
            <strong>Figure 3 - Reading from a DB and transforming the results to
the response stream.<br /></strong>
          </a>
        </p>
        <p>
          <span style="font-size: 11px; color: black; font-family: Courier New; background-color: transparent;">
            <a name="f3">&lt;%@
Page Language=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"c#"</span> AutoEventWireup=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"false"</span> Debug=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"true"</span> %&gt;&lt;%@
Import <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">namespace</span>=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"System.Xml"</span>%&gt;&lt;%@
Import <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">namespace</span>=<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"MySql.Data.MySqlClient"</span>%&gt;&lt;%<br /><br />
TimeSpan TS1 <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;<br /><br />
MySqlConnection DatabaseConnection <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> MySqlConnection(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"Database=;Data
Source=;User Id=;Password="</span>);<br />
MySqlDataAdapter DataAdapter <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> MySqlDataAdapter(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"SELECT
id, description FROM colors"</span>, DatabaseConnection);<br />
System.Data.DataSet DBDataSet <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> System.Data.DataSet();<br />
DataAdapter.Fill(DBDataSet, <span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"record"</span>);<br />
XmlDocument XMLTarget <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> XmlDocument();<br />
XMLTarget.LoadXml(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;records&gt;"</span><span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">+</span> DBDataSet.GetXml() <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">+</span><span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;/records&gt;"</span>);<br /><br /><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">string</span> XslFile <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> String.Format(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"file://{0}"</span>,
Server.MapPath(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"SimpleGrammarTransformer.xsl"</span>)).Replace(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"\\"</span>, <span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"/"</span>);<br />
System.Xml.Xsl.XslTransform StyleSheet <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> System.Xml.Xsl.XslTransform();<br />
XmlUrlResolver URLResolver <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span><span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">new</span> XmlUrlResolver();<br /><span style="font-size: 11px; color: green; font-family: Courier New; background-color: transparent;">//StyleSheet.Load(XslFile,
URLResolver);</span><br />
StyleSheet.Load(XslFile, URLResolver);<br /><br />
StyleSheet.Transform(XMLTarget, <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">null</span>,
Response.OutputStream, <span style="font-size: 11px; color: blue; font-family: Courier New; background-color: transparent;">null</span>);<br /><br />
TimeSpan TS2 <span style="font-size: 11px; color: red; font-family: Courier New; background-color: transparent;">=</span> System.Diagnostics.Process.GetCurrentProcess().TotalProcessorTime;<br /><br />
Response.Write(String.Format(<span style="font-size: 11px; color: rgb(102, 102, 102); font-family: Courier New; background-color: rgb(228, 228, 228);">"&lt;!--Done.
Total ticks = {0} .--&gt;"</span>, TS2.Subtract(TS1).Ticks.ToString()));<br /><br />
%&gt;<br /></a>
          </span>
        </p>
        <a name="f4">
        </a>
        <p>
          <a name="f4">
            <strong>Figure 4 - An XSLT file for building GRXML grammars</strong>
          </a>
        </p>
        <p>
          <a name="f4">You can always change this so it outputs ABNF, or any GSL.</a>
        </p>
        <p>
          <a name="f4">
            <br />
&lt;?xml version="1.0"?&gt;<br />
&lt;xsl:stylesheet version="1.0" 
<br />
  xmlns:xsl="</a>
          <a href="http://www.w3.org/1999/XSL/Transform">http://www.w3.org/1999/XSL/Transform</a>" 
<br />
  xmlns:msxsl="urn:schemas-microsoft-com:xslt"<br />
  exclude-result-prefixes="msxsl"<br />
&gt;<br />
&lt;xsl:output method="xml"/&gt;<br />
  &lt;xsl:template match="/"&gt;<br />
    &lt;grammar mode="voice" version="1.0" root="main" &gt;<br />
      &lt;rule id="main"&gt;<br />
        &lt;one-of&gt;<br />
          &lt;xsl:for-each select="//record"&gt;<br />
            &lt;item&gt;&lt;xsl:value-of
select="description"/&gt;&lt;/item&gt;&lt;tag&gt;colorid = &lt;xsl:value-of select="id"/&gt;;&lt;/tag&gt;          
<br />
          &lt;/xsl:for-each&gt;<br />
        &lt;/one-of&gt;<br />
      &lt;/rule&gt;<br />
    &lt;/grammar&gt;<br />
  &lt;/xsl:template&gt;<br />
&lt;/xsl:stylesheet&gt;
</p>
        <p>
          <br />
          <strong>Figure 5 - GRXML result<br /></strong>&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;grammar mode="voice" version="1.0" root="main"&gt;<br />
  &lt;rule id="main"&gt;<br />
  &lt;one-of&gt;<br />
    &lt;item&gt;red&lt;/item&gt;&lt;tag&gt;colorid = 1;&lt;/tag&gt;<br />
    &lt;item&gt;orange&lt;/item&gt;&lt;tag&gt;colorid = 2;&lt;/tag&gt;<br />
    &lt;item&gt;yellow&lt;/item&gt;&lt;tag&gt;colorid = 3;&lt;/tag&gt;<br />
    .<br />
    .<br />
    .    
<br />
  &lt;/one-of&gt;<br />
  &lt;/rule&gt;<br />
&lt;/grammar&gt;
</p>
        <p>
 
</p>
        <font color="#000000" face="Courier New">
        </font>
        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
        </script>
        <script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script>
        <img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=953266f9-21db-45ae-bb08-9c524b6edfd4" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Natural Microsystems Vox Wav files</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2007/03/07/NaturalMicrosystemsVoxWavFiles.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,6c9df242-1603-4752-8814-04e98f30d9bc.aspx</id>
    <published>2007-03-07T08:02:13.229-07:00</published>
    <updated>2011-04-25T09:20:57.3098551-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Hi All,
</p>
        <p>
Seeing that some of the google search traffic I receive is around NMS sound files,
let me provide a little insight.
</p>
        <p>
NMS sound files are recorded in their own proprietary format, optimized for quality
and performance.
</p>
        <p>
The NMS vox files are NOT the same as the Dialogic VOX files.
</p>
        <p>
If you have some NMS VOX files that you need to convert, the easiest way is to convert
them where some NMS software is installed (probably on the IVR machine itself).
</p>
        <p>
Here's a Windows command line command to convert a folder of  NMS files to WAV
files:
</p>
        <p>
          <strong>for %1 in (*.vox) do VCECOPY %1 %~n1.wav -c44M16</strong>
        </p>
        <p>
-c44M16 means output encoding is 44mhz mono 16-bit.
</p>
        <p>
If the NMS file is indexed (use VCEINFO to figure it out), meaning it contains more
than one recording - kind of like a ZIP file contains a bunch of files - you'll have
to use a manual technique something like the following:
</p>
        <p>
vcecopy messages.vox 0.wav -c44M16 -m0,0
</p>
        <p>
vcecopy messages.vox 1.wav -c44M16 -m1,0
</p>
        <p>
vcecopy messages.vox 2.wav -c44M16 -m2,0
</p>
        <p>
Using Excel, you can write some equations to build a list of commands.  Using
some advanced command line utilities - perhaps Windows PowerShell or grep, depending
on the platform you are using.
</p>
        <p>
If you need any help with decoding/encoding from one format to another, drop me a
line.  NMS, Dialogic, Talx, raw PCM, GSM, whatever...
</p>
        <p>
 
</p>
        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
        </script>
        <script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script>
        <img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=6c9df242-1603-4752-8814-04e98f30d9bc" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Arca and Asterisk</title>
    <link rel="alternate" type="text/html" href="http://www.nextivr.com/ericp/2006/08/18/ArcaAndAsterisk.aspx" />
    <id>http://www.nextivr.com/ericp/PermaLink,guid,3630c627-6f15-47c6-92fe-055d95090c1a.aspx</id>
    <published>2006-08-18T13:20:29.941-07:00</published>
    <updated>2011-04-25T09:16:34.5653911-07:00</updated>
    <author>
      <name>EricP56</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Seeing that it's been a while, I figure I can let you know what I'm up to.  I've
been programming for clients; some VoiceXML, some web apps, some legacy IVRs.
</p>
        <p>
In my spare time I've been building out an Asterisk adapter for our Arca applications. 
It's pretty easy to install, etc.  Basically, our IVR applications can be written
once and run on VoiceXML, MSS, proprietary IVR platforms, and "non-standard" IVRs
like Asterisk.
</p>
        <p>
If you're curious about Asterisk but know nothing about Linux, I can have you running
an Asterisk switch on your workstation in two hours.
</p>
        <p>
If you're curious about Arca, let me know.  We have videos of how it all works.
</p>
        <p>
If you have any general IVR questions - any platform, any topic - drop me a line!
</p>
        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
        </script>
        <script type="text/javascript">
_uacct = "UA-1505196-2";
urchinTracker();
</script>
        <img width="0" height="0" src="http://www.nextivr.com/ericp/aggbug.ashx?id=3630c627-6f15-47c6-92fe-055d95090c1a" />
      </div>
    </content>
  </entry>
</feed>
