As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

## 2013/08/21

### Caller ID, Time and Temp with Twilio

The other day, my wife got a new phone, replacing her shattered iPhone 4 with a new LG Optimus. The problem is, by rotation, the upgrade was for me, so the new phone was to have my phone number. They moved it to her phone number, but that left me disconnected from the cell network. At least, I knew at the time I was disconnected, but I was less than sure that her phone was using her number.

My thought was, "It would be nice to be able to call someplace and have it tell you what number your phone is, so we could be sure." So, I wrote something.

This uses Twilio, which is essentially an API into IP telephony. I've used Twilio before, and have two projects on GitHub, Call_Me and SMS_Me, that are generally unidirectional messaging tools, but I haven't done much interactivity with the tool.

It gives the following output, which Twilio then runs through text-to-speech.

```
The time is currently 4 37 pm

The temperature in West Lafayette is 83 degrees Fahrenheit.

Your phone number is 1 2 3. 4 5 6. 7 8 9 0.

```
A few notes on the formatting first. I separate the numbers of the phone number (and that is not a real number) so that it says the number with an expected cadence. If I just put `1234567890`, it'd say `one billion, two hundred twenty three million, five hundred sixty-seven thousand, eight hundred and ninety`. If I just broke it up to `123 456 7890`, it'd say `one hundred twenty three, four hundred fifty six, seven thousand eight hundred ninety`. To break up the numbers so it just says the digits, you need to put the spaces. To break it up so the area code and exchange and line numbers are distinct, you need the punctuation.

Times are weird, too. If the time is 4:37, just having the time as `4 37` works, but if the time is 4:05 and broken into `4 05` instead, it'd read it as `four five`. This is why I use `digit letter-"o" digit` for the time.

I say lots of bad things about XML and prefer to avoid it when possible, but sometimes, like here, it's just that easy to handle. Kudos to XML::LibXML and NOAA for making that part reasonable and good.

Now that I have this working, I'm curious about doing other things. I can see myself adding to this, checking to see if From is my number, and if so, opening up choices like my whole Quantified Self stuff, the home automation I want to do more of, etc. I'm not sure I like the TwiML module, and might move that over to Template Toolkit, but that remains to be seen.