Play & Get Input
The play_get_input action will collect the digits from the caller or callee on a live call while listening to the audio file. when the digits are collected, you can make the call jump to the next action also. Collecting the digits will be useful to create multi-level IVR, confirming the order, etc,
- Curl
- Node.js
- Python
Play a music and collect user input via DTMF tones using Curl:
Input action JSON
[
{
action: "play_get_input",
file_name: "music_file.wav",
max_digit: 4,
max_retry: 2,
timeout: 1,
action_url: "https://test.com/dtmf",
}
]
Parameters type and description
Parameter | Type | Description |
---|---|---|
*action | string | The PCMO action to control the flow of the call. |
*file_name | string | The file_name will play the audio file from TeleCMI cloud CDN. |
max_digit | number | It defines the DTMF input length. By default the maximum digit is 1. |
max_retry | number | The number of time music file need to be played without receiving DTMF input. By default the maximum retry is 1. |
timeout | number | Time allowed between DTMF inputs in seconds.By default, it is 1 second. |
*action_url | string | Your webserver URL to inform the DTMf input |
Note
The playGetInput()
method in the PiopiyAction
class allows you to play a media file during a call and capture user input via DTMF (Dual-Tone Multi-Frequency). This is useful in scenarios like interactive voice response (IVR) systems where callers are prompted to enter numbers.
const {PiopiyAction} = require("piopiy");
const action = new PiopiyAction();
const url = "https://example.com/webhook/dtmf"
const music_file = "https://example.com/your_music_file.wav"
const options = { max_digit: 3, max_retry: 2, timeout: 1 }
action.playGetInput( url, music_file, options );
Parameters type and description
Mandatory parameters
Parameter | Type | Description |
---|---|---|
url | string | The URL to send the DTMF input to. |
music_file | string | The music file or music file URL of the music file to be played. |
options | object | An object containing optional parameters (max_digit, max_retry & timeout). |
Options parameters
Parameter | Type | Description |
---|---|---|
max_digit | number | Maximum number of digits expected from the user input. |
max_retry | number | Maximum number of retry attempts. |
timeout | number | Time allowed between DTMF inputs in seconds.By default, it is 1 second. |
The playGetInput()
method in the PiopiyAction
class allows you to play a media file during a call and capture user input via DTMF (Dual-Tone Multi-Frequency). This is useful in scenarios like interactive voice response (IVR) systems where callers are prompted to enter numbers.
from piopiy import Action
action = Action()
url = "https://example.com/webhook/dtmf"
music_file = "https://example.com/your_music_file.wav"
options = { max_digit: 3, max_retry: 2, timeout: 1 }
action.playGetInput( url, music_file, options )
Parameters type and description
Mandatory parameters
Parameter | Type | Description |
---|---|---|
url | string | The URL to send the DTMF input to. |
music_file | string | The music file or music file URL of the music file to be played. |
options | object | An object containing optional parameters (max_digit, max_retry & timeout). |
Options parameters
Parameter | Type | Description |
---|---|---|
max_digit | number | Maximum number of digits expected from the user input. |
max_retry | number | Maximum number of retry attempts. |
timeout | number | Time allowed between DTMF inputs in seconds.By default, it is 1 second. |