Partilhar via


OnClientFailed Property

  Microsoft Speech Technologies Homepage

Gets or sets the name of a client-side function that is called when Computer Supported Telecommunications Applications (CSTA) returns a FAILED event. Read/write.

Usage

ASP.NET markup: <speech:MakeCall OnClientFailed="..." />
Get value: String = MakeCall.OnClientFailed;
Set value: MakeCall.OnClientFailed = String;
Data type: String
Required: No

Remarks

The value of the OnClientFailed property is the name of this custom client-side script function, without parameters or parentheses. The client-side dialog manager calls this function, using the following syntax, when CSTA returns a FAILED event.

The script block that contains this function should be placed before the control that calls the function. For more information, see "Placement of Script Blocks" in Authoring Notes.

Syntax

bool FunctionName ( object sender, object cstaMessageDomObject )
{
     // Client-side code referenced by MakeCall.OnClientFailed 
}

Parameters

  • sender
    The client-side MakeCall object.
  • cstaMessageDomObject
    The Microsoft.SpeechServer.Dom.Results.Element object that contains the Smex message.

Return Value

True if the dialog manager should continue on the same page, and False if it should navigate to the default error page.

Example

In the following example, the routine specified by the OnClientFailed property parses the CSTA message that is associated with the failed telephone call. The routine extracts the called phone number and the cause of the error from the message and writes a log entry that records this information.

<script>
  function myClientConnected(obj, cstaMessageDomObject) {
    // OnClientConnected routine
    return true;
  }
  function myClientFailed(obj, mySmex) {
    var cnum, cause;
    cnum = mySmex.selectSingleNode("/csta:FailedEvent/csta:calledDevice/csta:deviceIdentifier").text;
    cause = mySmex.selectSingleNode("/csta:FailedEvent/csta:cause").text;
    LogMessage("MakeCall error", "Number: " + cnum + ", Cause: " + cause );
    return false;
  }
</script>
<form id="Form1" method="post" runat="server">
  ...
  <speech:MakeCall 
    ID="makeCall1"  
    autopostback="False"
    CallingDevice="0"
    CalledDirectoryNumber="<%# PhoneNo %>"
    OnClientConnected="myClientConnected"
    OnClientFailed="myClientFailed"
    runat="server" />
  ...
</form>

See Also

MakeCall Class | MakeCall Constructor | MakeCall Members | MakeCall Properties | MakeCall Methods | MakeCall Events | MakeCall Remarks