New GotSpeech join procedures

Lately GotSpeech has been bombarded with spam attempts to join. Not sure why they would do that but it is happening and as a result I’ve changed the way new members get approved.

It is now a manual process which allows me to filter out the spam. if you are legit and don’t get approved within 48 hours then email me.

I apologize for the inconvenience but the spammers make it tuff on all of us.

GotSpeech on Twitter

You can now follow the GotSpeech Guy on Twitter. Just use this link and click on Follow – http://twitter.com/gotspeech

I’m finding that I use Twitter a lot for little things concerning Speech Server and OCS. Lots of things happen everyday that are interesting but don’t warrant a large blog post and I find that I’m just tweeting those things and saving my blog posts for more substantial stuff.

Enjoy.

Dynamic Grammars

I’ve been messing around with dynamic grammars and put some code together to show how it’s done. This was for a real world problem I was facing but the code is just a proof of concept that I used to get everything working.

I used the code shown below to create a DTMF grammar that takes from 1 to 4 digits. The resulting SML looks like this -

<SML text="1 2 3 4" utteranceConfidence="1.000" confidence="1.000">
        <slot confidence="1.000">1234</slot>
        4
</SML>

There is more than one way to create the grammars but this is what I came up with. Part of the goal was to utilize most of the grammar building methods available to me. The code to write the grammar out to a file was a big help in debugging the grammar. The first thing I did was use the Grammar Editor to create a grammar that did what I wanted. I then compared this to the generated grammar to make sure i understood what was happening with the different methods and classes.

        private Microsoft.SpeechServer.Recognition.Grammar buildDTMFGrammar()
        {
            string ValidDigits = "0123456789";
            // Create the root rule and set its scope
            SrgsRule rootRule = new SrgsRule("Rule1");
            rootRule.Scope = SrgsRuleScope.Public;

            // Create the oneof
            SrgsOneOf oneOf = new SrgsOneOf();

            // Create the slot name to use
            string slotName = "slot";

            // Create the items (need and inner and an outer to get
            // all the tags to work properly
            SrgsItem itemInner;
            SrgsItem itemOuter = new SrgsItem();

            // Create the first tag. We have to do it in two parts because the "{}"
            // part of the tag creates havoc with string.foramt()
            SrgsSemanticInterpretationTag sr3 = new SrgsSemanticInterpretationTag();
            string tagPartA = string.Format("$.{0} = $.{1} ? $.{2} : ", slotName, slotName, slotName);
            string tagPartB = string.Format("; $.{0}._value = \"\"", slotName);
            sr3.Script = tagPartA + "{}" + tagPartB;
            // Add the tag at the root level
            rootRule.Add(sr3);

            itemOuter.SetRepeat(1, 4);
            rootRule.Add(itemOuter);

            foreach (char t in ValidDigits)
            {
                itemInner = new SrgsItem(t.ToString());
                oneOf.Add(itemInner);
                SrgsSemanticInterpretationTag sr2 = new SrgsSemanticInterpretationTag();
                sr2.Script = "$._value = \"" + t.ToString() + "\"";
                itemInner.Add(sr2);
            }

            itemOuter.Add(oneOf);

            SrgsSemanticInterpretationTag sr4 = new SrgsSemanticInterpretationTag();
            sr4.Script = string.Format("$.{0}._value = $.{1}._value + $._value", slotName, slotName);
            itemOuter.Add(sr4);

            // Create the SRGS Document for A DTMF gramamr and add the root rule
            SrgsDocument srgsDocument = new SrgsDocument();
            srgsDocument.Mode = SrgsGrammarMode.Dtmf;


            srgsDocument.Rules.Add(rootRule);
            srgsDocument.Root = rootRule;
            string filePath = @"e:\mylogs\test.grxml";

            XmlTextWriter writer = new XmlTextWriter(filePath, System.Text.Encoding.UTF8);
            srgsDocument.WriteSrgs(writer);
            writer.Flush();
            writer.Close();
            Microsoft.SpeechServer.Recognition.Grammar dynamicGrammar = new Microsoft.SpeechServer.Recognition.Grammar(srgsDocument);

            return dynamicGrammar;
        }


 



After creating the grammar and assigning it to my questionAnswerActivity I was faced with the problem of how to get the recognition results. Since the grammar “slots” are created at runtime I can’t just use the standard method of referencing the key value – I don’t know the key name at coding time. The first thing I did was to search the forums on GotSpeech.Net but I didn’t find an answer there though I did get some ideas. Then I asked a few developer friends but it seemed no one had done anything quite like this. I was on my own on this one.



Well I thought of several approaches but none seem to practical. Most wouldn’t even compile for some reason or another or gave error messages about no public GetEnumerator. Well after spending some time in the debugger looking at the RecognitionResult object this is what I came up with. (note: I realize this will overwrite the values each time through the foreach loop but this was just to test that I can get to the proper values. In a real world app you would need to save them off).



            string password;
            string key;

            foreach (System.Collections.Generic.KeyValuePair <string, SemanticValue> si in this.questionAnswerActivity1.RecognitionResult.Semantics)
            {
                key = si.Key;
                password = si.Value.Value.ToString();
            }


I hope this helps someone and saves them some time.

2010 New Year’s Resolutions

Happy New year everyone!

2009 was a great year for OCS. For how good it was and where we should be going in 2010 see Unified Communications 2009 – A year in review by my friend and fellow OCS MVP Joe Schurman.

It is customary at this time of the year to make predictions and resolutions for the new year. I’m not very good at predicting things so I thought I would list my professional resolutions for 2010. These are the technologies and software that I want to become more proficient at this year.

Silverlight – I think that Silverlight will make a great web based front end for OCS. With it you will be able to provide chats between customers and your tech support staff or your customer service agents. The eLearning modules on GotSpeech are done in Silverlight and it is about time I put some effort into mastering it. The Expression Studio suite of tool sis something that I want to sink myself into.

Powershell – I’ve played around with this some and I love it. I want to learn how to use it to automate OCS and Speech Server tasks. Still need to find a development environment for it that I like and feel comfortable with.

Brekeke PBX- This is something I want to install and learn how to use. I have an 8 port  Dialogic Media Gateway in my home lab but I want to be able to setup the lab for direct SIP. First though I need a cheap (read free) SIP provider that I can use.

FreeSWITCH – Same reasons as above except that this is free and will allow small independent developers to setup their own environments without the costs of expensive hardware or software solutions. Many of my readers are using it so I need to know more about it. I’m looking forward to learning from the series that Brian has started on FreeSWITCH. I’m anxiously waiting for part 2.

UCMA 2.0 – This is the future of Speech development and I would like to delve deeper into it. I am convinced that there is going to be a huge need for developers that can enhance, extend and integrate OCS into enterprise level business processes. I would really like to get better at this and I am anxious to get my hands on the next release. I also think there will be a huge market this year for OCS/UCMA developer training. It would be very time consuming to develop OCS training but I think the need is there.

Then there are things like Wave 14 or OCS 2010, Office 2010, Exchange 2010  and Visual Studio 2010 that are just over the horizon.  Also, there is WCF, WPF and Linq that I have been avoiding as they don’t fit that well with Speech Server. But with OCS which has a visual interface and the possibility of extending things like Communicator there is so much for me to add to to my tool belt. Its going to be a busy year and I will need to budget my time accordingly.

And lastly I want to blog more and put more time into GotSpeech.Net and GotUC.Net. I want to get out an speak more as well as evangelize all the fascinating things that make up doing Unified Communications the Microsoft way.

Yes, 2010 is looking like a busy year for me.