Gather DTMF using audio prompt in a conference
Play an audio file to a specific conference participant and gather DTMF input.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.conferences.actions.gatherDtmfAudio(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ call_control_id: 'v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg' },
);
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.conferences.actions.gather_dtmf_audio(
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
call_control_id="v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Conferences.Actions.GatherDtmfAudio(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.ConferenceActionGatherDtmfAudioParams{
CallControlID: "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.conferences.actions.ActionGatherDtmfAudioParams;
import com.telnyx.sdk.models.conferences.actions.ActionGatherDtmfAudioResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionGatherDtmfAudioParams params = ActionGatherDtmfAudioParams.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.callControlId("v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg")
.build();
ActionGatherDtmfAudioResponse response = client.conferences().actions().gatherDtmfAudio(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.conferences.actions.gather_dtmf_audio(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
call_control_id: "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg"
)
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->conferences->actions->gatherDtmfAudio(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
callControlID: 'v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg',
audioURL: 'http://example.com/gather_prompt.wav',
clientState: 'aGF2ZSBhIG5pY2UgZGF5ID1d',
gatherID: 'gather_id',
initialTimeoutMillis: 10000,
interDigitTimeoutMillis: 3000,
invalidAudioURL: 'invalid_audio_url',
invalidMediaName: 'invalid_media_name',
maximumDigits: 4,
maximumTries: 3,
mediaName: 'media_name',
minimumDigits: 1,
stopPlaybackOnDtmf: true,
terminatingDigit: '#',
timeoutMillis: 30000,
validDigits: '0123456789',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx conferences:actions gather-dtmf-audio \
--api-key 'My API Key' \
--id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
--call-control-id v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqgcurl --request POST \
--url https://api.telnyx.com/v2/conferences/{id}/actions/gather_using_audio \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
"audio_url": "http://example.com/gather_prompt.wav",
"minimum_digits": 1,
"maximum_digits": 4,
"timeout_millis": 30000
}
'{
"data": {
"result": "ok"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Uniquely identifies the conference.
Body
Unique identifier and token for controlling the call leg that will receive the gather prompt.
"v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg"
The URL of the audio file to play as the gather prompt. Must be WAV or MP3 format.
"http://example.com/gather_prompt.wav"
The name of the media file uploaded to the Media Storage API to play as the gather prompt.
Minimum number of digits to gather.
x >= 11
Maximum number of digits to gather.
x >= 110
Maximum number of times to play the prompt if no input is received.
x >= 13
Duration in milliseconds to wait for input before timing out.
30000
Digit that terminates gathering. Set to an empty string to disable the terminating digit entirely, so that a digit such as # can be collected as input per valid_digits.
"#"
Digits that are valid for gathering. All other digits will be ignored.
"0123456789"
Duration in milliseconds to wait between digits.
3000
Duration in milliseconds to wait for the first digit before timing out.
10000
Whether to stop the audio playback when a DTMF digit is received.
true
URL of audio file to play when invalid input is received.
Name of media file to play when invalid input is received.
Identifier for this gather command. Will be included in the gather ended webhook. Maximum 100 characters.
100Use this field to add state to every subsequent webhook. Must be a valid Base-64 encoded string.
"aGF2ZSBhIG5pY2UgZGF5ID1d"
Response
Successful response upon making a conference command.
Show child attributes
Show child attributes
{ "result": "ok" }
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.conferences.actions.gatherDtmfAudio(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ call_control_id: 'v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg' },
);
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.conferences.actions.gather_dtmf_audio(
id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
call_control_id="v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
)
print(response.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Conferences.Actions.GatherDtmfAudio(
context.TODO(),
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
telnyx.ConferenceActionGatherDtmfAudioParams{
CallControlID: "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.conferences.actions.ActionGatherDtmfAudioParams;
import com.telnyx.sdk.models.conferences.actions.ActionGatherDtmfAudioResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ActionGatherDtmfAudioParams params = ActionGatherDtmfAudioParams.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.callControlId("v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg")
.build();
ActionGatherDtmfAudioResponse response = client.conferences().actions().gatherDtmfAudio(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.conferences.actions.gather_dtmf_audio(
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
call_control_id: "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg"
)
puts(response)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$response = $client->conferences->actions->gatherDtmfAudio(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
callControlID: 'v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg',
audioURL: 'http://example.com/gather_prompt.wav',
clientState: 'aGF2ZSBhIG5pY2UgZGF5ID1d',
gatherID: 'gather_id',
initialTimeoutMillis: 10000,
interDigitTimeoutMillis: 3000,
invalidAudioURL: 'invalid_audio_url',
invalidMediaName: 'invalid_media_name',
maximumDigits: 4,
maximumTries: 3,
mediaName: 'media_name',
minimumDigits: 1,
stopPlaybackOnDtmf: true,
terminatingDigit: '#',
timeoutMillis: 30000,
validDigits: '0123456789',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx conferences:actions gather-dtmf-audio \
--api-key 'My API Key' \
--id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
--call-control-id v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqgcurl --request POST \
--url https://api.telnyx.com/v2/conferences/{id}/actions/gather_using_audio \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"call_control_id": "v3:MdI91X4lWFEs7IgbBEOT9M4AigoY08M0WWZFISt1Yw2axZ_IiE4pqg",
"audio_url": "http://example.com/gather_prompt.wav",
"minimum_digits": 1,
"maximum_digits": 4,
"timeout_millis": 30000
}
'{
"data": {
"result": "ok"
}
}