Userinput command

The Userinput command executes commands in the current API extension call specified between <InitialCommands></InitialCommands> nodes by the time it waits for the user to press DTMF keys. The keys are between <Inputs></Inputs> nodes, the actions to execute when the a key pressed is specified between <Input key=DTMF key(s)></Input> nodes, where the key value is a DTMF digit or digits for Input nodes.

<Userinput> command example usage:

It is widely used to make IVR-s. You can add menu entries to it and give different commands to be executed by entering different menu entries. The purpose of the entries are defined between the <Input key=DTMF key(s)></Input> nodes. You can build multi level IVR menu systems by nesting more Userinput commands into eachother (see an example below). You can also make client identification systems by sending out a DtmfEntered notification to an URL and the response OzML can contain a BlindTransfer command which sends the client directly to the support staff (see an example below).

Parameters:

Parameter name Value Description Default value Mandatory
Repeat bool value
(true or false)
If set to true, it repeats the initial commands after the timeout, when the user is not pressing any DTMF keys. false No
Timeout int value,
e.g. 10
Timeout in seconds to repeat the initial commands or exit from the current user input command when repeat is not set. 0 No
BackKey DTMF key value,
e.g. *
DTMF key to return to the upper menu level if this UserInput command is nested in another UserInput command. (None) No
Digits int value,
e.g. 2
Specified number of digits to wait for the user to input. 1 No
ForwardToUrl string value,
e.g. http://myurl.com/
This URL (if not empty) will be requested (DtmfEntered notification) when the user entered the specified number of digits, and these digits are not specified as key parameter in the Input sections. The OzML response to this request may contain commands which will be executed. (None) No
MinDigits int value,
e.g. 4
Minimum number of digits to wait for the user to input. If you defined the Digits parameter, the MinDigits value will be useless, the system will use the Digits number because it is the default. 1 No
MaxDigits int value,
e.g. 6
Maximum number of digits to wait for the user to input. If you defined the Digits parameter, the MinDigits value will be useless, the system will use the Digits number because it is the default. 1 No

Basic IVR example:

This speaks the 4 sentences between the <InitialCommands></InitialCommands> nodes repeatedly with a 10 second delay and scans the pressed numbers at the same time.
By pressing 1 an SMS will be sent to 45026467 containing: "Hello from Ozeki Phone System!"
By pressing 2 this sentence will be read by the speak engine: "You pressed button 2. You did nothing."
By pressing 3, you will be blind transferred to number 101. If the transfer was unsuccessfull it says: "Sorry, but blind transfer failed to extension 101."

<?xml version="1.0"?>
<Response>
  <UserInput timeout="10" repeat="true">
    <InitialCommands>
      <Speak>Welcome to the Ozeki Phone System IVR.</Speak>
      <Speak>To send an SMS, press 1.</Speak>
      <Speak>To do nothing, press 2.</Speak>
      <Speak>To transfer the call to 101, press 3.</Speak>
    </InitialCommands>
    <Inputs>
      <Input key="1">
        <Speak>A test SMS will be sent.</Speak>
        <SendSms recipient="45026467">Hello from Ozeki Phone System! </SendSms>
      </Input>
      <Input key="2">
        <Speak>You pressed button 2. You did nothing.</Speak>
      </Input>
      <Input key="3">
        <BlindTransfer>101</BlindTransfer>
        <Speak>Sorry, but blind transfer failed to extension 101. </Speak>
      </Input>
    </Inputs>
  </UserInput>
</Response>

Multi level IVR example:

This speaks the 4 sentences between the <InitialCommands></InitialCommands> nodes repeatedly with a 10 second delay and scans the pressed numbers at the same time.
By pressing 1 this sentence will read by the speak engine: Ozeki Informatics Ltd. is a leading mobile messaging software vendor”.
By pressing 2, you enter a lower menu:
1 sentence will repeat (repeat=”true”) with 10 second delay (timeout=”10”) between the <InitialCommands></InitialCommands> nodes. You need to add the number of digits between MinDigits (8) and MaxDigits (9) and you will transfered (with the <BlindTransfer><BlindTransfer> command) to this phone number. You can reach this number with the ”$lastInput” variable.

<?xml version="1.0"?>
<Response>
  <UserInput timeout="10" repeat="true">
    <InitialCommands>
      <Speak> Welcome to the Ozeki Phone System IVR. </Speak>
      <Speak> For more information about Ozeki Informatics Ltd, press 1. </Speak>
      <Speak> To call one of our colleagues, press 2. </Speak>
    </InitialCommands>
    <Inputs>
	 	<Input key="1">
		 <Speak>Ozeki Informatics Ltd. is a leading mobile messaging software vendor.</Speak>
      	</Input>
      	<Input key="2">
			<UserInput timeout="10" mindigits="8" maxdigits="9" repeat="true">
				<InitialCommands>
					<Speak>Please insert the phone number!</Speak>
				</InitialCommands>
				<Inputs>
					<Input key="default">
						<BlindTransfer>$lastInput</BlindTransfer>
					</Input>
				</Inputs>
			</UserInput>
		</Input>
    </Inputs>
  </UserInput>
</Response>

IVR example using DtmfEntered notification:

Menu:

This speaks the 4 sentences between the <InitialCommands></InitialCommands> nodes repeatedly with a 10 second delay and scans the pressed numbers at the same time.
By pressing 1 an SMS will be sent to 45026467 containing: "Hello from Ozeki Phone System!"
By pressing 2 this sentence will be read by the speak engine: "You pressed button 2. You did nothing."
By pressing 3, you enter a lower menu:

1 sentence will repeat (repeat="true") with a 5 second delay (timeout="5") between the <InitialCommands></InitialCommands> nodes. By pressing 5 digits a DtmfEntered notification will be sent to http://www.yourapp.com/clientid.php and 2 kind of OzML responses can be sent back: the client ID is correct and the client is transfered to the support staff or the the client ID is incorrect.

<?xml version="1.0"?>
<Response>
  <UserInput timeout="10" repeat="true">
    <InitialCommands>
      <Speak>Welcome to the Ozeki Phone System IVR.</Speak>
      <Speak>To send an SMS, press 1.</Speak>
      <Speak>To do nothing, press 2.</Speak>
      <Speak>To talk to support press 3.</Speak>
    </InitialCommands>
    <Inputs>
      <Input key="1">
        <Speak>A test SMS will be sent.</Speak>
        <SendSms recipient="45026467">Hello from Ozeki Phone System! </SendSms>
      </Input>
      <Input key="2">
        <Speak>You pressed button 2. You did nothing.</Speak>
      </Input>
      <Input key="3">
        <UserInput timeout="5" repeat="true" Digits="5"
        ForwardToUrl="http://www.yourapp.com/clientid.php">
          <InitialCommands>
            <Speak>Please enter your client ID!</Speak>
          </InitialCommands>
        </UserInput>
      </Input>
    </Inputs>
  </UserInput>
</Response>
Client ID is correct:

If the client ID is correct the client is BlindTransfered to the support staff.

<?xml version="1.0"?>
<Response>
      <Speak>Your client id is correct you will be transfered to a support staff.</Speak>
      <BlindTransfer>101</BlindTransfer>
      <Speak>Sorry, but you currently can't reach support.</Speak>
</Response>
Client ID is incorrect:

If the client ID is incorrect it will say: "Your client id is incorrect. Goodbye!" and when an OzML code reaches it's end then the call hangs up.

<?xml version="1.0"?>
<Response>
      <Speak>Your client id is incorrect. Goodbye!</Speak>
</Response>

The DtmfEntered notification has a DtmfDigits parameter which contains the key or keys pressed on the extension. It can also identify the call and which leg of the call is receiving the digit or digits with the CallLegID.

Userinput command is used in OzML responses to these Api Extension Control notifications:
GoTo, RecordCompleted, DtmfEntered, SMSDeliveryReport, IncomingSMS, IncomingCall, CallConnected

More information