Twilio: statusCallBack? - twilio

Need some Twilio help. I am a novice and I'm kinda lost. This may seem overly simplistic BUT I have a CRM client that will track calls as long as the inbound calls ping the URL - x2vps.com/index.php/api/voip/data/{caller id goes here}
Note: The CRM will automatically track all registered phone numbers that ping this URL.
I have the call routing piece figured out. I can't figure out how to code twilio's API to append the inbound caller ID's to the CRM's URL and ping it. I want to log all calls regardless of the status.
If you could point me in the right direction I would be truly appreciative.
Thank you!

Twilio developer evangelist here.
Twilio does not append the caller ID to the webhook URL that you set. In order to do something like this, you'd need to provide some sort of server in the middle that can transform the Twilio request into the format you need.
You'd do this by creating a web application that would be able to receive the webhook from Twilio. It would then need to get the incoming Caller ID from the Twilio request, this is the From parameter. With the Caller ID, your application would then construct your CRM endpoint URL and make the HTTP request itself. You'd need to decide whether you need to include all the original parameters, if the CRM system can use them.
Let me know if this helps.

Related

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

Is it possible to send twiml content rather than pointing to a URI when initiating a Twilio call

When i make a call as voice content to that call, can i send a dynamically generated twiml message rather pointing to a URI that contains twiml message ?
If not is there a a workaround to accomplish this , cause I see DIAL and SAY APIs which get used during call response, so would it be possible to make use of those when creating a new call and passing twiml messages using these APIs ?
https://www.twilio.com/docs/api/twiml/dial
https://www.twilio.com/docs/api/twiml/say
Twilio evangelist here.
Its not possible to send TwiML to the REST API. If you don't want to host the TwiML on your own URL there are a few options:
Use TwiML Bins which lets you host relatively static (there is some templating support) TwiML on Twilios servers.
Use Twilio Functions which let you write, store and execute Node on Twilios servers
Use Twilio Studio to define your call flow. A flow in studio can be triggered via an HTTP request to it, so you can take the flows URL and pass it to the REST API when you start your outbound call.
Hope that helps.

How to trigger a call to url when a machine is detected twilio

We are currently using Twilio's rest api to initiate calls. We want to use Twilios machine detection but are having issues. We want to fire off to a url no matter what the result and use the AnsweredBy to add some logic to return different twiml depending on whether it was answered by a human or machine.
we developing in C# and have the following code:
var call = CallResource.Create(
to,
from,
url: successfulCallUrl,
record: true,
machineDetection: "Enable"
);
but our url is only triggered if the call is answered by a human and not if it goes to an answer machine. we need it to be triggered no matter what the result of the call to determine what to do with it.
Your URL is requested when an outbound call is answered no matter what, the only difference is that if answering machine detection is on then an extra request parameter is supplied by Twilio. There is no scenario (as far as I'm aware) where Twilio will not request TwiML from your URL when a REST initiated outgoing call is answered.
What shows up as the request parameters in the request inspector for your voice logs? For calls answered by a human does Twilio supply an AnsweredBy parameter?
I just tried using the curl example on the Twilio site and let the call go to voicemail, in my console logs Twilio is posting to my call handling URL to retrieve my twiml with the following parameter, so what you want to do is technically possible.
AnsweredBy machine_start
Perhaps the answering machines you are calling are confusing Twilio and you need to reduce the timeout threshold? Maybe the C# syntax for enabling detection is different to yours? I don't know the answer, but your call logs will certainly yield a clue as to where to start.

How to SAY after DAIL

I have an incoming call that triggers an outgoing call. When the outgoing call is answered, I want to SAY an announcement, ideally without the original caller hearing it.
I tried to respond with a TwiML to the callStatusCallback and I also tried nesting the SAY node within NUMBER. Both didn't work. Any ideas?
Twilio developer evangelist here.
What you're referring to here is commonly known as a call whisper.
You can implement it by providing a URL to the <Number> verb in the TwiML you return that forwards the call. That URL should return some more TwiML, in this case <Say> with the text you want to read out. Then when the call is forwarded, Twilio will make a webhook to that URL when the user answers and only connect the calls when the TwiML is complete.
Let me know if that helps at all.

How to retrieve 'Digits' parameter from call log?

In the twilio web interface, when I look at a specific call, I can see all the associated requests under the request inspector. Is there any way to retrieve this data via the REST API?
Specifically, I'm trying to retrieve the 'Digits' parameter to see what a caller dialed in response to a <gather>
Twilio evangelist here.
There is currently no way to download the entire HTTP request/response using the API. This is something you would have to log yourself as the call is occuring. If you save the call sid at the same time as the Digits, that would allow you to tie those digits back to a specific call.
Hope that helps.

Resources