get the closest local number programmatically using Twiml - twilio

I would like to use the right Twilio phone number I own to make outgoing calls, once I know the destination phone number I need to choose programmatically the local number which can make the call the cheapest possible.
Is there a way to achieve using Twiml and without storing the Twilio Phone numbers in a DB and do checking from my side.
Thanks in advance.

Twilio evangelist here.
You can use the REST API to ask Twilio to give you a list of all of the phone numbers you own, select the right phone number from that list, then generate the TwiML dynanmically.
Hope that helps.

Related

How to test international numbers between Twilio and a service like TextMagic

I'm trying to set up our app to send SMS with Twilio. The person who does a lot of our testing lives overseas, so I need to obtain a US phone number that she can use so she can do her testing. I got a number via TextMagic, but when I try to add it to the list of verified numbers on my Twilio dashboard, the verification code (seemingly) never gets sent to the TextMagic number. Is there some sort of restriction on Twilio's side regarding numbers generated from services like TextMagic? Any info would be greatly appreciated!
Twilio developer evangelist here.
I'm not aware of anything that would necessarily restrict things between Twilio and TextMagic.
Can I suggest using another Twilio number to test things? It does work to send between Twilio numbers and you'll need the same knowledge to setup the Twilio number as to use it as a test number.

Twilio conference call participants can able to see other participants numbers or not?

I am trying to integrate Twilio call and conference call, before that I have few doubts on it.
While conference call time one participants can able to see other participants real numbers or not? If possible, how to restrict that?
Twilio developer evangelist here.
With a conference call, your participants will only see one number, the Twilio number that they called or that you make calls from.
With regular calls, you have the option to set a callerId when you forward a call. If you don't set this, then the incoming caller ID is used and the number will be shared with the person being called. If you set the callerId to a Twilio number, then the person being called will only see the Twilio number.
If you are looking to build masked number/anonymous communications, then I recommend you take a look at Twilio Proxy which can handle all of this for you too.

Add forwarding number to the Twilio number programmatically

How to forward the call to an US local Twilio number from any mobile to any US number?
Its seems to me that I will have to use TwiML to achieve that. Moreover, the supporting doc in https://support.twilio.com/hc/en-us/articles/223179908-Setting-up-call-forwarding#devs is not seeming to show the TwiML correctly. And also with that way I will have to use verb.
Can I not directly call from the number pad of my mobile to the Twilio number so that the call can be received from the forwarding number?
Can I not set a forwarding number to the purchased number programmatically?
Twilio evangelist here.
To forward a call made from your mobile device to a Twilio number to another US phone number you can use the <Dial> verb:
<Response>
<Dial callerId="[your_twilio_phone_number]">[target_phone_number]</Dial>
</Response>
This part of the Voice Quickstart for PHP shows this and might be useful for you:
https://www.twilio.com/docs/quickstart/php/twiml/connect-call-to-second-person
Hope that helps.
This was what I went with before getting the answer from Twilio support but after the answer from #Devin Rader and from my client.
here is a great tutorial doing call forwarding programmatically,
https://www.twilio.com/docs/tutorials/walkthrough/call-tracking/php/laravel.
Yes, you can definitely set the TwiML programmatically on the numbers,
take a look at the documentation on provisioning phone numbers,
https://www.twilio.com/docs/api/rest/incoming-phone-numbers. You can
also set the number so that Twilio makes a call to your application
and your application delivers TwiML dynamically.

Twilio number to another twilio number call

I am developing contact center using twilio where my application get request from server to call contact center, so my application initiate a request to call contact center (Twilio enabled number) and contact center is twilio soft phone once the contact center accept a call my application initiate another request to call user so contact center person and user will be in conference. In my application From number is also a twilio enabled number. so my question is can I call one twilio enabled number to another twilio enabled number using java?
Twilio developer evangelist here.
I'm not 100% clear on what you're trying to achieve, but it is certainly possible to connect two Twilio numbers in a call. Those numbers will need to either dial onto a Twilio soft phone or a phone number connected to a real phone in order to connect two people.
I'd recommend taking a look at this Java click to call tutorial which should give you an idea of how to connect to one number, then generate the call to another number and give you a start in this.
Let me know if this helps at all.

Using Twilio as call center backend how to reduce double cost for calls

I am using Twilio in a custom made app using the "Click to Call" feature where the agent will click a button in the web browser and their phone will ring and once they pick up a client from the list X is then called.
My only concern is that although the app is working great and Twilio is working like a charm I noticed that I am been charged twice in my seudo call center. So, my question is:
What am I doing wrong? (or is this the way it works?)
Twilio evangelist here.
Can you give a bit more detail on what you are seeing?
The way Twilio charges is per call "leg", with different prices for "inbound" (eg someone calls your Twilio number") or "outbound" (eg you have Twilio call someone) legs. In your scenario it sounds like you have two outbound legs, one from Twilio to the agent and one from Twilio to the client.
Hope that helps.

Resources