Click or drag to resize

VoiceResourcePlayNumber Method

Plays the specified string as a number using the specified Format Spoken and the voice resource's VAP file.

Namespace:  VoiceElements.Client
Assembly:  VoiceElementsClient (in VoiceElementsClient.dll) Version: 8.6.1.1
Syntax
public TerminationCode PlayNumber(
	string numberString
)

Parameters

numberString
Type: SystemString
The string to play as a number using the Format Spoken.

Return Value

Type: TerminationCode
A Termination Code indicating how the play ended. Typically, you will use this to determine what to do next.
Remarks
Make Sure to Set The VAP File

This method compiles pieces from an indexed sound file or VAP File. You must specify the file to use in the Voice Resource'sVAP File Property prior to using this method or it may play silence.

Format Spoken and Effect on Playback

You may set Format Spoken to the following and the number will be played in different ways.

  • Standard - 1026.6 will be played as "one zero two six point six".
  • Intelligently - 1026.6 will be played as "one thousand twenty six point six".
  • Currency - 1026.6 will be played as "one thousand twenty six dollars and sixty cents".

Examples
The following sample code firstly code sets up a Channel Resource, Dials a Call, retrieves a Voice Resource, sets the VAP File Property of the Voice Rescource, waits for a second and then plays the number string "1026.6" in all three different ways by switching the Format Spoken.
public void DialOutAndPlayNumbers()
{
    // To get a channel, you must first get a link to a Telephony Server.  You may need to pass a username password here.
    TelephonyServer m_TelephonyServer = new TelephonyServer();

    // Get your channel resource from the server
    ChannelResource m_ChannelResource = m_TelephonyServer.GetChannel();

    // Example 1: Dial an oubound call
    string phoneNumber = "2135551212";
    m_ChannelResource.Dial(phoneNumber);

    // Get the voice resource and store in a variable for local use
    VoiceResource m_VoiceResource = m_ChannelResource.VoiceResource;

    // Set the vap file property to the one included with Voice Elements
    m_VoiceResource.VapFile = "English.vap";

    // Standard - 1026.6 will be played as "one zero two six point 6".
    m_VoiceResource.FormatSpoken = FormatSpoken.Standard;
    m_VoiceResource.PlayNumber("1026.6");

    // Intelligently - 1026.6 will be played as "one thousand twenty six point five".
    m_VoiceResource.FormatSpoken = FormatSpoken.Intelligently;
    m_VoiceResource.PlayNumber("1026.6");

    // Currency - 1026.6 will be played as "one thousand twenty six dollars and sixty cents".
    m_VoiceResource.FormatSpoken = FormatSpoken.Currency;
    m_VoiceResource.PlayNumber("1026.6");

    // Take your code from here ... 
}
See Also