Updating the forwarding number Twilio studio - twilio

I'm currently working on a project for a family friend that requires call forwarding in Twilio. I have a page that is linked to a MySQL database. The user will select an on duty team member from a dropdown, then click a forward button which needs to be able to set the on duty team members number as the forwarding number for a singular Twilio number.
This is the first time I've worked with Twilio and frankly I'm struggling with it. I've set up authentication and passed the number in using PHP. In Twilio studio I've attempted to set a variable to a value passed in by a REST API trigger and then have a connect call to that uses the variable, which currently isn't working.
When I set a variable in a flow, is it only set for that flow? Is it simply passing it through but when I dial the Twilio number, it's creating a separate flow that has nothing set in it? Has anyone done anything similar before?

Related

Twilio Flex Voice Mail to Unavailable

We have set-up our Flex, and stuck on one of the last steps. We are a small office, and have a main number that clients call us on. If they ask for a specific employee, more importantly, if the specific employee is required to answer the client issue, and they are marked UNAVAILABLE, it doesn't appear we have access to send the call to voicemail (the transfer button is grayed out).
Is there a work around? A way to direct call the VM? Do we need to tweak our flow? If not, it appears we need to be logged in 24/7 to have access to VM's. A fairly inefficient and expensive option.
OK, I think I know what the issue is. A call comes through to one agent in Flex, but they need to transfer it to the other agent. If the other agent is also available, they can transfer the call no problem. If the other agent is not available, you would like to transfer the call to that agent's voicemail, but there's no way to do that right now.
The issue is that Flex is built around available agents and doesn't have voicemail built in. You've added voicemail as part of the Studio Flow, but this is not integrated to the Flex interface at all.
I would solve this with a Flex plugin that does a couple of things:
Add a button to the agent transfer list for unavailable agents to send to their voicemail.
That button would trigger a request to a Twilio Function, sending it the Call's Sid and the agent you want to transfer to.
The Function could then use the calls API to update the call, redirecting it to the existing voicemail handlers that you have for your agents.
I'm afraid I don't have example code for this plugin, but there is great documentation on building Flex plugins that you can follow to get up to speed.

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.

Twilio Studio HTTP request

I have been working with Twilio Studio trying to build this IVR tree. I need a few requests that will go back to my main platform to check the caller_id of the line calling in and to verify_employee pin etc after the caller_id is verified.
I know there is an HTTP request widget that I can use to hit the endpoints on the main platform. But I am running into the issue where it's validating the number that's inputed. The person calling in will get verified then have to enter the 3 provider pin and 4 employee number. Right now I can input anything and it will go through onto the next option. Anything I can do to validate the numbers against the endpoint? or maybe I am just doing my tree wrong.
Off of the trigger I am using a http request to check the caller id of the person calling in. Then using a gather input widget to gather the pin #'s then using that to call the verify employee http request.
Any thoughts would be appreciated. Thanks!
The Twilio Split Widget based on the http response (and one more
later, based on the user input for their code...) should do the job.

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.

Resources