https://signalwire.com/blogs/product/programmable-sip-connectivity-and-routing
Inbound and outbound works globally. Config files also available at: https://www.twilio.com/docs/sip-trunking/sample-configuration#freeswitch.
Add the SignalWire IP addresses into the domain section under autoload_configs/acl.conf.xml you can nslookup sip.signalwire.com
<configuration name="acl.conf" description="Network Lists">
<include> <gateway name="signalwire-outbound"> <param name="username" value="---user---"/> <param name="password" value="---password---" /> <param name="proxy" value="example.signalwire.com" /> <param name="register" value="false"/> </gateway> <gateway name="signalwire-inbound"> <param name="username" value="---user---"/> <param name="password" value="---password---"/> <param name="proxy" value="example.signalwire.com"/> <param name="register" value="false"/> <param name="dtmf-type" value="rfc2833"/> <param name="context" value="public"/> </gateway> </include>
<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>
<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/signalwire-outbound/+1$1"/> </condition> </extension> </include>
Send any SMS from Dialplan to your smartphone, notifying you of various things that happening.
<extension name="signalwire sms curl"> <condition field="destination_number" expression="^767$"> <!-- setup bleg uuid of this call so we we know it before hand --> <action application="set" inline="true" data="bleg_uuid=${create_uuid()}"/> <!-- setup signalwire credentials --> <action application="set" inline="true" data="space_name=XXXXXX"/> <action application="set" inline="true" data="project_key=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"/> <action application="set" inline="true" data="api_token=PTXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"/> <!-- not using '+' here, just the 11 digit number itself, see curl line below --> <action application="set" inline="true" data="signalwire_number=18005551212"/> <action application="set" inline="true" data="cellphone=18885559999"/> <!-- urlencode your 'spaces' to '%20' so the text body will work in the url, may need to consider other untested punctuation --> <action application="set" inline="true" data="sms_body=${system(printf 'aleg ${uuid} is calling bleg ${bleg_uuid}' | sed -r 's/ /%20/g')}"/> <!-- We need to base64 encode the basic authorization for curl request--> <action application="set" inline="true" data="auth=${system(printf '${project_key}:${api_token}' | base64 --wrap 0)}"/> <!-- notice for E.164 formatting we encode the '+' to '%2B' for the 'From' and 'To' params on the URL, and must send as post --> <action application="curl" data="https://${space_name}.signalwire.com/api/laml/2010-04-01/Accounts/${project_key}/Messages.json?From=%2B${signalwire_number}&To=%2B${cellphone}&Body=${sms_body} append_headers Authorization:'basic ${auth}' post"/> <action application="answer"/> <action application="bridge" data="{origination_uuid=${bleg_uuid}}user/1004"/> </condition> </extension>
For a more comprehensive walk through of provisioning SignalWire trunks, configuring FreeSWITCH, and best practices please see our signalwire.com docs https://signalwire.com/blogs/product/programmable-sip-connectivity-and-routing.