Call Us Today! 877.742.2583




Page tree
Skip to end of metadata
Go to start of metadata

https://www.twilio.com/sip-trunking

Inbound and outbound works globally. Config files also available at: https://www.twilio.com/docs/sip-trunking/sample-configuration#freeswitch.

 

Add the Twilio IP addresses into the domain section under autoload_configs/acl.conf.xml

 

<configuration name="acl.conf" description="Network Lists">
    

 

Registration: /usr/local/freeswitch/conf/sip_profiles/external/

 

<include>
        <gateway name="twilio-outbound">
                <param name="username" value="---user---"/>
                <param name="password" value="---password---" />
                <param name="proxy" value="example.pstn.twilio.com" />
                <param name="register" value="false"/>
        </gateway>
      <gateway name="twilio-inbound">
      <param name="username" value="---user---"/>
      <param name="password" value="---password---"/>
      <param name="proxy" value="example.pstn.twilio.com"/>
      <param name="register" value="false"/>
      <param name="dtmf-type" value="rfc2833"/>
      <param name="context" value="public"/>
      </gateway>
</include>

 

Inbound calling: /usr/local/freeswitch/conf/dialplan/public/
<include>
  <extension name="public_did">
    <condition field="destination_number" expression="^\+15550000000$">
      <action application="set" data="domain_name=$${domain}"/>
      <action application="playback" data="phrase:greeting"/>
      <action application="transfer" data="1000 XML default"/>
    </condition>
  </extension>
</include>

 

Outbound calling: /usr/local/freeswitch/conf/dialplan/default/
<include>
   <extension name="twilio-outbound">
    <condition field="destination_number" expression="^(1{0,1}\d{10})$">
    <action application="set" data="effective_caller_id_number=+15550000000"/>
    <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
    <action application="bridge" data="sofia/gateway/twilio-outbound/+1$1"/>
  </condition>
   </extension>
</include>

 

 

For a more comprehensive walk through of provisioning Twilio trunks, configuring FreeSWITCH, and best practices please see our Getting Started Placing Outbound Calls with Twilio Elastic SIP Trunking and FreeSWITCH blog post.