SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to Route Inbound and Outbound Calls Between Twilio and Linphone

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

  1. Navigate to Communications > Voice > SIP domains > Credential lists
    Click Create new Credential List (or the + icon).
  2. Enter a friendly name for the credential list, provide a Username and Password, and click Create.
     

Step 2: Create a SIP Domain

  1. Navigate to Communications > Voice > SIP domains
  2. Click Create new SIP Domain (or the + icon)
  3. 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

  1. Scroll to the SIP Registration section and select it to Enabled.
  2. Under Credential List, select the Credential List you created in Step 1.
  3. Click Save.
     

Step 4: Create TwiML Bins for Inbound and Outbound Routing

  1. Navigate to Builder tools > TwiML host & config > TwiML bins
  2. Click Create new TwiML Bin
  3. 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>
  1. Paste the following TwiML configuration, replacing [Your Twilio Number] with your E.164 formatted Twilio phone number (for example, +15551234567)
  2. Create the inbound routing TwiML Bin
  3. Click Create new TwiML Bin (or the + icon)
  4. Set the Friendly Name to TwilioToSIP.
  5. 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 

  1. Navigate to Communications > Voice > SIP domains and edit the Call control configuration.
  2. Under Configured method, select TwiML Bin and choose SIPToTwilio.
  3. Click Save.
     

Step 6: Configure Twilio Phone Number

  1. Navigate to Communications > Overview > Phone Numbers select the number you want to configure
  2. Select Configuration details > Voice and emergency calling > Edit Configuration Details
  3. Select Use TwiML Bins and choose TwilioToSIP.
  4. Click Save.
     

Step 7: Connect Linphone [Third Party App]  to Your Twilio SIP Domain

  1. Open the Linphone application on mobile device.
  2. Select Use a third-party SIP account.
  3. 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.
  1. Complete the login. Once registered, incoming calls to your Twilio number ring in Linphone, and outbound calls placed from Linphone route through Twilio.
Have more questions? Submit a request
Powered by Zendesk