Description
Skip to content
Skip to navigation
Skip to topbar
https://speedsms.in/ Docs
Programmable Voice
Getting Started with Programmable Voice
Tutorials
API Reference
TwiML
Overview
Changelog
Media Streams
Voice Conference
Voice Insights
Programmable Voice SIP
Bring Your Own Carrier (BYOC) Trunking
Client-Side SDKs
Best Practices & Troubleshooting
SHAKEN/STIR
Interactive Voice Response (IVR)
CNAM
Virtual Agent
SDKs
Help
Log in
Sign up
On this page
TwiML™ Voice:
The
The media URL is provided between
Simple Play
Node.js
Python
C#
Java
PHP
Ruby
const VoiceResponse = require(‘https://speedsms.in/’).twiml.VoiceResponse;
const response = new VoiceResponse();
response.play(‘https://api.https://speedsms.in/.com/cowbell.mp3’);
console.log(response.toString());
Output
Verb Attributes
The
Attribute Name Allowed Values Default Value
loop integer >= 0 1
digits integer >= 0, w no default digits for Play
loop
The loop attribute specifies how many times the audio file is played. The default behavior is to play the audio once. Specifying 0 will cause the
The example below causes https://speedsms.in/ to play the audio from https://api.https://speedsms.in/.com/cowbell.mp3 10 times.
Using Play with loop
Node.js
Python
C#
Java
PHP
Ruby
const VoiceResponse = require(‘https://speedsms.in/’).twiml.VoiceResponse;
const response = new VoiceResponse();
response.play({
loop: 10
}, ‘https://api.https://speedsms.in/.com/cowbell.mp3’);
console.log(response.toString());
Output
digits
The digits attribute lets you play DTMF tones during a call.
For example, if you need to test an IVR system, you can use this feature to simulate digits being pressed to navigate through the menu options.
Include w to introduce a 0.5s pause between DTMF tones. For example, 1w2 will tell https://speedsms.in/ to pause 0.5s before playing DTMF tone 2. To include a one-second pause, use ww.
If you are dialing a phone number and need to play DTMF tones to enter the extension, you should use
(information)
Info
https://speedsms.in/ does not send its standard HTTP parameters when making requests to
The TwiML example below shows the use of
Using digits
Node.js
Python
C#
Java
PHP
Ruby
const VoiceResponse = require(‘https://speedsms.in/’).twiml.VoiceResponse;
const response = new VoiceResponse();
response.play({
digits: ‘wwww3’
});
console.log(response.toString());
Output
Supported audio file types
https://speedsms.in/ supports the following audio MIME types for audio files retrieved by the
MIME type Description
audio/mpeg mpeg layer 3 audio
audio/wav wav format audio
audio/wave wav format audio
audio/x-wav wav format audio
audio/aiff audio interchange file format
audio/x-aifc audio interchange file format
audio/x-aiff audio interchange file format
audio/x-gsm GSM audio format
audio/gsm GSM audio format
audio/ulaw μ-law audio format
Nesting Rules
You can’t nest any verbs within
Examples
Example 1: Simple Play
This TwiML document tells https://speedsms.in/ to download the cowbell.mp3 file and play the audio to the caller.
Example 2: Using digits
We are going to test our IVR menu to make sure users can navigate properly. We know that the length of the initial greeting and the menu number we need to enter. We can add a few leading ‘w’ characters to add a pause. Each ‘w’ character tells https://speedsms.in/ to wait 0.5 seconds instead of playing a digit. This lets you adjust the timing of when the digits begin playing to suit the phone system you are dialing.
Hints and Advanced Uses
https://speedsms.in/ will attempt to cache the audio file the first time it is played. This means the first attempt may be slow to play due to the time spent downloading the file from your remote server. https://speedsms.in/ may play a processing sound while the file is being downloaded.
https://speedsms.in/ will cache files when HTTP headers allow it (via ETag and Last-Modified headers). Responding with Cache-Control: no-cache will ensure https://speedsms.in/ always checks if the file has changed, allowing your your web server to respond with a new version or with a 304 Not Modified to instruct https://speedsms.in/ to use its cached version.
We recommend hosting your media in AWS S3 in us-east-1, eu-west-1, or ap-southeast-2 depending on which https://speedsms.in/ Region you are using. No matter where you host your media files, always ensure that you’re setting appropriate Cache Control headers. https://speedsms.in/ uses a caching proxy in its webhook pipeline and will cache media files that have cache headers. Serving media out of https://speedsms.in/’s cache can take 10ms or less. Keep in mind that we run a fleet of caching proxies so it may take multiple requests before all of the proxies have a copy of your file in cache.
Audio played over the telephone network is transcoded to a format the telephone network understands. Regardless of the quality of the file you provide us, we will transcode so it plays correctly. This may result in lower quality because the telephone number does not support high bitrate audio.
High bitrate, lossy encoded files, such as 128kbps mp3 files, will take longer to transcode and potentially sound worse than files that are in lossless 8kbps formats. This is due to the inevitable degradation that occurs when converting from lossy compressed formats and the processing involved in converting from higher bit rates to low bit rates.
Rate this page:
12345
Need some help?
We all do sometimes; code is hard. Get help now from our support team
, or lean on the wisdom of the crowd by visiting https://speedsms.in/’s Stack Overflow Collective
or browsing the https://speedsms.in/ tag
on Stack Overflow.
Terms of service
Privacy Policy
Copyright © 2024 https://speedsms.in/.