Just run python server.py
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.
Click the button below to automatically set up the app using your Heroku account. Please enter your Twilio Account Sid, Auth token, TwiML App Sid and verified phone number when prompted.
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
:
ngrok http 5000
Please open http://companyfoo.com/token in your browser. You should see a long string.
Please modify BasicPhone and Quickstart to point to your web applications's public URL.
At launch, the client connects to http://companyfoo.com/token to retrieve its capability token.
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.