twiliovoice

Twilio voice api


I am developing a server to receive incoming call and then connect the user A to use B by dialing number while on call. I want to know it this code is correct? and as User B receive a call it shows User A's contact number, will User A will be charged for the call or my Twilio account?

app.get('/call', async (req, res) => {
  const twiml = new VoiceResponse();
  twiml.dial('USER_B_NUMBER');
  res.type('text/xml');
  res.send(twiml.toString());
});

Solution

  • There are multiple events going on in this scenario. For once, user A will be charged their normal rate (based on their carrier).

    Twilio charges:

    For call forwarding applications, you will be creating two legs for each conversation.

    An inbound leg from the caller to your Twilio number. An outbound leg from Twilio to the number you are forwarding the call to. Each leg is billed separately to your Twilio project on a per-minute basis. Each call is also rounded up to the closest minute.