Cookie CSS

Saturday, January 30, 2016

Using Cortana in Windows 10 to Automate Skype For Business Part II

Last week we started down the path of using Cortana to automate functions in Skype for Business.  This week we will pick up where we left off.  We already saw how to manually code a Phraselist in our XML file, now we'll learn how we make Cortana be able to tell the difference between Derek Ritten and Derek Riser.


The video above shows me using my voice to say "Transfer call to Derek Riser."  So how do we get Cortana to distinguish between 658 different names?



string s = "Derek Riser|Derek Tosset|Derek Jones";

List<string> phrases = new List<string>();

foreach (string s in result.Split('|'))
{
     phrases.Add(s);
}

Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinition vcDef;

if (Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.InstalledCommandDefinitions.TryGetValue("
S4BCommandSet_en-us", out vcDef))
{
     await vcDef.SetPhraseListAsync("
destination", phrases);
}

In my case I pull the variable s via a network socket from the Bridge Operator Console project, giving me all the names in my Skype for Business ecosystem.  If you notice where we specifiy "S4BCommandSet_en-us" in our definition install command, that ties our in our XML file here.  I also color coded destination in green in both the command the XML so you can see how they relate.


<?xml version="1.0" encoding="utf-8" ?>
<VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.2">
  <CommandSet xml:lang="en-us" Name="S4BCommandSet_en-us">
    <CommandPrefix>Gideon</CommandPrefix>
    <Example>Transfer call to, Hold call, Answer call</Example>

    <Command Name="Transfer">
      <Example> Transfer call to Doug Routledge </Example>
      <ListenFor> Transfer call to {destination} </ListenFor>
      <Feedback> Ok I am transfering this call to {destination} </Feedback>
      <Navigate/>
    </Command>

    <Command Name="Park">
      <Example> Park call for Doug Routledge </Example>
      <ListenFor> Park call for {destination} </ListenFor>
      <Feedback> Ok I am parking this call for {destination} </Feedback>
      <Navigate/>
    </Command>

    <Command Name="SetStatus">
      <Example> Set my status to Busy </Example>
      <ListenFor> Set my status to {status} </ListenFor>
      <Feedback> Ok I set your status to {status} </Feedback>
      <Navigate/>
    </Command>

    <PhraseList Label="destination">
      <!--<Item> I will fill in from code </Item>-->
    </PhraseList>

    <PhraseList Label="status">
      <Item> Busy </Item>
      <Item> Do No Disturb </Item>
      <Item> Available </Item>
      <Item> Be Right Back </Item>
      <Item> Appear Away </Item>
      <Item> Off Work </Item>
    </PhraseList>

  </CommandSet>
  <!-- Other CommandSets for other languages  RequireAppName="BeforeOrAfterPhrase">-->
</VoiceCommands>

Next week, we'll learn how to react to a voice command.

Doug Routledge, C# Lync, Skype for Business, SQL, Exchange, UC Developer  BridgeOC
Twitter - @droutledge @ndbridge




No comments:

Post a Comment

Any spam comments will be deleted and your user account will be disabled.