Asterisk® is our Friend

I suppose this is slightly off the usual topics for this blog, but what the heck.

Asterisk logo Asterisk® software is an open-source system for computer telephone stuff. Yes, I did just say “telephone stuff” instead of “PBX, VoIP, and Telephony”. Cope. Anyway, it’s an entirely legally-free (aside from the cost of a computer and any desired additional equipment) replacement for the kinds of many-thousands-of-dollars proprietary software systems that your cable TV and telephone companies use to prevent you from talking to human beings on the phone (so they can fire most of them, and outsource the rest to India or the Philipines or Florida or China or whatever other “developing” area has cheap low-grade labor). In other words, they seem to use their telephony system mainly for telephony prevention. The fact that “The Man™” uses the power of a PBX for evil in this way shouldn’t trick you into thinking that having your own is a bad thing, though. For example, my Minister of Domestic Affairs was recently in Australia for work. Since calls back to the US on the cellphone cost $1.50/minute, I set up a voice-over-IP client on her computer before she left. She could then use her computer’s internet connection to connect to the Asterisk box at no extra cost. The Asterisk box could then forward her Voice-Over-IP call out our residential phone line to my cellphone – a local call for the Asterisk box. No $1.50/minute for “The Man™”! Take that, The Man!

(Oh, “PBX”? That’s Private Branch eXchange. It’s a fancy way of saying it’s your own personal robotic Ernestine the Operator for your house or office.)

I discovered Asterisk a few years ago and have been puttering with it off and on. I figured if I wanted to learn how to use it, it’d be a good, simple start to replace my answering machine with it. It was a little trickier than I thought. I got my hands on a working “X100P“-type card, which is really just a specific variety of cheap voice-modem that was used originally for early development of Asterisk prior to the fancier hardware being developed. This connects my Asterisk box to the phone line. Like my old answering machine, it shares the line with an ordinary telephone that it doesn’t control.

Googling turned up all kinds of information on getting Asterisk to answer the phone and do all kinds of amazing tricks, but not a lot about controlling the answering in the first place. I wanted it to act like my old answering machine. It wasn’t answering the phone and taking messages that was hard to figure out, it was getting it to not answer the phone if someone in the house beat Asterisk to it.

I couldn’t find any references to this anywhere online at the time (and still can’t, actually, though they may be out there). Asterisk doesn’t seem to have any way – at least not with the X100P – to explicitly detect when another device picks up the shared line, but I came up with a workaround.

Now, when the lines starts ringing, I have Asterisk wait 11 seconds (which works out to about 3 rings) before doing anything. Then, I have it explicitly check for one more second to see if the line is still ringing. If not, the assumption is that someone picked up the phone and Asterisk leaves it alone. If it DOES detect one more ring, it picks and and carries on with whatever incoming-call magic I feel like programming into it – like detecting and saving incoming faxes. A copy of the relevant portion of my dialplan for any other Asterisk users out there who care may be found at the end of the post.

Once the house-hunting frenzy I’m in the middle of dies down, I’d like to start adding some nerdier features. For example, we’re moving to Southeast Texas, where there are occasional tornado warnings. Apparently, the National Weather Service’s warnings online contain embedded geographic information defining the boundaries of the warning area. I could have Asterisk watch the warnings page, and call my cellphone to tell me if I have to worry about tornadoes or not. (Kind of silly, I know…). It’d also be nice to finally test the fax reception that hypothetically is set up to work on my Asterisk box, too. (Dang crippled Motorola cellphones won’t let me fax despite supposedly supporting Class 1 fax mode, among other missing features…But that’s another post for another time.)

And now, the dialplan (or fragment thereof) (Update 20080523, fixed missing “]” after “[incoming”):

[incoming]
;give time to allow for someone to pick up 'regular' phone before asterisk does
exten => s,1,Wait(11)
;pause to check for one last ring, just in case someone picks up at the last second
exten => s,n,WaitForRing(1)
;So, you get 11 seconds - about 3 rings - to answer the phone.
;after that, Asterisk waits one more second for another ring.
;obviously if someone has picked up the phone before then,
;that last ring will never come and Asterisk will leave the call alone.
;otherwise, answer the phone:
exten => s,n,Answer()
;supposedly this will correctly jump to the fax extension if it's an incoming fax

;give announcement that ain't nobody here..
;(after waiting 3 seconds in case of fax tone detection)
exten => s,n,Wait(3)
exten => s,n,Background(nobody-but-chickens)
;...then go to 'leave a message' like a normal (if extremely powerful) answering machine
exten => s,n,Voicemail(9000)
exten => s,99,Hangup()
;end of line for now

Any questions?…

I Hate You, Carl Zimmer!

Carl Zimmer wrote a book. Of course, that’s no reason to hate him, and I don’t hate him for that.

His book is all about Escherichia coli (“E.coli”). The friggin’ “Microsoft” of the biotech world. Accursed E. coli, hogging up all the print space and protocol development and sucking up electricity for -80°F freezers. I mean, come on people! You could be doing transformation of B. subtilis and related organisms instead, which form nice, sturdy endospores which you can dry out and keep in an any cool, dry place, no -80°F freezer needed! Or you could use something like Agrobacterium tumefaciens, and as a bonus be able to then transfer your nice transformed genes into plants, too! But NOOOOOooo….it’s always “E.coli, E.coli, E.coli.” DAMN YOU, E.COLI!

Of course, none of that is Carl Zimmer’s fault, either, so this is also no reason to hate him.

Now, if his book was lousy, that MIGHT be a reason to hate him, but as far as I can tell there’s no reason to think the book is lousy, so this is no reason to hate him either. In fact, that’s kind of the problem.

No, the reason I Hate Carl Zimmer is that he’s written a book about friggin’, stage-hogging E.coli…and I want it. (Well, a copy of it anyway.) It sounds like a very interesting book. I feel like a Republican who wants a copy of “The Audacity of Hope”. Or a Democrat who wants to plan a vacation to visit the George W. Bush Presidential Library. The cognitive dissonance torments me, and it’s all Carl Zimmer’s fault! CURSE YOU CARL ZIMMER!

Okay, got that out of my system. A review might follow eventually if I manage to get a copy of the book. Meanwhile, for a change of pace, anybody want to hear about my Asterisk setup? Or should I just get back to the fermentation stuff?

P.S. Here’s a bit of trivia for you: “Frig” is apparently an old-English word meaning “to wiggle”…

WANT: “Teamaker” hops

Just a brief “aw, crap, has it really been over two weeks since my last post?” post, really, but I thought this was interesting.

It would seem that there’s a variety of hops that’s been registered recently known as the “Teamaker” variety. It’s got all the magic bacteria-stopping power of a hops plant, but composed of almost entirely the non-bitter component. I’m not sure how hard it would be for me to get them to send me a plant or two to evaluate it’s usefulness for yeast cultivation (as an anti-firmicutes antibiotic) and for controlling the growth of bacteria in fermented foods and drinks…

House-hunting (“Yep, these are house droppings all right. Fresh ones too…” [everybody’s seen that Monty Python bit, right?]) in southeast Texas and the related travel (both in the area here and between here and the other abode in southeastern Idaho) is eating my life at the moment, but I’ll try not to neglect the blog so much.

More to follow.