Objective
Configure Twilio Programmable Voice SIP Domains and TwiML Bins to route inbound and outbound calls with the Linphone softphone client. By setting up SIP registration and call control routing in the Twilio Console, you can make and receive calls directly through Linphone using your Twilio phone number.
Product
Programmable Voice
Environment
Twilio console
User Account Permission/Role(s) Required
You need Administrator or Developer permissions in the Twilio Console to create SIP Domains, Credential Lists, and TwiML Bins, as well as to update phone number voice configurations.
Procedure
Step 1: Create a SIP Credential List
- Navigate to Communications > Voice > SIP domains > Credential lists
Click Create new Credential List (or the + icon). - Enter a friendly name for the credential list, provide a Username and Password, and click Create.
Step 2: Create a SIP Domain
- Navigate to Communications > Voice > SIP domains
- Click Create new SIP Domain (or the + icon)
- Enter a Friendly Name and a unique SIP URI (for example, my-domain.sip.twilio.com)
Step 3: Once Sip Domain is created enable the SIP Registration
- Scroll to the SIP Registration section and select it to Enabled.
- Under Credential List, select the Credential List you created in Step 1.
- Click Save.
Step 4: Create TwiML Bins for Inbound and Outbound Routing
- Navigate to Builder tools > TwiML host & config > TwiML bins
- Click Create new TwiML Bin
- Set the Friendly Name to
SIPToTwilio.
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial answerOnBridge="true" callerId="[your twilio number]">{{#e164}}{{To}}{{/e164}}</Dial>
</Response>- Paste the following TwiML configuration, replacing
[Your Twilio Number]with your E.164 formatted Twilio phone number (for example,+15551234567) - Create the inbound routing TwiML Bin
- Click Create new TwiML Bin (or the + icon)
- Set the Friendly Name to
TwilioToSIP. - Paste the following TwiML configuration, replacing
[user]with your SIP credential username created in step 1 and[your-domain]with your SIP Domain name create din step 2:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Dial>
<Sip>sip:[user]@[your-Domain].sip.us1.twilio.com</Sip>
</Dial>
</Response>
Step 5: Configure Your SIP Domain
- Navigate to Communications > Voice > SIP domains and edit the Call control configuration.
- Under Configured method, select TwiML Bin and choose SIPToTwilio.
- Click Save.
Step 6: Configure Twilio Phone Number
- Navigate to Communications > Overview > Phone Numbers select the number you want to configure
- Select Configuration details > Voice and emergency calling > Edit Configuration Details
- Select Use TwiML Bins and choose
TwilioToSIP. - Click Save.
Step 7: Connect Linphone [Third Party App] to Your Twilio SIP Domain
- Open the Linphone application on mobile device.
- Select Use a third-party SIP account.
- Enter your SIP details:
- Username: Enter the username from your Twilio Credential List.
- Password: Enter the password from your Twilio Credential List.
- SIP Domain: Enter
[your-domain].sip.twilio.com.
- Complete the login. Once registered, incoming calls to your Twilio number ring in Linphone, and outbound calls placed from Linphone route through Twilio.