Programmable Voice and Programmable SMS is offered as a developer preview for Wireless SIMs. (See the section "Known Limitations" below).
Any device connected by a Twilio SIM can make and receive Programmable Voice calls. This requires the device itself to support PSTN voice calling (PSTN is Public Switched Telephone Network, the traditional circuit-switched telephone networks).
Before you set up your device for voice, the Twilio SIM used in the device needs to have a SIM Rate Plan that has, at least, Voice selected as an Enabled Service. If not, you need to create one. See Understanding Rate Plans to learn how to create a Voice-enabled Rate Plan.
- Once you have your SIM voice-enabled, you first need to purchase a voice-enabled Twilio phone number.
- You then create a TwiML bin for making phone calls. Once made, you use this new TwiML to associate your Twilio SIM with your new phone number.
- Now, you create a TwiML bin for receiving incoming calls. As with making phone calls, you associate this TwiML with the Twilio SIM with your new phone number.
Your device connected by a Twilio SIM can then make and receive phone calls through Twilio.
Your device must be located within the United States on the T-Mobile network to use voice. Voice will not work when roaming on T-Mobile partner networks within the United States.
You first to use the Console to purchase a voice-enabled Twilio phone number.
In the Console, you want to make sure the Programmable Wireless icon is visible in the side menu. If not, click All Products and Services and add it by pinning it to the dock.
- From the Phone Numbers menu in the Console, click Buy a Number.
- In the page that appears, select a country.
- Optionally, enter an area code in the Number field to narrow the search.
- Select at least a Voice capability. Additional options (including the type of number, any address requirements, and beta numbers) are available by clicking Advanced Search.
- Click Search to generate a list of available Twilio numbers to purchase.
- Select a number and click Buy.
You can see an example below, which is the result of searching for a number in the United States.
You now have a Twilio phone number that you can associate with your programmable wireless SIM.
- From Programmable Wireless click SIMs.
- Select the SIM that is in your phone. (Need help registering a SIM? See Ordering and registering your first SIM.)
- Click the Programmable Voice & SMS tab.
- In the Programmable Voice section, select TwiML from Voice URL.
- Click the red + button to the right of the input field.
- You should see a popup dialog appear with a TwiML template for routing voice calls as dialed. (See example below.)
- You can give the TwiML bin a Friendly Name.
- In the Response element, replace YOUR_NUMBER_HERE with the Programmable Number you bought in the previous section.
- Click Add TwiML Bin.
- Click Save.
That’s it! You can now make a phone call from your phone. The outbound Caller ID seen by the recipient will be the Twilio Phone Number you purchased earlier. Feeling creative? Use functions or set up your own TwiML server to dynamically set the Caller ID.
You can now make phone calls from your cellphone with a Programmable Wireless SIM but you can't receive calls. This section will help you set up your SIM to receive calls.
In the Console, you want to make sure the Runtime icon is visible in the side menu. If not, click All Products and Services and add it by pinning it to the dock.
- From Runtime open TwiML Bins.
- Click the Red + Button to create a new TwiML Bin.
- Enter a name in the Friendly Name input field.
- For the TwiML
Response, you can use the example TwiML shown below.
- In the Sim element, enter the SIM Sid in place of YOUR_SIM_SID_HERE. You can find your SIM Sid in the SIMs section under Programmable Wireless in the Console. It begins with the DE prefix. (See TwiMLTM Voice: <Sim>)
- Click Save.
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Sim>YOUR_SIM_SID_HERE</Sim> </Dial> </Response>
You can see a completed example in the Console below.
- Open the Phone Numbers section of the Console. (See Purchase an SMS-enabled Twilio phone number above if you don’t have a number.)
- Select the phone number you wish to associate with your SIM.
- From Configure With under Voice & Fax, select TwiML.
- Select TwiML from A Call Comes In.
- Select the TwiML you created in the previous section using its Friendly Name.
- Click Save.
Call the phone number and you should receive the call on your SIM-connected device.
You can view Call Logs for Wireless calls by selecting in the Console an Active Number, from Phone Numbers, then clicking the Calls Log tab.
Most call flows that involve a SIM will include two independent call legs: one call between Twilio and the non-SIM party, and the other between Twilio and the SIM-connected device.
The call leg from Twilio to the non-SIM party (PSTN, SIP, Client, etc.) is billed at standard Twilio voice rates, depending on the connectivity method used. The other call leg between Twilio and the SIM is billed at Programmable Wireless voice rates.
A phone number is provided on the SIM known as the MSISDN which is not used by Programmable Voice or Programmable SMS. The presence of the MSISDN means that some (potentially unwanted) calls may arrive straight to your SIM without routing via Twilio. If this occurs, Twilio cannot yet offer programmatic control over the calls and you won't see them in your Twilio call logs. However, 100% of calls and messages originating from the SIM are programmatically routed by Twilio.
Programmable Voice is currently only offered when connected to the T-Mobile network in the USA. Voice will not work when roaming on T-Mobile partner networks within the United States.
現在、Wireless Programmable Voiceには、アップグレードされたTwilioアカウントが必要です。
Wireless Programmable Voice calls can be processed using TwiML, as shown in these examples. However, it is not possible to directly address a SIM resource in the
To field of the Calls REST API.
誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。