right  Talk To Us!

get number Action

Get a number entered as a series of digit keypresses. You can set a prompt and configure how many digits are required or the digit that signifies the end of the number. This action is simpler to use than get input for digit input.

language wrappers and examples

The get number properties are:

PropertyRequired/OptionalDefaultDescription
next pagerequiredA web page request object that defines the web page to be requested once the get number action has completed successfully. The digits entered will be sent to this page.
promptoptional-A play action that can prompt for digits.
digit countoptional0The number of digits to enter. 0 signifies an unlimited number of digits, in which case end digit must be set.
end digitoptional"#"A single digit that, when pressed, will indicate the end of the number. An empty string signifies no end digit, in which case digit count must not be zero. Valid digits are 0123456789ABCD#*.
valid digitsoptional"0123456789"A string that represents the set of digits that are deemed to be valid. Note that the help digit and end digit are also valid entries in addition to those set here. Any valid Dual Tone Multi Frequency (DTMF) digit can be included in this string. Valid digits are 0123456789ABCD#*.
help digitoptional"*"A single digit that, when pressed, will result in the prompt being repeated. An emtpy string signifies no help digit. Valid digits are 0123456789ABCD#*.
seconds timeout
from API V2.0
optional30The time in seconds that the action waits for input to complete after the prompt has finished. A value of 0 means that the action will return immediately with whatever digits are currently available.
milliseconds inter digit timeout
from API V2.0
optional5000An integer. The time period in milliseconds that the action waits for each consecutive digit to be entered. A value of 0 or a negative value signifies that this timeout is disabled.
milliseconds initial timeout
from API V2.0
optionalmilliseconds inter digit timeoutAn integer. The time period in milliseconds that the action waits for the initial digit to be entered. A value of 0 or a negative value signifies that this timeout is disabled. If this value is omitted the value of milliseconds inter digit timeout is used.
on digit timeout messagesoptional"Sorry, I did not hear that.",
"Please listen to the instructions and then use your telephone keypad to enter a valid number."
An array of play actions. This defines messages to play if no digit is pressed within the digit timeout period. Each play action in the array is played once for each successive timeout. When all messages have been played the get number action finishes. Note that barge in is disabled by default for these actions.
on invalid digit messagesoptional"Sorry, that was not a valid number.",
"Please listen to the instructions and enter a valid number."
An array of play actions. This defines messages to play if an invalid digit is pressed (a digit that is not defined in valid digits). Each play action in the array is played once for each successive invalid digit. When all messages have been played the get number action finishes. Note that barge in is disabled by default for these actions.

Remarks

get number supports typing ahead. It inspects any digits that have already been cached from barge in on a preceding play action. If they are valid digits they prefix any digits subsequently entered. If these digits on their own satisfy digit count or end digit this action will return immediately.

To avoid this behaviour you can insert a clear input action after the play action.

Returns

The digits entered will be returned via the subsequent HTTP Request to the next page in the action result as follows:

PropertyAvailabilityDescription
entered numberalwaysA string of the digits that were entered in response to the prompt. The end digit, if entered, is not returned in this string.



  • Examples:

    • Get a variable length number using the defaults (ending with a '#'):

      "get_number" : 
      {
          "prompt" : 
          {
              "play" :
              {
                  "play_list" :
                  [
                      {
                          "text_to_say" : "Please enter your number followed by a hash."
                      }
                  ]
              }
          },
          "next_page" : 
          {
              "url" : "usenumberpage"
          }
      }
      

      The following may be returned when a number is successfully entered followed by '#':

      "action_result" :
      {
          "action" : "get_number",
          "result" :
          {
              "entered_number" : "0287368394"
          }
      }
      
    • Get a 16 digit number using the defaults:

      "get_number" : 
      {
          "prompt" : 
          {
              "play" :
              {
                  "play_list" :
                  [
                      {
                          "text_to_say" : "Please enter your 16 digit number"
                      }
                  ]
              }
          },
          "digit_count" : 16,
          "end_digit" : "",
          "next_page" : 
          {
              "url" : "usenumberpage"
          }
      }
      

      The following may be returned when a number is successfully entered:

      "action_result" :
      {
          "action" : "get_number",
          "result" :
          {
              "entered_number" : "8825620287368394"
          }
      }
      
    • Get a 4 digit number containing digits 1-8:

      "get_number" : 
      {
          "prompt" : 
          {
              "play" :
              {
                  "play_list" :
                  [
                      {
                          "text_to_say" : "Please enter 4 digits between 1 and 8"
                      }
                  ]
              }
          },
          "digit_count" : 4,
          "end_digit" : "",
          "valid_digits" : "12345678",
          "next_page" : 
          {
              "url" : "usenumberpage"
          }
      }
      

      The following may be returned when a 4 digit number is successfully entered:

      "action_result" :
      {
          "action" : "get_number",
          "result" :
          {
              "entered_number" : "6816"
          }
      }
      
    • Get a variable length number containing digits 0-9, ending with a '#':

      "get_number" : 
      {
          "prompt" : 
          {
              "play" :
              {
                  "play_list" :
                  [
                      {
                          "text_to_say" : "Please enter your id followed by a hash"
                      }
                  ]
              }
          },
          "digit_count" : 0,
          "end_digit" : "#",
          "help_digit" : "*",
          "milliseconds_inter_digit_timeout" : 10000,
          "on_digit_timeout_messages" : 
          [
              {  
                  "play" : 
                  {
                      "play_list" :
                      [
                          "file_to_play" : "silencemessage1.wav"
                      ]
                  }
              },
              {  
                  "play" : 
                  {
                      "play_list" :
                      [
                          "file_to_play" : "silencemessage2.wav"
                      ]
                  }
              }
          ],
          "on_invalid_digit_messages" : 
          [
              {
                  "play" : 
                  {
                      "play_list" :
                      [
                          "text_to_say" : "Please enter only numeric digits followed by a hash"
                      ]
                  }
              },
              {
                  "play" : 
                  {
                      "play_list" :
                      [
                          "text_to_say" : "No really!",
                          "text_to_say" : "Please enter only numeric digits followed by a hash"
                      ]
                  }
              }
          ],
          "next_page" : 
          {
              "url" : "usenumberpage"
          }
      }
      

      The following may be returned when a number is successfully entered followed by a '#':

      "action_result" :
      { 
          "action" : "get_number",
          "result" :
          {
              "entered_number" : "716723"
          }
      }
      
  • GetNumber Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    An action to prompt the caller to enter a number and wait for it to be entered.

    • public class GetNumber : TelephonyAction
      {
          // Constructors
          [Obsolete] public GetNumber(Play prompt);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage, int digitCount);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage, char endDigit);
          public GetNumber(WebPageRequest nextPage, Play prompt = null, int? digitCount = null, char? endDigit = null);
      
          // Members
          public Play Prompt;
          public int DigitCount;
          public char EndDigit;
          public String ValidDigits;
          public char HelpDigit;
          public int SecondsTimeout;
          public int MillisecondsInitialTimeout;
          public int MillisecondsInterDigitTimeout;
          [Obsolete] public int SecondsDigitTimeout;
          public List<Play> OnDigitTimeoutMessages;
          public List<Play> OnInvalidDigitMessages;
          public WebPageRequest NextPage;
      }
      

      Examples:

      • Get a variable length number using the defaults (ending with a '#'):

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your number followed by a hash.");
        var getInputAction = new GetInput(new WebPageRequest("UseNumberPage.aspx"), prompt)
        {
            DigitInputEnabled = false
        };
        actions.Add(getInputAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a 16 digit number using the defaults:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your 16 digit number.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.DigitCount = 16;
        getNumberAction.EndDigit = '\0';
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a 4 digit number containing digits 1-8:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter 4 digits between 1 and 8.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.DigitCount = 4;
        getNumberAction.EndDigit = '\0';
        getNumberAction.ValidDigits = "12345678";
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a variable length number containing digits 0-9, ending with a '#':

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your id followed by a hash.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.MillisecondsInterDigitTimeout = 10000;
        

        Set up the message to play if the caller does not enter a number or enters an invalid digit:

        var digitTimeoutMessages = new List<Play>();
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage1.wav"));
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage2.wav"));
        getNumberAction.OnDigitTimeoutMessages = digitTimeoutMessages;
        
        var invalidDigitMessages = new List<Play>();
        invalidDigitMessages.Add(Play.SayText("Please enter only numeric digits followed by a hash"));
        var secondMessage = Play.SayText("No really!");
        secondMessage.AddText("Please enter only numeric digits followed by a hash");
        invalidDigitMessages.Add(secondMessage);
        getNumberAction.OnInvalidDigitMessages = invalidDigitMessages;
        
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
    • public class GetNumber : TelephonyAction
      {
          // Constructors
          [Obsolete] public GetNumber(Play prompt);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage, int digitCount);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage, char endDigit);
          public GetNumber(WebPageRequest nextPage, Play prompt = null, int? digitCount = null, char? endDigit = null);
      
          // Members
          public Play Prompt;
          public int DigitCount;
          public char EndDigit;
          public String ValidDigits;
          public char HelpDigit;
          public int SecondsTimeout;
          public int MillisecondsInitialTimeout;
          public int MillisecondsInterDigitTimeout;
          [Obsolete] public int SecondsDigitTimeout;
          public List<Play> OnDigitTimeoutMessages;
          public List<Play> OnInvalidDigitMessages;
          public WebPageRequest NextPage;
      }
      

      Examples:

      • Get a variable length number using the defaults (ending with a '#'):

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your number followed by a hash.");
        var getInputAction = new GetInput(new WebPageRequest("UseNumberPage.aspx"), prompt)
        {
            DigitInputEnabled = false
        };
        actions.Add(getInputAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a 16 digit number using the defaults:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your 16 digit number.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.DigitCount = 16;
        getNumberAction.EndDigit = '\0';
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a 4 digit number containing digits 1-8:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter 4 digits between 1 and 8.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.DigitCount = 4;
        getNumberAction.EndDigit = '\0';
        getNumberAction.ValidDigits = "12345678";
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a variable length number containing digits 0-9, ending with a '#':

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your id followed by a hash.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.MillisecondsInterDigitTimeout = 10000;
        

        Set up the message to play if the caller does not enter a number or enters an invalid digit:

        var digitTimeoutMessages = new List<Play>();
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage1.wav"));
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage2.wav"));
        getNumberAction.OnDigitTimeoutMessages = digitTimeoutMessages;
        
        var invalidDigitMessages = new List<Play>();
        invalidDigitMessages.Add(Play.SayText("Please enter only numeric digits followed by a hash"));
        var secondMessage = Play.SayText("No really!");
        secondMessage.AddText("Please enter only numeric digits followed by a hash");
        invalidDigitMessages.Add(secondMessage);
        getNumberAction.OnInvalidDigitMessages = invalidDigitMessages;
        
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
    • public class GetNumber : TelephonyAction
      {
          // Constructors
          [Obsolete] public GetNumber(Play prompt);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage, int digitCount);
          [Obsolete] public GetNumber(Play prompt, WebPageRequest nextPage, char endDigit);
          public GetNumber(WebPageRequest nextPage, Play prompt = null, int? digitCount = null, char? endDigit = null);
      
          // Members
          public Play Prompt;
          public int DigitCount;
          public char EndDigit;
          public String ValidDigits;
          public char HelpDigit;
          public int SecondsTimeout;
          public int MillisecondsInitialTimeout;
          public int MillisecondsInterDigitTimeout;
          [Obsolete] public int SecondsDigitTimeout;
          public List<Play> OnDigitTimeoutMessages;
          public List<Play> OnInvalidDigitMessages;
          public WebPageRequest NextPage;
      }
      

      Examples:

      • Get a variable length number using the defaults (ending with a '#'):

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your number followed by a hash.");
        var getInputAction = new GetInput(new WebPageRequest("UseNumberPage.aspx"), prompt)
        {
            DigitInputEnabled = false
        };
        actions.Add(getInputAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a 16 digit number using the defaults:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your 16 digit number.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.DigitCount = 16;
        getNumberAction.EndDigit = '\0';
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a 4 digit number containing digits 1-8:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter 4 digits between 1 and 8.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.DigitCount = 4;
        getNumberAction.EndDigit = '\0';
        getNumberAction.ValidDigits = "12345678";
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
      • Get a variable length number containing digits 0-9, ending with a '#':

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var prompt = Play.SayText("Please enter your id followed by a hash.");
        var getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage.aspx"), prompt);
        getNumberAction.MillisecondsInterDigitTimeout = 10000;
        

        Set up the message to play if the caller does not enter a number or enters an invalid digit:

        var digitTimeoutMessages = new List<Play>();
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage1.wav"));
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage2.wav"));
        getNumberAction.OnDigitTimeoutMessages = digitTimeoutMessages;
        
        var invalidDigitMessages = new List<Play>();
        invalidDigitMessages.Add(Play.SayText("Please enter only numeric digits followed by a hash"));
        var secondMessage = Play.SayText("No really!");
        secondMessage.AddText("Please enter only numeric digits followed by a hash");
        invalidDigitMessages.Add(secondMessage);
        getNumberAction.OnInvalidDigitMessages = invalidDigitMessages;
        
        actions.Add(getNumberAction);
        

        Obtain the number entered from the action's next page request:

        // Unpack the request
        var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request);
        
        var getNumberResult = (GetNumberResult)telephonyRequest.InstanceInfo.ActionResult;
        var enteredNumber = getNumberResult.EnteredNumber;
        
  • GetNumber Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    An action to prompt the caller to enter a number and wait for it to be entered.

    • Public Class GetNumber
          Inherits TelephonyAction
      
          ' Constructors
          [Obsolete] Public Sub New (prompt As Play)
          [Obsolete] Public Sub New (prompt As Play, nextPage As Webpagerequest)
          [Obsolete] Public Sub New (prompt As Play, nextPage As Webpagerequest, digitCount As Integer)
          [Obsolete] Public Sub New (prompt As Play, nextPage As Webpagerequest, endDigit As Char)
          Public Sub New (nextPage As Webpagerequest, Optional prompt As Play = Nothing, Optional digitCount As Integer? = Nothing, Optional endDigit As Char? = Nothing)
      
          ' Members
          Public Property Prompt As Play
          Public Property DigitCount As Integer
          Public Property EndDigit As Char
          Public Property ValidDigits As String
          Public Property HelpDigit As Char
          Public Property SecondsTimeout As Integer
          Public Property MillisecondsInitialTimeout As Integer
          Public Property MillisecondsInterDigitTimeout As Integer
          [Obsolete] Public Property SecondsDigitTimeout As Integer
          Public Property OnDigitTimeoutMessages As List(Of Play)
          Public Property OnInvalidDigitMessages As List(Of Play)
          Public Property NextPage As Webpagerequest
      End Class
      

      Examples:

      • Get a variable length number using the defaults (ending with a '#'):

        Dim actions = New List(Of TelephonyAction)
        
        Dim prompt = Play.SayText("Please enter your number followed by a hash.")
        Dim getInputAction = New GetInput(New WebPageRequest("UseNumberPage.aspx"), prompt)
        getInputAction.DigitInputEnabled = False
        actions.Add(getInputAction)
        

        Obtain the number entered from the action's next page request:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim getNumberResult As GetNumberResult = telephonyRequest.InstanceInfo.ActionResult
        Dim enteredNumber = getNumberResult.EnteredNumber
        
      • Get a 16 digit number using the defaults:

        Dim actions = New List(Of TelephonyAction)
        
        Dim prompt = Play.SayText("Please enter your 16 digit number.")
        Dim getNumberAction = New GetNumber(New WebPageRequest("UseNumberPage.aspx"), prompt)
        getNumberAction.DigitCount = 16
        getNumberAction.EndDigit = Chr(0)
        actions.Add(getNumberAction)
        

        Obtain the number entered from the action's next page request:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim getNumberResult As GetNumberResult = telephonyRequest.InstanceInfo.ActionResult
        Dim enteredNumber = getNumberResult.EnteredNumber
        
      • Get a 4 digit number containing digits 1-8:

        Dim actions = New List(Of TelephonyAction)
        
        Dim prompt = Play.SayText("Please enter 4 digits between 1 and 8.")
        Dim getNumberAction = New GetNumber(New WebPageRequest("UseNumberPage.aspx"), prompt)
        getNumberAction.DigitCount = 4
        getNumberAction.EndDigit = Chr(0)
        getNumberAction.ValidDigits = "12345678"
        actions.Add(getNumberAction)
        

        Obtain the number entered from the action's next page request:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim getNumberResult As GetNumberResult = telephonyRequest.InstanceInfo.ActionResult
        Dim enteredNumber = getNumberResult.EnteredNumber
        
      • Get a variable length number containing digits 0-9, ending with a '#':

        Dim actions = New List(Of TelephonyAction)
        
        Dim prompt = Play.SayText("Please enter your id followed by a hash.")
        Dim getNumberAction = New GetNumber(New WebPageRequest("UseNumberPage.aspx"), prompt)
        getNumberAction.MillisecondsInterDigitTimeout = 10000
        

        Set up the message to play if the caller does not enter a number or enters an invalid digit:

        Dim digitTimeoutMessages = New List(Of Play)
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage1.wav"))
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage2.wav"))
        getNumberAction.OnDigitTimeoutMessages = digitTimeoutMessages
        
        Dim invalidDigitMessages = New List(Of Play)
        invalidDigitMessages.Add(Play.SayText("Please enter only numeric digits followed by a hash"))
        Dim secondMessage = Play.SayText("No really!")
        secondMessage.AddText("Please enter only numeric digits followed by a hash")
        invalidDigitMessages.Add(secondMessage)
        getNumberAction.OnInvalidDigitMessages = invalidDigitMessages
        
        actions.Add(getNumberAction)
        

        Obtain the number entered from the action's next page request:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim getNumberResult As GetNumberResult = telephonyRequest.InstanceInfo.ActionResult
        Dim enteredNumber = getNumberResult.EnteredNumber
        
    • Public Class GetNumber
          Inherits TelephonyAction
      
          ' Constructors
          [Obsolete] Public Sub New (prompt As Play)
          [Obsolete] Public Sub New (prompt As Play, nextPage As Webpagerequest)
          [Obsolete] Public Sub New (prompt As Play, nextPage As Webpagerequest, digitCount As Integer)
          [Obsolete] Public Sub New (prompt As Play, nextPage As Webpagerequest, endDigit As Char)
          Public Sub New (nextPage As Webpagerequest, Optional prompt As Play = Nothing, Optional digitCount As Integer? = Nothing, Optional endDigit As Char? = Nothing)
      
          ' Members
          Public Property Prompt As Play
          Public Property DigitCount As Integer
          Public Property EndDigit As Char
          Public Property ValidDigits As String
          Public Property HelpDigit As Char
          Public Property SecondsTimeout As Integer
          Public Property MillisecondsInitialTimeout As Integer
          Public Property MillisecondsInterDigitTimeout As Integer
          [Obsolete] Public Property SecondsDigitTimeout As Integer
          Public Property OnDigitTimeoutMessages As List(Of Play)
          Public Property OnInvalidDigitMessages As List(Of Play)
          Public Property NextPage As Webpagerequest
      End Class
      

      Examples:

      • Get a variable length number using the defaults (ending with a '#'):

        Dim actions = New List(Of TelephonyAction)
        
        Dim prompt = Play.SayText("Please enter your number followed by a hash.")
        Dim getInputAction = New GetInput(New WebPageRequest("UseNumberPage.aspx"), prompt)
        getInputAction.DigitInputEnabled = False
        actions.Add(getInputAction)
        

        Obtain the number entered from the action's next page request:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim getNumberResult As GetNumberResult = telephonyRequest.InstanceInfo.ActionResult
        Dim enteredNumber = getNumberResult.EnteredNumber
        
      • Get a 16 digit number using the defaults:

        Dim actions = New List(Of TelephonyAction)
        
        Dim prompt = Play.SayText("Please enter your 16 digit number.")
        Dim getNumberAction = New GetNumber(New WebPageRequest("UseNumberPage.aspx"), prompt)
        getNumberAction.DigitCount = 16
        getNumberAction.EndDigit = Chr(0)
        actions.Add(getNumberAction)
        

        Obtain the number entered from the action's next page request:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim getNumberResult As GetNumberResult = telephonyRequest.InstanceInfo.ActionResult
        Dim enteredNumber = getNumberResult.EnteredNumber
        
      • Get a 4 digit number containing digits 1-8:

        Dim actions = New List(Of TelephonyAction)
        
        Dim prompt = Play.SayText("Please enter 4 digits between 1 and 8.")
        Dim getNumberAction = New GetNumber(New WebPageRequest("UseNumberPage.aspx"), prompt)
        getNumberAction.DigitCount = 4
        getNumberAction.EndDigit = Chr(0)
        getNumberAction.ValidDigits = "12345678"
        actions.Add(getNumberAction)
        

        Obtain the number entered from the action's next page request:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim getNumberResult As GetNumberResult = telephonyRequest.InstanceInfo.ActionResult
        Dim enteredNumber = getNumberResult.EnteredNumber
        
      • Get a variable length number containing digits 0-9, ending with a '#':

        Dim actions = New List(Of TelephonyAction)
        
        Dim prompt = Play.SayText("Please enter your id followed by a hash.")
        Dim getNumberAction = New GetNumber(New WebPageRequest("UseNumberPage.aspx"), prompt)
        getNumberAction.MillisecondsInterDigitTimeout = 10000
        

        Set up the message to play if the caller does not enter a number or enters an invalid digit:

        Dim digitTimeoutMessages = New List(Of Play)
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage1.wav"))
        digitTimeoutMessages.Add(Play.PlayFile("silencemessage2.wav"))
        getNumberAction.OnDigitTimeoutMessages = digitTimeoutMessages
        
        Dim invalidDigitMessages = New List(Of Play)
        invalidDigitMessages.Add(Play.SayText("Please enter only numeric digits followed by a hash"))
        Dim secondMessage = Play.SayText("No really!")
        secondMessage.AddText("Please enter only numeric digits followed by a hash")
        invalidDigitMessages.Add(secondMessage)
        getNumberAction.OnInvalidDigitMessages = invalidDigitMessages
        
        actions.Add(getNumberAction)
        

        Obtain the number entered from the action's next page request:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim getNumberResult As GetNumberResult = telephonyRequest.InstanceInfo.ActionResult
        Dim enteredNumber = getNumberResult.EnteredNumber
        
  • class GetNumber extends TelephonyAction

    Represents a get number action.

    Class synopsis:

    // Constructors:
    public GetNumber(WebPageRequest nextPage)
    public GetNumber(WebPageRequest nextPage, Play prompt)
    public GetNumber(WebPageRequest nextPage, Play prompt, int digitCount)
    public GetNumber(WebPageRequest nextPage, Play prompt, char endDigit)
    
    // Members:
    public void setPrompt(Play prompt)
    public void setDigitCount(int digitCount)
    public void setEndDigit(char endDigit)
    public void setHelpDigit(char helpDigit)
    public void setValidDigits(String validDigits)
    public void setMilliSecondsInterDigitTimeout(int timeout)
    public void setMilliSecondsInitialTimeout(int timeout)
    public void setOnDigitTimeoutMessages(List<Play> messageList)
    public void setOnInvalidDigitMessages(List<Play> messageList)
    public JSONObject toJSONObject()
    
    class GetNumberResult extends ActionResult

    Represents the result of a get number action.

    Members:

    // Members:
    public String getEnteredNumber()
    

    Examples:

    • Get a variable length number using the defaults (ending with a '#'):

      List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
      
      Play prompt = Play.sayText("Please enter your number followed by a hash.");
      
      actions.add(new GetNumber(new WebPageRequest("UseNumberPage"), prompt));
      

      Obtain the number entered from the action's next page request:

      public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws IOException, ServletException
      {
          TelephonyRequest ourRequest = new TelephonyRequest(request);
          GetNumberResult numberResult = (GetNumberResult)ourRequest.getInstanceInfo().getActionResult();
          String enteredNumber = numberResult.getEnteredNumber();
      
          // Your code here...
      }
      
    • Get a 16 digit number using the defaults:

      List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
      
      Play prompt = Play.sayText("Please enter your 16 digit number.");
      
      actions.add(new GetNumber(new WebPageRequest("UseNumberPage"), prompt, 16));
      

      Obtain the number entered from the action's next page request:

      public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws IOException, ServletException
      {
          TelephonyRequest ourRequest = new TelephonyRequest(request);
          GetNumberResult numberResult = (GetNumberResult)ourRequest.getInstanceInfo().getActionResult();
          String enteredNumber = numberResult.getEnteredNumber();
      
          // Your code here...
      }
      
    • Get a 4 digit number containing digits 1-8:

      List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
      
      Play prompt = Play.sayText("Please enter 4 digits between 1 and 8.");
      GetNumber getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage"), prompt, 4);
      getNumberAction.setValidDigits("12345678");
      
      actions.add(getNumberAction);
      

      Obtain the number entered from the action's next page request:

      public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws IOException, ServletException
      {
          TelephonyRequest ourRequest = new TelephonyRequest(request);
          GetNumberResult numberResult = (GetNumberResult)ourRequest.getInstanceInfo().getActionResult();
          String enteredNumber = numberResult.getEnteredNumber();
      
          // Your code here...
      }
      
    • Get a variable length number containing digits 0-9, ending with a '#':

      List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
      
      Play prompt = Play.sayText("Please enter your id followed by a hash.");
      GetNumber getNumberAction = new GetNumber(new WebPageRequest("UseNumberPage"), prompt);
      getNumberAction.setValidDigits("0123456789");
      getNumberAction.setMilliSecondsInterDigitTimeout(10000);
      
      // Set up the messages to play if the caller does not
      // enter a number or enters an invalid digit.
      List<Play> onDigitTimeoutMessages = new ArrayList<Play>();
      onDigitTimeoutMessages.add(Play.sayText("Please enter a number."));
      onDigitTimeoutMessages.add(Play.sayText("This is your final chance to enter a number."));
      getNumberAction.setOnDigitTimeoutMessages(onDigitTimeoutMessages);
      
      List<Play> onInvalidDigitMessages = new ArrayList<Play>();
      onInvalidDigitMessages.add(Play.playFile("invalidentry.wav"));
      getNumberAction.setOnInvalidDigitMessages(onInvalidDigitMessages);
      
      actions.add(getNumberAction);
      

      Obtain the number entered from the action's next page request:

      public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws IOException, ServletException
      {
          TelephonyRequest ourRequest = new TelephonyRequest(request);
          GetNumberResult numberResult = (GetNumberResult)ourRequest.getInstanceInfo().getActionResult();
          String enteredNumber = numberResult.getEnteredNumber();
      
          // Your code here...
      }
      
  • class GetNumber

    Represents a get_number action.

    Class synopsis:

    # GetNumber object:
    GetNumber(next_page)
    
    # Instance methods:
    GetNumber.set_prompt(play_action)
    GetNumber.set_digit_count(digit_count)
    GetNumber.set_end_digit(end_digit)
    GetNumber.set_valid_digits(valid_digits)
    GetNumber.set_help_digit(help_digit)
    GetNumber.set_seconds_timeout(timeout)
    GetNumber.set_milliseconds_inter_digit_timeout(timeout)
    GetNumber.set_milliseconds_initial_timeout(timeout)
    GetNumber.set_on_digit_timeout_messages(list_of_play_actions)
    GetNumber.set_on_invalid_digit_messages(list_of_play_actions)
    
    Get Number Result

    The Get Number Result is represented by a dictionary. It is found within the action result for the next page.

    Obtaining the Get Number Result dictionary:

    my_request = TelephonyRequest(request)
    action_result = my_request.get_action_result()
    if action_result.get("action") == "get_number":
        get_number_result =  action_result.get("result")
    

    Examples:

    • Get a variable length number using the defaults (ending with a '#'):

      # Create a list of actions that will be passed to the TelephonyResponse constructor
      list_of_actions = []
      
      get_number_action = GetNumber(WebPage(url='usenumberpage'))
      get_number_action.set_prompt(Play(text_to_say='Please enter your number followed by a hash.'))
      
      list_of_actions.append(get_number_action)
      

      Obtain the number entered from the action's next page request:

      my_request = TelephonyRequest(request)
      action_result = my_request.get_action_result()
      
      if action_result.get("action") == "get_number":
      
          get_number_result =  action_result.get("result")
          entered_number = get_number_result.get("entered_number")
      
          # Your code here...
      
    • Get a 16 digit number using the defaults:

      # Create a list of actions that will be passed to the TelephonyResponse constructor
      list_of_actions = []
      
      get_number_action =  GetNumber(WebPage(url='usenumberpage'))
      
      get_number_action.set_prompt(Play(text_to_say='Please enter your 16 digit number.'))
      get_number_action.set_end_digit('')
      get_number_action.set_digit_count(16)
      
      list_of_actions.append(get_number_action)
      

      Obtain the number entered from the action's next page request:

      my_request = TelephonyRequest(request)
      action_result = my_request.get_action_result()
      
      if action_result.get("action") == "get_number":
      
          get_number_result =  action_result.get("result")
          entered_number = get_number_result.get("entered_number")
      
          # Your code here...
      
    • Get a 4 digit number containing digits 1-8:

      # Create a list of actions that will be passed to the TelephonyResponse constructor
      list_of_actions = []
      
      get_number_action =  GetNumber(WebPage(url='usenumberpage'))
      get_number_action.set_prompt(Play(text_to_say='Please enter 4 digits between 1 and 8.'))
      get_number_action.set_digit_count(4)
      get_number_action.set_end_digit('')
      get_number_action.set_valid_digits('12345678')
      
      list_of_actions.append(get_number_action)
      

      Obtain the number entered from the action's next page request:

      my_request = TelephonyRequest(request)
      action_result = my_request.get_action_result()
      
      if action_result.get("action") == "get_number":
      
          get_number_result =  action_result.get("result")
          entered_number = get_number_result.get("entered_number")
      
          # Your code here...
      
    • Get a variable length number containing digits 0-9, ending with a '#':

      # Create a list of actions that will be passed to the TelephonyResponse constructor
      list_of_actions = []
      
      list_of_play_actions_on_timeout = []
      list_of_play_actions_on_timeout.append(Play(file_to_play='silencemessage1.wav'))
      list_of_play_actions_on_timeout.append(Play(file_to_play='silencemessage2.wav'))
      
      list_of_play_actions_on_invalid = []
      list_of_play_actions_on_invalid.append(Play(text_to_say='Please enter only numeric digits followed by a hash'))
      play_action = Play(text_to_say='No really!')
      play_action.append_text(text_to_say='Please enter only numeric digits followed by a hash')
      list_of_play_actions_on_invalid.append(play_action)
      
      get_number_action =  GetNumber(WebPage(url='usenumberpage'))
      get_number_action.set_prompt(Play(text_to_say='Please enter your id followed by a hash.'))
      get_number_action.set_digit_count(4)
      get_number_action.set_end_digit('#')
      get_number_action.set_help_digit('*')
      get_number_action.set_milliseconds_inter_digit_timeout(10000)
      get_number_action.set_on_digit_timeout_messages(list_of_play_actions_on_timeout)
      get_number_action.set_on_invalid_digit_messages(list_of_play_actions_on_invalid)
      
      list_of_actions.append(get_number_action)
      

      Obtain the number entered from the action's next page request:

      my_request = TelephonyRequest(request)
      action_result = my_request.get_action_result()
      
      if action_result.get("action") == "get_number":
      
          get_number_result =  action_result.get("result")
          entered_number = get_number_result.get("entered_number")
      
          # Your code here...
      
  • The GetNumber class

    Introduction

    Represents a get number action.

    Class synopsis

    class GetNumber extends GetNumberBase {
    
        /* methods */
        public __construct(string|WebPageRequest $next_page, array $opts = null)
        public self setValidDigits(string $digits)
        public self setDigitCount(int $count)
        public self setEndDigit(string $digit)
        public self setMillisecondsInterDigitTimeout(int $msecs)
        public self setMillisecondsInitialTimeout(int $msecs)
        public self setSecondsTimeout(int $secs)
    
        /* inherited methods */
        public self setPrompt(Play $prompt)
        public self setHelpDigit(string $digit)
        public self setOnDigitTimeoutMessages(MessageList $messages)
        public self setOnInvalidDigitMessages(MessageList $messages)
    }
    
    The GetNumberResult class

    Introduction

    Represents the result of a get number action.

    Class synopsis

    class GetNumberResult extends ActionResult {
    
        /* methods */
        public string getEnteredNumber()
    
        /* inherited methods */
        public string getAction()
        public boolean getInterrupted()
    }
    

    Examples:

    • Get a variable length number using the defaults (ending with a '#'):

      $prompt = Aculab\TelephonyRestAPI\Play::sayText("Please enter your number followed by a hash.");
      $getnum = new Aculab\TelephonyRestAPI\GetNumber('usenumberpage');
      $getnum->setPrompt($prompt);
      $response->addAction($getnum);
      

      Obtain the number entered from the action's next page request:

      $info = InstanceInfo::getInstanceInfo();
      $numberResult = $info->getActionResult();
      $enteredNumber = $numberResult->getEnteredNumber();
      
    • Get a 16 digit number using the defaults:

      $prompt = Aculab\TelephonyRestAPI\Play::sayText("Please enter your 16 digit number.");
      $getnum = new Aculab\TelephonyRestAPI\GetNumber('usenumberpage');
      $getnum->setPrompt($prompt);
      $getnum->setDigitCount(16);
      $getnum->setEndDigit('');
      $response->addAction($getnum);
      

      Obtain the number entered from the action's next page request:

      $info = InstanceInfo::getInstanceInfo();
      $numberResult = $info->getActionResult();
      $enteredNumber = $numberResult->getEnteredNumber();
      
    • Get a 4 digit number containing digits 1-8:

      $prompt = Aculab\TelephonyRestAPI\Play::sayText("Please enter 4 digits between 1 and 8.");
      $getnum = new Aculab\TelephonyRestAPI\GetNumber('usenumberpage');
      $getnum->setPrompt($prompt);
      $getnum->setDigitCount(4);
      $getnum->setEndDigit('');
      $getnum->setValidDigits('12345678');
      $response->addAction($getnum);
      

      Obtain the number entered when action's next page is requested:

      $info = InstanceInfo::getInstanceInfo();
      $numberResult = $info->getActionResult();
      $enteredNumber = $numberResult->getEnteredNumber();
      
    • Get a variable length number containing digits 0-9, ending with a '#':

      $prompt = Aculab\TelephonyRestAPI\Play::sayText("Please enter your id followed by a hash.");
      
      $getnum = new Aculab\TelephonyRestAPI\GetNumber('usenumberpage');
      $getnum->setPrompt($prompt)
          ->setMillisecondsInterDigitTimeout(10000);
      
      $timeout = new Aculab\TelephonyRestAPI\MessageList();
      $timeout->addMessage(Aculab\TelephonyRestAPI\Play::playFile('silencemessage1.wav'));
      $timeout->addMessage(Aculab\TelephonyRestAPI\Play::playFile('silencemessage2.wav'));
      $getnum->setOnDigitTimeoutMessages($timeout);
      
      $invalid = new Aculab\TelephonyRestAPI\MessageList();
      $invalid->addMessage(Aculab\TelephonyRestAPI\Play::sayText('Please enter only numeric digits followed by a hash'));
      $message = Aculab\TelephonyRestAPI\Play::sayText('No really!');
      $message->addText('Please enter only numeric digits followed by a hash');
      $invalid->addMessage($message);
      $getnum->setOnInvalidDigitMessages($invalid);
      
      $response->addAction($getnum);
      

      Obtain the number entered from the action's next page request:

      $info = InstanceInfo::getInstanceInfo();
      $numberResult = $info->getActionResult();
      $enteredNumber = $numberResult->getEnteredNumber();