Pass Information from IVR to Call Center in SIP Header - twilio

We have implemented an IVR system which also redirects calls to a Call Center. The Call Center wants us to send relevant information in the custom SIP Header so that the IVR can pass custom information that will be useful to service the call without requesting the information entered in the IVR again.
I have tried to find documentation which clearly explains what is needed to be done but have had no luck.
Is it as simple a adding custom headers as SipHeader_X-headername=headervalue as part of the Voice response as mentioned in https://www.twilio.com/docs/api/twilio-sip/sip-twiml
or something else is required like the SIP URL as mentioned in https://www.twilio.com/docs/api/twiml/sip
Any direction/help will be really helpful.Thanks in advance.
UPDATE to question :
Configured an URL in Twilio to direct calls.Using Java based Microservice app using Spring Boot to service the URL calls. The below code snippet contains the Dial to the CSR.
String say = null;
Redirect redirect;
VoiceResponse.Builder builder = new VoiceResponse.Builder();
say = messageSource.getMessage("You are connecting to CSR", null,
Locale.ENGLISH);
builder.say(new
Say.Builder(say).voice(Voice.ALICE).language(Language.EN_US).build()).dial(new
Dial.Builder().number(new Number.Builder(number).build()).build());
response.setContentType("application/xml");
response.getWriter().append(builder.build().toXml());

Sounds to me like you are dialing out to a SIP endpoint so your extra parameters should look something like this from the docs you linked to:
$dial->sip('sip:jack#example.com?mycustomheader=foo&myotherheader=bar');

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.

Outbound SIP calling with a TwiML Bin: Voice Configuration Request URL

Twilio documentation says to set the outbound URL into the "Voice configuration Request URL" but I cannot find this field. Does everyone clueless about this?
(Basically repeating Alan's answer and comment with a bit more newbie angle, but I cannot comment yet as I don't have the required reputation)
The "A Call Comes In" action for your SIP Domain is, as Alan explains in his comment, for the calls originating from the endpoint or UA. Hence, the simple example TwiML routing the call to a e164 works here.
Calls originating in the PSTN are handled by the TwiML (or other action) set to handle calls coming in to your number, ie. in Programmable Voice -> Numbers -> Manage Numbers -> # -> A Call Comes In.
Choose, "A Call Comes In" and set the drop down to Webhook, then paste the URL into that edit box, click Save.

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

How to pass in a custom parameter to TwiML Bin?

I have some issues trying to pass a custom parameter to TwiML Bin. See attached pictures.
Everything works except the paramter.
Any ideas of what I am doing wrong?
Setup:
Twilio developer evangelist here.
ApplicationSID is from TwiML applications which are containers for a set of URLs and configurations that tell Twilio what to do when one of your Twilio numbers receives a call or SMS message.
If you're using dynamic content from custom HTTP request parameters (ie. name in this case), you should take your TwiML bin's URL and pass it the Name parameter like this in, for example, Python, to generate a call with the custom parameters:
client.calls.create(
url="your-twiml-bin-url?Name=Jeremy",
to="your-phone-number",
from_="your-twilio-phone-number")

Twilio: statusCallBack?

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.

Resources