Accessing Speech Server Perfmon Counters

I recently had a need to access the Perfmon counters for Speech Server from a C# program. Since I didn’t know how to do this my first step was to search the Internet for some code samples. That turned out to be harder than I though as I really didn’t find much help.

So I did what I should have done first and turned to the help docs. As it turns out it really isn’t that hard to do. First you will need to add “using System.Diagnostics;” to your application. after that the following code will get you a list of the Speech Server counters (these are for MSS 2007). 

        // **************************************************
        // Get a list of Speech Server Counters
        // **************************************************
        private void button2_Click(object sender, EventArgs e)
            System.Diagnostics.PerformanceCounter[] mypc;
            System.Diagnostics.PerformanceCounterCategory mycat =
                   new System.Diagnostics.PerformanceCounterCategory(“SpeechService”);
            // Remove the current contents of the textBox
            // Retrieve the counters.
            mypc = mycat.GetCounters();
            // Add the retrieved counters to the list.
            for (int i = 0; i < mypc.Length; i++)
                this.textBox1.Text += mypc[i].CounterName + Environment.NewLine;

The example places a list of counters into a Textbox but you can do what you want with them.

This example will show the current values for the requested counters –

        // **************************************************
        // Get the Active calls from the counters
        // **************************************************
        private void button3_Click(object sender, EventArgs e)
            System.Diagnostics.PerformanceCounter MyCtr = new System.Diagnostics.PerformanceCounter();
            MyCtr.CategoryName = “SpeechService”;
            MyCtr.CounterName = “Active Incoming Calls”;
            this.textBox1.Text += MyCtr.CounterName + “: ” + MyCtr.NextValue() + Environment.NewLine;
            MyCtr.CounterName = “Active Outgoing Calls”;
            this.textBox1.Text += MyCtr.CounterName + “: ” + MyCtr.NextValue() + Environment.NewLine;
            MyCtr.CounterName = “Active Application Instances”;
            this.textBox1.Text += MyCtr.CounterName + “: ” + MyCtr.NextValue() + Environment.NewLine;

To get the correct value for the PerformanceCounterCategory all you have to do is run Perfmon and then click on add counters. Expand the drop down list under “Performance object” and you will see a list of valid values. I choose “SpeechService”  which gave me a list of the Speech Server counters that I used for the second example..

I’ll leave you with the task of combining the two samples to create a method that will get a list of all of the counters  and their values.



Quick Tips – How to be a better MSS 2007 developer

1.If you really want to step things up a notch and become a better MSS 2007 developer then you really should check out the OCS Public Beta on a daily basis. Most developers only use the forums when they have a question but I think they should be a tool that you use all the time.

The beta forums (and GotSpeech) are full of questions from developers just like you. I find it a big help to go to the forums and read the questions and answers. It helps you understand the kinds of problems others are encountering and how to solve the problems. You may not be struggling with the same problems but when you do encounter a problem you read about in the forums you will remember the solution (or at least where to look). You can learn a lot from the forums. And you might know the answer to someone else’s problem and answer their question – it’s a great feeling to help out others.

2. Read Joe Calev’s blog regularly. Joe writes some great stuff such as his recent 16 part series on UCMA. Also read the blogs here on GotSpeech – I’m always looking for new quality speech bloggers.

3. Play with the debugger. When I was first starting out way back with MSS 2004 beta 1 I found the debugger to be a great tool for learning. I would run my application and stop at different points in the code and just examine the contents of the different speech related objects. Try taking a look at RunSpeech or the History. There is some really interesting stuff to find when you start drilling down. I haven’t done as much of this yet with 2007 but I suspect it will be just as interesting.

If you have any tips you want to share I would like to hear them.

Speech is loosing a great blogger

Richard Sprague is moving on to other things.

He has been blogging about Microsoft Speech Server from the very beginning and was one of the first speech related blogs that I read.  I think this post was one of my favorites as Richard was one of the first bloggers out there to jump on the GotSpeech bandwagon. His post really helped get things going for us.

We here at GotSpeech wish Richard well in his new venture ( and we will miss your insight.

Almost 60,000 outbound calls a day

Some of you know that while I was working for Landstar I wrote an outbound application that won Speech Technology Magazine’s 2006 Most Innovative Solutions award. I’ve been asked several times recently if Speech Server is robust enough to take on heavy loads. So I thought I would do an update on the application.

The app made 6.5 million outbound calls last year and it has continued to grow such that it is now doing 55,0000+ outbound calls a day now. I had lunch today with my old boss (Dave) and my replacement and got an update on the system. The call load had grown so large that the app was keeping 4 T1s maxed out for most of the day so they decided to add another server to take some of the load.

This morning they stood up another server running Speech Server 2004 R2 Enterprise in an all-in-one configuration. The new server has 2 T1s attached and room to add 2 more. Both servers point to the same MSMQ queue and the systems are doing an excellent job of balancing the load. Dave said that when they dropped 30 test calls into the queue both boxes grabbed 15 of the calls so it appears that the servers are alternating taking calls out of the queue.

Well things have gone well so far today but they are still maxing out all of the T1s when the load gets heavy. Imagine, 148 simultaneous outbound calls. This is something that Dave and I had talked about doing before I left but the load just wasn’t there yet. Now it is.

Here’s a Perfmon shot (click for larger view)  showing both severs ramping up this morning – Pretty impressive.

Outbound calls

As Dave said, “It’s almost like watching my baby have kids”. Does that mean I’m a Grandpa now?

X-Lite soft phone

I recently downloaded the X-Lite soft phone for use with OCS 2007 Speech Server and I’m impressed with how easy it is to setup and use.

The phone has many features that I haven’t explored yet as I just needed something to test SIP applications running on my Speech Server box. I installed the phone on both  a Vista and an XP Professional PC and have been playing with it for a few days now. I really love the audio quality of the phone.

To configure for Speech Server you will set the following settings:

User Name: I just named this to “Vista” as it corresponds to the ANI

Domain: use the IP address of the machine that is running the soft phone.

You need to uncheck the “register with domain” check box and select the “send via target domain” check box.

In the SES Administrative Console you will need to set up the machine running X-Lite as a SIP Peer then add it to the Trusted SIP Peers list. I trus that you already know how to do this.

Now you are ready to call the Speech Server and that is fairly easy. Just use a dial string like the one below.


For example: SIP:1234@;transport=tcp


X-Lite works fine on my XP Pro laptop but it keeps exiting after each call is finished on the Vista box. I’m not sure why it does this but it can be a little aggravating as I have to wait for it to load again. If I solve this issue I’ll add the solution to this blog entry.

Enjoy. And if you are using a different SDIP phone I would love to hear about it.

New GotSpeech Forum

While we were at Tech-Ed Michael Dunn was bugging me about creating a forum on GotSpeech for members interested in creating desktop speech applications.

Well, I listened and added Managed SAPI – System.Speech namespace development as our newest forum. Michael is really into this stuff and he will be serving as the moderator/administrator for the new forum.

So, come on over, ask your questions and enjoy the new forum.