This post originated from an RSS feed registered with Python Buzz
by Aaron Brady.
Original Post: Phoney: An Address Book for Asterisk Caller ID
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
For work today I took a long-standing card to hook up our internal Asterisk
phone system with some form of Caller ID database. You can make Asterisk use
MySQL or fork a Python process using AGI, but I didn’t want any
of this to be “in-band”.
In the past I’ve used simple Flask services to provide simplified JSON APIs so
I can encapsulate logic in a language that I prefer, and not the scripting or
configuration language I’m stuck using (like collectd’s or Asterisk’s).
The software will receive a POST from Asterisk with the source and destination
number, and that POST is expected to return a name to display on the Caller ID
as the only body. It also has a very simple Bootstrap GUI for updating the
numbers, which shows incoming calls to the office, newest first:
The little bit of Asterisk scripting required is just this:
That part after the last comma is verbatim posted as the contents of the
request, the from= is required to make it kind-of URL encoded.
None of this really stands up to security scrutiny on the WAN, so it’s all best
kept on internal networks, but for a small network or a house, it should work
pretty well.