Twilio Mobile Quickstart

Mobile Quickstart

This repository includes server-side web application required for Twilio mobile sample apps such as Quickstart and BasicPhone. The Python script is responsible for generating capability tokens and serving TwiML.

Prerequisites

Please sign up for a free Twilio account. You will need your Account Sid and Auth Token available in your Account Dashboard. You will also need to create a TwiML App. Please make sure that you point the TwiML app's Voice Request URL to your web application's public URL, e.g., http://companyfoo.com/call.
You will also need a verified phone number to be used as caller ID when placing phone calls. See the "Verified Caller Ids" section
under Numbers
tab in your Twilio Account.

Deployment

In order to Twilio can communicate with your web application, it needs to be
deployed on the public Internet. Some of the options include using Heroku, ngrok, etc.

If you prefer to run your application locally, please make sure that you have Python and pip installed. Please install the required packages:

pip install -r requirements.txt

Please replace ACCOUNT_SID, AUTH_TOKEN, APP_SID and CALLER_ID in server.py with values from your Twilio account. Simply run the application by python server.py. You can tunnel localhost to the public Internet using ngrok:

Client Configuration

Usage

When you hit the "Call" button in the mobile app, it makes a call to your Twilio application that then makes a request to your web server (http://companyfoo.com/call). The script routes the call accordingly, either to a phone number or to another client.

If you want to receive a phone call in your mobile app you need to have a Twilio phone number (https://www.twilio.com/user/account/phone-numbers/incoming). Please configure the phone number's Voice Request URL to point to your web application's public URL (http://companyfoo.com/call). When someone calls your Twilio phone number, Twilio makes a request to your web application. Your web application returns TwiML that instructs Twilio to connect the phone call with client jenny. Either a purchased number or your sandbox number can be used.