0

I have setup a trial Programmable Voice account with Twilio. I am using a Zoiper softphone endpoint. I am attempting to have my client's server initiate a call through Twilio to a live person. I need to actually speak with the person called.

However, in using the tutorial code, Twilio's "url" parameter intercepts the call with it's own voice message:

from twilio.rest import Client

account_sid = 'Axxxx'
auth_token = 'xxxxx'
client = Client(account_sid, auth_token)

call = client.calls.create(
    url='http://demo.twilio.com/docs/classic.mp3',
    to='+15553334929',
    from_='+18334447682'
    )

print(call.sid)

The call recipient hears the the message, but we cannot speak together.

Twilio's own tutorial materials are on how to use either TwilML or the "url" parameter to have the computer automatically work with the call. However, I do not need that. I need to have two live people speak to each other once the server initiates the call through Twilio. Right now, the "url" / TwilML is just standing between the live people.

markj
  • 25
  • 5
  • So you would like your client's server to initiate the connection to both people, or will one person be calling and you would just like your server to connect to the other person? – totalhack Mar 16 '20 at 15:52
  • I need my client's server to initiate the call to both people. My client's call center is contacting customers. So, I need the server to have rep's Twilio phone# call the customer's phone#. – markj Mar 17 '20 at 09:45

3 Answers3

1

This blog shows an example that makes an outgoing call and then joins the caller into the call. See the "Start a two-user call from your App" section.

You might also want to take a look at this answer which shows another way to do this with the JS API (the principals should be easily transferable to the python API). Basically it makes two calls and joins them in a Conference.

Disclaimer: I'm not a lawyer and this is not legal advice, but I'm assuming you are familiar with TCPA and have reviewed regulations/requirements related to that. It's possible that your code initiating the outgoing call in an automated fashion (instead of an agent clicking a button manually to initiate a call) changes your level of regulatory exposure.

totalhack
  • 2,298
  • 17
  • 23
  • Thanks for the feedback. This looks like it would work if the caller initiated the call manually to the callee, at which point they would both be placed into conference. But, in our case, I need to have my client's server initiate the call. – markj Apr 09 '20 at 12:31
  • Thanks for the "non-legal" advice. Fortunately, my client's clients' customers give their phone#'s and email addresses knowing that they may be contacted via phone, email, or SMS. – markj Apr 09 '20 at 12:32
0

This is called, Call Forwarding. The article below provides all the different ways to accomplish this task

Setting Up Call Forwarding

Alan
  • 10,465
  • 2
  • 8
  • 9
  • I probably should have been clearer: I need my client's server to initiate a call which goes from the my client's rep using a Twilio# to a customer. So, this is an outbound call from the Twilio# to a customer#. Would this still be call forwarding? – markj Mar 17 '20 at 11:27
  • It is a type of call forwarding. The outbound-api call (or in Studio called the Make Outgoing Call Widget) would be initiating the call forwarding rather then TwiML Dial or the Studio Incoming Call Trigger Widget. The url in your example would point to the Call Forwarding TwiML. When the dialed party answered, the URL is accessed which tells Twilio to connect to the other party, via the Dial verb, and the two can talk. TwiML example appears here - https://www.twilio.com/docs/voice/twiml/dial. – Alan Mar 17 '20 at 12:13
  • Thanks for the pointer. I was able to get this to work by using call forwarding. – markj Apr 09 '20 at 12:33
  • Now, I need to see how to reduce the cost! By the time my client's server talks to the Twilio server, and that talks to the callee, and the callee dials back to the Twilio server, and the Twilio server dials to the endpoint, we're being charged for the use of four trunks simultaneously. Not cheap! – markj Apr 09 '20 at 12:34
0

Twilio developer evangelist here.

Welcome to StackOverflow!

You can do this with Twilio Studio. There in your dashboard, click the + button to make a new flow and call it whatever you wish.

make a new flow + sign

It comes with the Trigger widget, which will initiate your flow when the trigger (in this case, an Incoming Call) is fired.

trigger widget

You only need one widget: the Connect Call To widget. Drag it onto the canvas and connect the dot from that initial Incoming Call trigger to the dot in the upper left corner of that new Connect Call widget. Select Single Number in the right sidebar dropdown and enter whatever number you'd like to forward calls to.

connect widget

Lastly, you'll need a Twilio phone number. Purchase one in the Twilio Phone numbers section of your console.

Scroll down to the Voice & Fax section and select Webhooks, TwiML Bins, Functions, Studio, or Proxy from the initial dropdown. Next to “A Call Comes In” select Studio Flow and choose the flow you just made to connect/relate it to the number. Lastly click Save and tada! If someone calls your Twilio number you just purchased, they will route you to the number you specified in the Twilio Studio flow.

Let me know if this helps at all! :D

lizziepika
  • 3,231
  • 1
  • 14
  • 23
  • I probably should have been clearer: I need my client's server to initiate a call which goes from the my client's rep using a Twilio# to a customer. So, this is an outbound call from the Twilio# to a customer#. Would this still be call forwarding? – markj Mar 17 '20 at 11:27
  • That would not be call forwarding! I'd check-out the response from Totalhack above which mentions my teammate Phil's response to a similar question here: https://stackoverflow.com/questions/43919831/twilio-how-to-make-two-outbound-calls-and-joinconference-them-using-node-js – lizziepika Mar 17 '20 at 19:50