Twillio Direct Audio call integration with Nodejs Express

Hi, Today we will discuss about the end to end/direct calling using Twilio API. I assume that you have knowledge of Twilio and why it is used for.


twilio direct call

Step 1: Purchase Twilio number

For this task user need to purchase a twilio number on which user will call for interacting IVR or making direct end to end call.

Step 2: Set callback url 

For this task we need to login into the twilio console. After login on console scroll down the page and click Phone Number option at the bottom of the page. After redirecting the page there will be a section named Manage Numbers under which there will be list of active phone numbers like below screenshot

twillio direct calling

Now click on the twilio number and set the callback api url like below screenshot:

twillio direct calling

Now we have performed all the task needed at twilio platform. So now the task which is left is callback api creation in nodejs express.

Step 3: Create Callback API

So now we have following code which  is doing the actual job to return the end user phone number to the twilio.'/make-call', (req, res) => {
const VoiceResponse = require('twilio').twiml.VoiceResponse;
const response = new VoiceResponse();
const dial = response.dial({
callerId: '+12121111', // Purchased twilio number
dial.number('+91878765456'); // phone number of end user to forward the call


Pretty cool! Finally our task completes here.

That’s all for now. Thank you for reading and I hope this post will be helpful for beginners who are going implement twillio calling.

Let me know your thoughts over the email I would love to hear them and If you like this article, share with your friends. 

You can download complete code from here. Download Code