Voice posts

There are so many things that you can do in PHP, including creating websites, building command-line tools, generating images, encrypting and decrypting data, and scraping websites.
But did you know that PHP can also make phone calls? Okay, not on its own it can't, but with the help of Twilio Programmable Voice, it can! In this tutorial, you're going to learn how.
Prerequisites
To follow along with this tutorial you will need the following:
- PHP 8.1.
- Composer globally installed.
- A Twilio account. If you are new to Twilio click here to create a free account.
- A Twilio phone number.
- A phone that can make and receive phone calls.
Set up your environment
The first thing you need to do is to create a project directory and change into it. To do that, run the following commands.
mkdir twilio-voice-call
cd twilio-voice-call
Next, create a new file named .env …

この記事はNeils Swimbergheがこちらで公開した記事(英語)を日本語化したものです。
Twilioを利用することで、電話番号、テキストメッセージ、音声通話をベースとするアプリケーション構築が可能となります。電話ネットワークがベースとなるこれらアプリケーションは、もちろん携帯電話やスマホを使ってテストすることができますが、手元に電話がない状況でこれらアプリケーションをテストすることができるでしょうか。なぜ電話を使わないのかと思われるかもしれませんが、背景的な部分は後ほど説明するとして、まずは可能なことを解説していきます。
Twilio Dev Phoneのご紹介
Twilio Dev Phone(トゥイリオ・デブ・フォン)とは
Twilio Dev Phoneは、Twilio製品の上に構築されたツールで、ブラウザから電話やテキストメッセージを送受信(発着信)することが可能です。Dev PhoneはGitHub上のオープンソースプロジェクトとして構築されているので、ソースコードを読んで自由にコントリビュート(貢献)することができます。Twilio Dev Phoneの詳細については、ドキュメントでご確認ください。
Twilio Dev Phoneを使用する理由
ご自身の電話端末の代わりにTwilio Dev Phoneを使う典型的なシナリオを、以下にいくつか紹介します。
🌍 国際的なアプリケーション
ユーザーが世界中に広がるアプリケーションを構 …

RTP, or Real-time Transport Protocol, is used by Twilio (and others) for transmitting audio information for SIP calls. SRTP is Secure RTP, or RTP that has been encrypted. By design, no one can listen to, intercept, or replay the encrypted RTP media except the parties that originally negotiated the SIP session.
In this post, we will discuss:
- How SRTP Works
- Why encrypted media is cool
- Overcoming potential obstacles and overhead
- How to set up SRTP with Twilio
- Implementation considerations
How does SRTP work?
If you understand HTTPS, then you will totally get SRTP. If not, let’s start by reviewing the basics.
SRTP employs TLS for encryption, which uses a ‘handshake’ that looks something like this:
The client and server exchange keys, which are unique to the current session, and use them to encrypt/decrypt the data that is being transferred between them.
SRTP uses Advanced Encryption Standard (AES) …

In recent years, user authentication in web applications has become a serious concern. For example, one-time passwords (OTP) are utilized to verify a user's identity; the most frequent method for sending OTPs is via SMS to the user's registered cellphone number.
In this tutorial you will learn how to send one-time passwords to users over voice calls in PHP using Twilio's Verify Api. In doing so, you will create an OTP system that can be used as an additional security layer for specific operations in your application.
Prerequisites
To follow this tutorial, you need the following:
- PHP 7.4 or higher with the PDO extension and PDO MySQL extension installed and enabled.
- Composer globally installed.
- MySQL and the MySQL command-line client (or an alternative database tool, such as DataGrip).
- A Twilio account. If you are new to Twilio, click here to create a free account.
Application Process
Here's …

When was the last time you got a call from a number you didn’t recognize? Did you answer that call?
Calls from phone numbers that recipients do not recognize have low answer rates because of the rise of robocalls and call spam. Technologies like STIR/SHAKEN and third-party analytics services are currently focused on identifying and blocking spam calls, not on increasing trust in calls that are desired – such as a call from a delivery driver who can’t find your house, or from your pharmacy letting you know your prescription is ready.
In the US, telecom providers have long supported Caller ID through CNAM. So, if you have a landline (or are old enough to remember when most houses had a landline), you’ve probably seen a 15-character Caller ID show up on a small screen when a call comes in.
Aside from some technical limitations with CNAM, we don’t often …

If you're using ServiceNow, you might want a straightforward way to add one-way outbound messaging with voice and conferencing.
This tutorial shows how ServiceNow customers can utilize the out-of-the-box integration with Twilio Messaging and Programmable Voice using the free ServiceNow Notify plugin. The plugin is straightforward to set up, and the business value of implementing it is immense. You can greatly reduce your incidents' time to resolution, shorten the timeline for mobilizing resources to solve incidents, and streamline communications with your customers during active incidents.
In this tutorial, you'll implement the ServiceNow and Twilio integration by configuring the following features:
- ServiceNow Notify for basic SMS and conference calls
- Alerts and Notifications using the ServiceNow Workflow Designer
- Alerts and Notifications using ServiceNow Business Rules
ServiceNow and Twilio integrations
This post is Twilio's recommended Crawl integration with ServiceNow. You can learn more about the ServiceNow use case on the Twilio website. …

Time of day routing allows you to manage where incoming calls are directed based on time periods and which day it is. For example, routing calls to a support line during business hours or an after hours voicemail to maximize customer satisfaction. This can get extra tricky when the server that’s running your call routing app is located in a different time zone than your business (and this is extremely likely)!
In this tutorial, you’ll be building an app that routes incoming calls depending on the day, time of day relative to your business hours, and your business’ time zone. This will all run on Twilio’s Serverless infrastructure, so you won’t need to worry about hosting.
Prerequisites
- A Twilio account—sign up for a free one here and receive an extra $10 if you upgrade through this link
- A Twilio phone number with SMS capabilities—configure one here
- Node.js installed— …

I always used to find myself getting into unwanted social situations that I could never get out of. As the engineer I am, I decided it’d be fun to build and publish a quick solution to this using my toolbelt here at Twilio: How to Escape Pesky Situations using Twilio Functions and TwiML Bins. This solution allowed me to text my “friend” Joanna – an Amazon Polly voice – a key phrase which would trigger Joanna to call me and respond as if there was an emergency using a human-like synthesized speech.
This solution then made me wonder what other fun ways Joanna could help me out. Since it’s also National Anti-Boredom Month (July), I started focusing on ways to tackle boredom and pass time.
Whether it’s walking home from the subway or waiting in line at the store I always find myself needing to kill time. I could …

Twilio Programmable Voice allows you to make voice calls directly from your application or script. In this tutorial, I’ll show you how to use it to make a voice call that plays a text-to-speech message from Bash or other shell scripting languages.
Prerequisites
- A Twilio account. If you are new to Twilio, click here to create a free account now and receive $10 credit when you upgrade to a paid account. You can review the features and limitations of a free Twilio account.
- A phone with active service that can receive phone calls, to test the project.
This tutorial is written for Unix shells such as Bash, Zsh, etc. If you are following the tutorial on a Microsoft Windows computer, it is recommended that you work inside the Windows Subsystem for Linux (WSL).
Set up your environment
In this section you are going to set up a brand …

For decades, landline phones reigned as the main communication method in homes and businesses alike. This was especially true for call centers, where landlines were the heart of the business. But today, businesses are doing away with traditional phones.
With so many innovations in communication technology, outdated landline telephone systems are no longer the best option for call centers. Instead, many call centers are switching to Voice Over Internet Protocol (VoIP).
Wondering why? This post will cover the reasons why VoIP is the best option for your call center.
What is a VoIP call center?
A VoIP call center uses the internet to make and receive calls, as opposed to what traditional phones rely on, the Public Switched Telephone Network.
If you’ve ever made a call via Skype, Zoom, or even Messenger, you’ve used VoIP. But this internet-based phone system isn’t just for personal calls. More and more …