Share via


SpeechControl.CurrentCall Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Gets the current active CallInfo object or null if no call is active. Read-only.

Namespace: Microsoft.Speech.Web.UI
Assembly: Microsoft.Speech.Web (in microsoft.speech.web.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
<DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)> _
Public ReadOnly Property CurrentCall As CallInfo
[BrowsableAttribute(false)] 
[DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Hidden)] 
public CallInfo CurrentCall { get; }

Remarks

If no call is in progress, the CallInfo object that is returned contains null strings in its DeviceID, CallID, CallingDevice, and CalledDevice properties.

All Speech Controls and Call Management Controls that derive from the SpeechControl class inherit the CurrentCall property.

Example

Each node in the following XML file references one of the Speech Server sample Web-based voice response applications. The example code uses the CurrentCall property of the AnswerCall control to obtain the number entered by the user, selects the XML node with that number, extracts the name of the application page from that node, and redirects to that application page.

<?xml version="1.0" encoding="utf-8" ?>
<StartPageMapping>
  <Sample Number="1" Path="SampleApplications/WebApplications/UserInputAndResults/Page1.aspx" />
  <Sample Number="2" Path=" SampleApplications/WebApplications/SilenceAndLowConf/Page1.aspx" />
  <Sample Number="3" Path=" SampleApplications/WebApplications/NaturalPromptOutput/Page1.aspx" />
  <Sample Number="4" Path=" SampleApplications/WebApplications/ConfirmationAndCorrection/Page1.aspx" />
  <Sample Number="5" Path=" SampleApplications/WebApplications/CommandsAndContextHelp/Page1.aspx" />
  <Sample Number="6" Path=" SampleApplications/WebApplications/UsingDTMF/Page1.aspx" />
  <Sample Number="7" Path=" SampleApplications/WebApplications/CentralizedSettings/Page1.aspx" />
  <Sample Number="8" Path=" SampleApplications/WebApplications/PageTransitionPrompt/Page1.aspx" />
  <Sample Number="9" Path=" SampleApplications/WebApplications/SelectingFromList/Page1.aspx" />
  <Sample Number="10" Path=" SampleApplications/WebApplications/PhoneNumber/Page1.aspx" />
  <Sample Number="11" Path=" SampleApplications/WebApplications/DatesAndValidation/Page1.aspx" />
  <Sample Number="12" Path=" SampleApplications/WebApplications/CreditCardInfo/CreditCardInfo.aspx" />
  <Sample Number="13" Path=" SampleApplications/WebApplications/TableNavigation/Page1.aspx" />
</StartPageMapping>

<script runat="server" language="C#">
  void OnServerDelivered(object sender, EventArgs e)
  {
    AnswerCall  mcobj = (AnswerCall)sender;
    System.Xml.XmlNode theNode = null;
    try 
    {
      System.Xml.XmlDocument mappingList = new System.Xml.XmlDocument();
      string theFile = Page.MapPath("ApplicationsStartPageMappings.xml");
      if (System.IO.File.Exists(theFile) == false) 
        throw(new Exception(theFile + " does not exist"));
      mappingList.Load(theFile);
      theNode = mappingList.SelectSingleNode("/StartPageMapping/Sample[@Number=" + 

mcobj.CurrentCall.CalledDevice.ToString() + "]");
    } 
    catch (Exception ex) 
    {
      throw(new Exception("Failed to load StartPageMappings.xml", ex));
    }
    if (theNode != null) 
    {
      try 
      {
        string theUrl = theNode.Attributes["Path"].Value.ToString();
        AnswerCall1.Redirect(theUrl);
      }
      catch (Exception ex) 
      {
        throw(new Exception("Failed to find URL to redirect to", ex));
      }
    }
  }
</script>
<form id="Form1" method="post" runat="server">
  ...
  <speech:AnswerCall id="AnswerCall1" 
    autopostback="true"
    CallingDevice="0"
    OnDelivered="OnServerDelivered"
    runat="server" />
  <speech:DisconnectCall id="DisconnectCall1" 
    autopostback="false"
    runat="server" />
  ...
</form>

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

Windows Server 2003

See Also

Reference

SpeechControl Class
SpeechControl Members
Microsoft.Speech.Web.UI Namespace