Caller ID processing
I am inspired by Signal 2017 to try out more of Twilio features and services.
This page describes the first idea I had -- when the weather turned hot here I got the idea for the twilio-weatherman app which I implemented and published on github.
Note from here on when I say "messages" here, I mean both SMS text and voice calls.
- A message comes in to Twilio on my number; could be either SMS or voice.
- Send it to one of the many Twilio Caller ID plugins.
- Find out where it's coming from (as much detail as is available in results of the plugin lookup.)
- Use a webhook to send the lookup results to my server Bellman.
- Geocode the location.
- Put it onto a map on a laptop that hangs on my kitchen wall (aka the walltop).
- Voice and SMS messages will be forwarded to Bellman and to phone(s).
- Text of an SMS will be displayed on the walltop.
When a voice call needs to be sent to Bellman, it's done with Twilio Elastic SIP Trunk and processed by Bellman's Asterisk server. Asterisk takes on the task of ringing handsets and perhaps recording voicemail.
I wanted to switch from Asterisk to OpenVBX but that turned out to be pretty much a non-starter. Asterisk was already running here and OpenVBX seems like a weak alternative.
What else? Maybe conferencing? I don't need a call center here so Task Router is not interesting to me.
Grandstream phones do a nice job at video but I have no idea how that fits in here today. Maybe after Signal 2018.
I am thinking I should try to use Twilio Functions for some of this to reduce dependencies on Bellman.
That's about 5 or 8 projects right there. Let's start.
This is what happens right now today. I need to write this down since I don't think I've documented it anywhere.
SMS - Under Phone Numbers, click on the main number, and see Messaging "When A Message Comes In" is directed to some TwiML.
To find the TwiML, look in Developer section under Runtime then click on "TwiML Bins".
Sometimes I add code in Asterisk when I want calls to forward to my cellphone, so a call comes in on Twilio and then rings both my home phones and cellphone. Currently it just rings my home phones.
In Geo-CEG's account the active bin is called "Forward calls to all Geo-CEG staff" but it currently just rings my phone. It's just this:
<?xml version="1.0" encoding="UTF-8"?> <Response> <Dial> <Number> +1707827xxxx </Number> </Dial> </Response>
where xxxx is the last 4 digits of my Twilio SIP Trunk number.
After creating a TwiML bin you can select it under "Numbers"; set "A Call Comes In" to "TwiML" and then pick the named bin.
There is another bin under Messaging "A New Message Comes In" called "SMS Forwarding". That bin contains
<?xml version="1.0" encoding="UTF-8"?> <Response> <Message to="+1707827xxxx">Template:From: Template:Body</Message> </Response>
where xxxx is the last four of my cellphone. I have the same thing in my personal account.