Home > Internal Configurations > Twilio SIP Gateway Outbound

Twilio SIP Gateway Outbound

Using Flowroute as your Outbound carrier with Twilio Programmable Voice features is quick to set up; follow the steps below to start leveraging the HyperNetwork with Twilio Programmable Voice. In this case we will be using Python as the example language for placing the outbound call. The Twilio documentation covers other programming languages as well 
  1. Login to your Flowroute account and go to Interconnection > Registration to get your account SIP Registrar/Proxy, SIP Username/Auth Username and SIP Password
  2. Use the Twilio Python quickstart guide linked here for instruction on setting up Python and the required libraries on your system
  3. From the Twilio dashboard obtain your 'ACCOUNT SID' and 'AUTH TOKEN'
  4. Below is an example Python script you will use to place the outbound call. Replace the variables in light blue with the information obtained from your Flowroute and Twilio portals and save as 'make_call.py'. In the 'to' replace the DID '9282223333' with the DID you are calling to and in the 'from' replace '928111222' with the phone number being used as the outbound caller ID.
  5. Place an outbound call by running 'python make_call.py'.
 
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'your_account_sid'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

call = client.calls.create(
                        sip_auth_password='flowroute_sip_password',
                        sip_auth_username='flowroute_sip_username',
                        url='http://demo.twilio.com/docs/voice.xml',
                        to='sip:19282223333@us-west-or.sip.flowroute.com',
                        from_='+19281112222'
                    )

print(call.sid)