Twilio Web Client Multi Line Call - twilio

I have a Twilio softphone that I am implementing and the basics functions are working great.
Please I would need to know how to implement a multi line call feature.
I would like to allow a agent in my browser softphone to put a call on hold and dial a different number then resume any call on hold when needed.
I actually have
Thank You

Related

Gather DTMF inputs from user via an outbound call

I have a very simple question about gathering DTMF inputs from users via an outbound call made to them. I am describing the requirement below.
Main Requirement
I have a python script that makes outbound calls to a particular number. The person accepts the call. I say the information to them via the twiml configured. The person hears the info and presses a key on their phone. I want to capture that key input and just print it as an output using my script.
The problem
I am able to make the outbound call using the client.calls.create method described here. https://www.twilio.com/docs/voice/tutorials/how-to-make-outbound-phone-calls-python
But I am unable to gather the digits. The examples I have seen online are describing how to achieve gathering inputs with a running web application. I am NOT using this method.
I am looking to get this done via a simple script. I initiate the outgoing call from the Twilio number via the script. I don't intend to use any web applications or webhooks here.
I am putting the code below that works until making the call and reciting the options to the user.
How can I get this done? Is this possible? Many thanks.
import os
from twilio.rest import Client
from twilio.twiml.voice_response import Gather, VoiceResponse, Say
account_sid = os.environ['TWILIO_ACCOUNT_SID']='XXXXX'
auth_token = os.environ['TWILIO_AUTH_TOKEN']='YYYYY'
client = Client(account_sid, auth_token)
call = client.calls.create(
twiml='<?xml version="1.0" encoding="UTF-8"?><Response><Gather input="dtmf" timeout="5" numDigits="1"><Say>Please press 1 for sales</Say></Gather></Response>',
to='Destination_Number',
from_='My_Twilio_Number'
)
#TODO - How to Gather Digits from the user????
Twilio developer evangelist here.
There are many ways to interact with a phone call through Twilio, but when you are trying to take user input through <Gather> all of them require Twilio to be able to notify you of the digits that the user pressed. Since this is an asynchronous action, the basic method of doing so is via a webhook, an HTTP request, sent to a web application that you control.
If you do not want to host an application that responds to webhooks yourself, you could achieve this flow using Twilio Studio, which is a drag and drop editor for communications flows, or using Twilio Functions, which is a serverless environment where you can respond to incoming HTTP requests with JavaScript functions.

I need to be able to transfer call from Twilio Elastic SIP Trunk to Twilio Autopilot

When a customer dials my Twilio number, I need Twilio to first try to call my PBX system. Currently using 3CX. If the call is not answered by a person, I need to find a way to send that call back to Twilio and go to another resource. For my purposes, that resource is Twilio AutoPilot.
Basically, if a human doesn't answer the phone, I want the robot to try and help the customer instead.
The only thing I've been able to come up with so far is to create another Twilio number and have that number be the fallback within the PBX. The problem with that solution is with Twilio, you cannot mask the number to match the CallerID of the customer calling in, and I would really like to be able to know that number. Also you are creating 2 call paths, which could make this an expensive option.
The only other solution I could think of, which would use 3 calls paths, would be to use another provider that does allow me to mask the caller id, and then send that to the Twilio number.
I am not a programmer, I have basic coding knowledge, but just barely.
Any help would be appriciated. Thanks
You can use Programmable Voice with a SIP Dial to initially contact your PBX (it will appear the same way an Elastic SIP Trunk call will appear to your PBX). The easiest way is to use the Connect Call to Widget in Studio. If that call fails, say 3CX returns a 404 - Not Found, Studio can continue to the next Widget via the Connected Call Ended path which can then perform additional steps of your choosing. The CallerID is maintained this way as well.
Elastic SIP Trunking is not designed for this particular call flow but rather a simple conduit from/to the PSTN.
Happy Path
Fallback Path

Twilio: Is it possible to call multiple client id at once?

I have implemented warm transfer in the my application (C#) but I have to extend it.
Below is my new use case:
Customer calls to our Twilio number. That Twilio number is assigned to a department in our database. Based on that number I retrieve all agents in that department. So, I want this call to go to all the agents in that department and all agents can see an incoming call on their screen.
How can I make a call to multiple agents on their 'client id' (they have generated their capability token with)?
PS: I can't use dial because dial is used for conference once agent picks up the call, I have to do something in CallResource.Create() function in C#
Twilio developer evangelist here.
If you can't do this via <Dial>, you need to loop through all the numbers you want to call within your C# code, calling CallResource.Create() for each of them.
Note, you will likely want to setup to receive statusCallback webhooks so that you can complete the other calls if someone has answered.

Can I change a Twilio Function's behavior (e.g. change a global variable) via the Twilio API?

I have written a simple Twilio Function to forward calls to one of my two cell phones numbers A and B. Occasionally I want to tell the function to stop forward to A and start forwarding to B, or vice versa.
Can I do this programmatically via the Twilio API? E.g. can environment variables, usually set in Functions -> Configure, be set via the Twilio API? Or can I update the Function's code itself via the Twilio API?
If not, must I resort to hosting my code on a 3rd party server, or is there another way to programmatically change what is essentially a global variable for a Twilio Function without manual intervention?
Twilio developer evangelist here.
Sadly there is no Functions API to update Functions in this way, yet.
However, may I suggest a workaround for this scenario. You can create two Twilio functions one which forwards to number A and the other which forwards to number B. You can then use the Incoming Phone Numbers resource to update your Twilio number's voice URL to point to the Function you need.
Let me know if that helps at all.

Attended Call Transfer in Twilio

I am trying to create an attended transfer using Twilio.
The flow I would like is as follows:
1. Existing call with two legs (client side, agent side)
2. Using API put Client on HOLD and put Agent 1 in Conference
3. Using API Put Agent 2 into same Conference
4. Agent 1 and Agent 2 can speak without Client hearing
5. Using API add Client to Conference
6. Client, Agent 1 and Agent 2 can speak together
7. Using API Agent 1 can be disconnected from the call
Is it possible to do this?
Or do we need to create a conference for all our inbound and outbound calls?
(even though only about 5% of our calls get transferred)
Twilio developer evangelist here.
You can definitely do this. It might be easier to do this from the context of a conference in the first place, as you can take advantage of putting conference participants on hold.
To do it from a regular call to start with, you would want to redirect one of the agent or caller to new TwiML and then make sure the other leg of the call had somewhere to continue to with the existing TwiML. It's probably easier to transfer the agent's call with the REST API and then make sure that the TwiML you originally return to the user continues to place them into a queue using <Enqueue> that you can then call them out of later, or simply a looping <Play>.
Let me know if that helps at all.

Resources