messageKeypress¶
The messageKeypress Rule will catch input from the caller's phone keypad and allow different routes to be taken in the Call Flow
Structure¶
The different parts of this rules are:
- Play: We had a look at this in the Play Rule in this documentation.
- eventHandler: This is the element which will handle the different events in a messageKeypress Rule.
- keyEvent: This is the keypress event we want to capture e.g. caller presses '1' on their phone keypad
- failure: This is the capture event if the keypress is not in the list of keypress events.This rule has two types of messages:
- onNoKeypress: If the caller did not press any key after the specified timeout
- onUnmatchedKeypress: If the Keypress is does not match a value specified in the rest of the keyPress events
<messageKeypress id="messageKeypress_1" label="Keypress Menu" captureKeypress="false" timeout="10">
<play id="play_0" label="PLAY">
<!-- messageParts -->
</play>
<eventHandlers>
<keyEvent action="onMatchKeypressSequence" keypressSequence="1">
<!-- Rules -->
</keyEvent>
<keyEvent action="onMatchKeypressSequence" keypressSequence="2">
<!-- Rules -->
</keyEvent>
<failure id="failure_1" label="Failure" attempts="3">
<keypressFailureMessages>
<keypressFailureMessage behaviour="onNoKeypress">
<!-- messageParts -->
</keypressFailureMessage>
<keypressFailureMessage behaviour="onUnmatchedKeypress">
<!-- messageParts -->
</keypressFailureMessage>
</keypressFailureMessages>
<!-- Rules -->
</failure>
</eventHandlers>
</messageKeypress>
Examples¶
Basic keypress Rule with two options¶
Imagine if you have Support Team and Sales Team, so you will make a call to Support if you press 1, or to the Sales team if you press 2. In order to make the outbound call in this example we are using the Call Rule. Please have a look at it before this example if you have not read it yet.
<messageKeypress id="messageKeypress_1" label="Keypress Menu" captureKeypress="false" timeout="10">
<play id="_play_0" label="">
<soundFile soundLabel="Option 1 Support Option 2 Sales"/>
</play>
<eventHandlers>
<keyEvent action="onMatchKeypressSequence" keypressSequence="1">
<call id="call_1" label="Call" sendCallAlert="NONE" record="false" destinationPhoneNumber="442033468855" destinationContactName="Support Team"></call>
</keyEvent>
<keyEvent action="onMatchKeypressSequence" keypressSequence="2">
<call id="call_1" label="Call" sendCallAlert="NONE" record="false" destinationPhoneNumber="442033468666" destinationContactName="Sales Team"></call>
</keyEvent>
</eventHandlers>
</messageKeypress>
Keypress Rule with a Failure message¶
The previous example does not define what will happen if the caller presses something other than '1' or '2'. In order to control this we have the failure rule. By using this we can control what happens if the caller presses an incorrect option, or no keypress at all. In the instance of such an error the CallFlow will attempt to get the correct input again x times, as defined by the 'attempts' parameter of the failure rule. Following the 'attempts' being exceeded, the flow will continue in the rules after the failure messages. In this instance it will send the caller to a voicemail rule.
<messageKeypress id="messageKeypress_1" label="Keypress Menu" captureKeypress="false" timeout="10">
<play id="_play_0" label="">
<soundFile soundLabel="Option 1 Support Option 2 Sales"/>
</play>
<eventHandlers>
<keyEvent action="onMatchKeypressSequence" keypressSequence="1">
<call id="call_1" label="Call" record="false" sendCallAlert="NONE" destinationPhoneNumber="442033468855" destinationContactName="Support Team"></call>
</keyEvent>
<keyEvent action="onMatchKeypressSequence" keypressSequence="2">
<call id="call_2" label="Call" record="false" sendCallAlert="NONE" destinationPhoneNumber="442033468666" destinationContactName="Sales Team"></call>
</keyEvent>
<failure id="failure_1" label="Failure" attempts="3">
<keypressFailureMessages>
<keypressFailureMessage behaviour="onNoKeypress">
<soundFile soundLabel="You did not pressed anything"/>
</keypressFailureMessage>
<keypressFailureMessage behaviour="onUnmatchedKeypress">
<soundFile soundLabel="Wrong key pressed"/>
</keypressFailureMessage>
</keypressFailureMessages>
<voicemail id="voicemail_1" label="Voicemail" from="noreply@voxanalytics.com" fromName="IOVOX Team" subject="You have a Voicemail" silence="2" maxDuration="300" templateName="basicTemplate" destinationEmailAddress="business@iovox.com" destinationContactId="1">
<voicemailMessage>
<soundFile soundLabel="Welcome to my Voicemail!"/>
</voicemailMessage>
</voicemail>
</failure>
</eventHandlers>
</messageKeypress>
Result¶
Error Result¶
HTTP Code | Error String | Resolution |
400 | Rule ID Empty | Set the value of the id attribute |
400 | Rule Label Empty | Set the value of the label attribute |
400 | Rule ID Not Unique in Message Keypress Rule | The value of the id attribute is used for an other rule, change it to be unique |
400 | Attribute captureKeypress needs to be either true or false | Correct attribute captureKeypress with the values TRUE or FALSE |
400 | Timeout Empty | Set the value for Timeout attribute |
400 | Timeout Not a Number | Set the Timeout as a numeric value |
400 | maxDigits Empty | Set the value for maxDigits attribute |
400 | maxDigits Not a Number | Set the maxDigits as a numeric value |
400 | Sound File Variable need to be set in Play Rule | Set the required Sound File for the variable needed |
400 | Sound File x of y Does not exist in Play Rule | Correct the Sound Label or the Sound Group for that file |
400 | Action Empty | Set the attribute Action |
400 | Action Invalid | The Action set is not valid in the Key Event |
400 | Keypress Empty | Set the attribute Keypress |
400 | Keypress_value Invalid Keypress | The Keypress value is invalid |
400 | Duplicate ITEM_1 Received | The Value Result is duplicated in the Key Events |