Twilio, the Cloud… and Me!

Today, we’ll briefly detail how to setup a Twilio VoIP number in a way that it’ll allow us to:

– Receive SMS’s via Email
– Send SMS’s via CLI
– Receive Voice Calls via Landline, and if nobody picks up, fallback to Softphone
– Make Voice Calls via Softphone

Before we begin, you’ll need to:

1. Signup!
2. Register a Number!
3. Create a SIP Domain
4. Add a User under the SIP Domains > Credential Lists
5. Setup this “SMS to Email” PHP script”, in your favorite EC2 box

Once ready, let’s open the Developer Center, and opening the TwiML bins. Once there, add the following TwiML’s:

Name: Incoming Voice to Softphone:

[cc lang=”xml”]



USER@SIP-DOMAIN.sip.us1.twilio.com


[/cc]

Name: Incoming Voice to Landline:

[cc lang=”xml”]


Please, hold on the line while i put you through.

YOUR-LANDLINE-NUMBER


[/cc]

Name: Incoming SIP to Destination:

[cc lang=”xml”]


{{#e164}}{{To}}{{/e164}}

[/cc]

Name: Incoming SMS to Email:

[cc lang=”xml]


URL-MAPPED-TO-YOUR-SEND-MAIL-SCRIPT

[/cc]

Once ready, open Phone Numbers > Manage Numbers > Active Numbers and map everything as follows:

A call comes in: Incoming voice to Landline TwiML
A message comes in: Incoming SMS to email Script’s URL

Finally, we need to map the “Incoming Voice to Softphone” TwiML, as follows:

– Open Programmable Voice
– Open SIP Domains and click over your domain
– Set the “Incoming Voice to Softphone” TwiML URL in the Voice Configuration > Request URL field

That should be it, pretty much. As per Soft Phones available for macOS, the most common one is X-Lite, which offers a free version (and it’s also available for iOS).

Hope that helps!

P.s.: With the following snippet, placed in you ~/.profile, you should be also able to send SMS’s via CLI:

[cc lang=”bash”]
function sms() {
curl -X POST ‘https://api.twilio.com/2010-04-01/Accounts/ACCOUNT-KEY/Messages.json’ \
–data-urlencode “To=${@:1:1}” \
–data-urlencode “From=YOUR-TWILIO-PHONE” \
–data-urlencode “Body=${@:2:1}” \
-u USER-KEY:USER-SECRET
}
[/cc]

San Francisco Muebles: A Website from the 90’s!

Several years ago (1999 to be precise!), i’ve started a simple website for my father’s business: San Francisco Muebles.

This is how it used to look like (thanks god for web.archive.org!)

san-francisco-muebles

Back then, iframes, simple javascript, fancy flash buttons… and some plain html was, pretty much, the gold standard for a personal (OR business) website.

Over the years, my dad’s website has evolved into many different incarnations: i’ve adopted Plain-PHP, Code Igniter, and jQuery to handle fancy transitions.

But at some point you hit a brickwall: how do i make this maintainable by anyone (not just me!) and extremely lightweight?. I do run my own Amazon Box… can i also have an extra backup layer, just in case i break my EC2 instance?

What is Jekyll?
It’s a simple tool, written in Ruby, that allows you avoid HTML duplication: if you’ve got many pages that should look the same way, you simply get to write a template, and reuse it all over.

Why Jekyll?
Jekyll is the engine behind Github Pages, and it simply caught my eye.

What is so great about having a website in Plain HTML?
Simply put, the resources required to host a Plain HTML website are extremely low.

Plus, you get to use Route53 Failover Mechanism: your website is constantly monitored. If anything goes wrong, Route53 takes over, and maps your domain elsewhere. In my case, Amazon S3 will just kick in, and serve the site.

Conclusions!
Implementing Jekyll has been a fun (and quite successful) experiment. It just took under 8 hours to do the whole thing.

However, some knowledge is still required: you need to execute a script, and upload the output to the server. Which is okay, but… there are many ways in which things can go wrong.

Bottomline: there is nothing easier, and more parent-friendly, than WordPress. Which is precisely the reason why the next incarnation will be WP based!