How I replaced Skype with Twilio to make phone calls from my computer.
Working remotely, I have become used to the comfort of making calls from my computer on Slack or Discord. Using a quality headset gives a warm sound and a feeling of proximity, and leaves the hands clear for typing on the keyboard and looking up information during the call.
I have been a longtime subscriber of Skype premium service to get a similar experience when calling regular phones instead of other computers. Sadly, as the Skype service stagnated for many years before changing for the worse in 2017–2018, I had to find a better alternative and I started to look into VOIP services with support for calls to the PSTN in 2018–2019.
This is the story of how I successfully configured Twilio to get a mobile phone number which can make and receive calls from my computer.
I have described all the steps that I followed in details, including the understanding that I gained through trial and error, in separate issues:
If you are interested only in how to reproduce my current setup, you can read the short story below. It features links to more details in the long story, if you need them.
<?xml version="1.0" encoding="UTF-8"?>
<!-- Making Calls from SIP to Regular Phones -->
<Response>
<Dial callerId="{{#e164}}{{SipDomain}}{{/e164}}">
{{#e164}}{{To}}{{/e164}}
</Dial>
</Response>
copy the URL of the TwiML bin, found in its details after saving the script.
go to the settings of the SIP domain, and under Voice Configuration, paste the URL from the clipboard into the Request URL field
save the settings of the SIP domain
launch Linphone on your computer
test the setup: call a regular phone number from Linphone
you can then save this phone number as a contact
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<!-- Receiving Calls from Regular Phones to SIP -->
<Dial>
<Sip>sip:me@1-202-555-0162.sip.us1.twilio.com;transport=tls;secure=true</Sip>
</Dial>
</Response>
In the above script, replace the user name and domain in the <Sip>
element with the identifier of the SIP user that you created,
followed with @
and the SIP domain that you created, ending
with .sip.us1.twilio.com;transport=tls;secure=true
:
<Sip>sip:[SIP User]@[SIP Domain].sip.us1.twilio.com;transport=tls;secure=true</Sip>
go to the configuration of your phone number on Twilio
next to "A call comes in", select TwiML and the script that you just created to manage incoming phone calls
delete the URL next to "A message comes in", which answers all texts with a canned response
save the settings
try to call your Twilio number from a regular phone
You can extend the TwiML script which handles incoming calls to forward the caller to voicemail when you fail to answer:
http
to https
action
attribute to the <Dial>
elementhttp
to https
&Dial=true
at the end of the URLYou now have a script of the form:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<!-- Receiving Calls from Regular Phones to SIP (with Voicemail) -->
<Dial action="https://twimlets.com/forward?FailUrl=https%3A%2F%2Ftwimlets.com%2Fvoicemail%3FEmail%3Dyou%2540example.org%26Message%3Dhttps%253A%252F%252Fyour-runtime-domain.twil.io%252Fassets%252Fgreeting.wav%26Transcribe%3Dfalse&Dial=true">
<Sip>sip:your-sip-user@your-sip-domain.sip.us1.twilio.com;transport=tls;secure=true</Sip>
</Dial>
</Response>
where:
you@example.org stands for your email address
https://your-runtime-domain.twil.io/assets/greeting.wav stands for the URL of your greeting asset
your-sip-user stands for the SIP user that you created for yourself
your-sip-domain stands for the custom SIP subdomain that you created
you can now close your computer and call your Twilio number from a regular phone to test the voicemail
When sending an SMS by email, you will need to include the phone number of the recipient, in international format, in the subject, e.g. New SMS to +## ###-###-#####.
{{steps.trigger.event.headers.subject.replace(/^.+\+/,'+').replace(/[^+0-9]/g,'')}}
{{steps.trigger.event.body.text}}
200
,
header Content-Type:application/xml
and the static response below:<?xml version="1.0" encoding="UTF-8" ?>
<Response/>
New SMS from {{steps.trigger.event.body.From}}
{{steps.trigger.event.body.Body}}
The current setup does not fulfill all of my expectations yet: