I am using Twilio for inbound calls, where user can call an application through Twilio-Number (brought from Twilio) and will be redirected to admin.
Now, We want Admin to call User using same Twilio-Number. We wabt to call this as <Twilio_Number>#<user_id>. We want to pass <user_id> as extension, so that when Admin clicks on the link with tel=<Twilio_Number>#<user_id>, it will initiate a phone-call to twilio-number.
In our app, we will find user's mobile using his id and redirect call to user's mobile number.
I have referred this doc: https://www.twilio.com/docs/howto/companydirectory
But would need few more details like:
How will Twilio recognize the extension number? And by which name is it provided in call-request parameters?
Currently, we received these parameters in twilio-voice call request
CallSid, AccountSid, ApiVersion, Direction, To, Called, Caller, From. In the same request-parameters, how I can get extension digits?
Thanks.
Have you had the chance to review the IVR information provided on Twilio's site? I believe it is a better solution for what you are trying to accomplish.
https://www.twilio.com/docs/howto/ivrs-the-basics
(Please follow the links to the next section at the bottom of the pages.)
After reviewing the documents, please open a support request with specific questions via https://www.twilio.com/user/account/support/ticket/create
Look forward to your ticket.
Take care!
I don't know if you solved this problem yet (probably yes) but what you can do is, create a record in DB with the extension (id agent) and when Twilio go to your callback url updated the records depending of the state.
Hope this works to you. I'm doing this with the same scenario.
Related
I have this idea where I need to connect customer A (who is hiring) with customer B (who is to be hired) via a direct phone call with just a push of a button, and customer B (who is to be hired) don't want anyone to just have access to his personal phone number (to avoid spam calls).
Well, to make this work I found out that Twilio can handle programmable voice calls which I implemented using ASP.NET Core but that's not exactly what i wanted because customer A (who is hiring) is not allowed to speak directly with customer B (who is to be hired) while the TwiML is at work.
Using Twilio, is there a way for these two customers to communicate via direct calls while hiding the phone number of customer B (who is to be hired) from customer A (who is hiring)? To throw more light to this, on behalf of customer A I want to place a call to customer B's phone number using Twilio's phone number. Any help will be appreciated, thank you.
Twilio developer evangelist here.
You absolutely can connect two customers via a direct call while hiding customer B's number.
I'll give you the very basics first, then suggest some ways to make it more scalable.
To create a number that A can call that will connect A to B you need to buy that number from Twilio and configure it so that when a call comes in to A it returns TwiML that connects to B. For this initial example, you could use a TwiML Bin or some static TwiML that you host. The TwiML needs to use <Dial> and <Number>, like this:
<Response>
<Dial callerID="YOUR_TWILIO_NUMBER">
<Number>Customer B's phone number</Number>
</Dial>
</Response>
Now, when A calls the number they will get connected to B. And if you set the callerId to your Twilio number it will also appear to B to come from your Twilio number, keeping their phone number private too.
Using hard-coded TwiML like this doesn't scale though. You have a few options to improve this.
First, you could have A initiate the call from your application, by clicking a button. That button could trigger a call to A using the REST API and pass it the TwiML above so that when A answers the phone
it then dials B. Like:
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
class Program
{
static void Main(string[] args)
{
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
string twilioNumber = Environment.GetEnvironmentVariable("TWILIO_NUMBER");
TwilioClient.Init(accountSid, authToken);
var call = CallResource.Create(
twiml: new Twilio.Types.Twiml($"<Response><Dial callerId='{twilioNumber}'><Number>CUSTOMER_B_NUMBER</Number></Dial></Response>"),
to: new Twilio.Types.PhoneNumber(CUSTOMER_A_NUMBER),
from: new Twilio.Types.PhoneNumber(twilioNumber)
);
Console.WriteLine(call.Sid);
}
}
Another alternative is to let A call directly from within your application using Twilio Client to make the phone calls from your browser.
To dig a bit deeper, you can also use Twilio Proxy to create a session between the two customers and your Twilio number, creating a connection that would allow either of A or B to call the Twilio number and get connected to the other for the duration of the session. Under the hood Proxy works to automate the delivery of the TwiML described above whilst also maintaining the session between the users until it is done with and the number can be reused by customer A to connect to a new customer. Check out the Proxy quickstart to get a better idea how it works.
Using one of Twilio Proxy or Twilio Client is probably the best for your application, but it depends on the interface you want to provide for your users.
I had been trying to sort out how can I make an app to app call using Twilio SDK, every time I end up reading the documentation that make me call a Phone number.
Can anyone please guide me towards the right direction ?
I have been following this link for long:
https://www.twilio.com/docs/quickstart/client/ios#gather-twlio-account-information
Twilio developer evangelist here.
With the quick start tutorial that you have been following, there is an example application that can make calls to both phone numbers and to other applications. The key is, instead of setting a phone number when you dial, you can also set another client identity. The quick start server applications for this give the example app a random identity which you can see in the top bar of the app, which you can use in this case.
So, when you type in another client identity, device.connect is called with a dictionary with one key, To, set to the identity (https://github.com/TwilioDevEd/client-quickstart-swift/blob/master/SwiftTwilioClientQuickstart/DialViewController.swift#L165):
connection = device.connect(["To":dialTextField.text!], delegate: self)
This will then be present in the request that Twilio makes to your TwiML app and, taking the Ruby example server as our example here, you can then use this identity to return a TwiML <Dial> to another <Client> (rather than a <Number>).
The key overall is that you set an identity for each of your application users (which is random in the example), you can then call other identities by passing the identity you want to call into device.connect and reading that out of the parameters in Twilio's request to your TwiML application. If you then return TwiML to direct Twilio to <Dial> the <Client> with the identity you sent then an app to app call will be made.
Let me know if that helps at all.
I used this as my helpguide: Twilio: Forward received SMS to URL
But the problem is I cannot extract anything from the set of parameters.
I'm using Classic ASP and I'm try to capture anything that exists in the Request.QueryString by placing it into a database.
All I want to do is to insert the from phone number and body/text message into my database every time a message is received. All I get is an empty record in the database.
By default when Twilio receives an SMS to your Twilio phone number it makes a POST request to your ASP page, sending a set of form-encoded values. This means you should use:
Request.Form("Body")
If you want Twilio to make a GET request instead, allowing you to use Request.Querystring, you can configure that on the phone number configuration page in your Twilio Console.
According to the docs, the default value for Twilio's StatusCallbackMethod is POST, so unless you've specified otherwise, you will be receiving your desired parameters in the POST body, not in the query string.
If you just want to forward an SMS to a URL or Rest API there are few android apps that do just that, most of them are paid ones.
This is one example:
https://www.forward-sms-to-rest-api.com
so, when i send a text message to twilio number, i want it to trigger a specific event in the webapp via http POST. For example, by making a http call to the webapp URL (http://webapp.com/triggerA) which it process to trigger an event A in the webapp.
Can I do this with twilio? If,so is there a sample piece of code which I can refer.
From what I understand from your question, I think you can do the following.
With Twilio, when you login into here
https://www.twilio.com/user/account/phone-numbers/incoming
You will find a list of your incoming numbers, I am assuming that you have already purchased a number. Once you click on a number in the list, you will find a page that where you can view and set various properties for the number you are looking at.
You will see a header called Messaging. Under that menu you will see a request Url.
you can set this to http://webapp.com/triggera as per your example. you can also choose whether you would like to use a http post or a http get request type.
the link below, will help you further for handling the data that Twilio passes your application.
https://www.twilio.com/docs/api/twiml/sms/twilio_request
Louis
I would like to update a meeting as more people RSVP for the meeting. Currently I do not see any place to enter a callback URL for when attendees RSVP.
Thanks.
Great suggestion!
Eventbrite does not currently allow a callback url or web hook to be configured, exposing this type of activity.
However, you might be able to build this kind of notification system by placing a tracking pixel (or some similar web asset) on the event's order confirmation page.
If you can detect the HTTP referrer information from the request, it could probably be used to detect the event_id and order_id (which are embedded in the order confirmation page's url path).
Let me know if that works - #RyanJ