I don’t know what it should be called…but anyway, I put up a page where I can try to organize my allegedly spiffy idea . After my little “Proof of concept” experiment with audio geomicroblogging during the holidays, I’ve decided that the concept is indeed at least fun to play with. Since I’m still too poor to buy myself any really expensive toys or take a long luxury vacation, I figure I can amuse myself by trying to turn my experiment into a “real” system that someone might actually want to use. I’ve posted my current idea and plans for the first release at the link up there. I figure getting to the first basic implementation will take a few days to a few weeks, mainly depending on whether anyone but me likes the idea (if it seems interesting to anyone else, there’s a lot more reason to focus on getting it done than if it’s just a crazy idea that everyone else hates…)
Phone-in Geolocation: almost working…
It’s a hasty and rather brittle thing, but I seem to have the asterisk side of the equation functioning at a minimal level, including recording audio to go with the latitude and longitude that I dial in when I call. Aside from the beautification and cleanup to make it more intuitive, all I need to do is test the “convert the recording to mp3” call and whip up a quick frontend to display the data. Then all of you loyal fans (and/or secret conspirators) can follow along on my long but hasty journey complete with audio. Aren’t you lucky? (Don’t answer that…) If my schedule works out well enough, I may even be able to do a travelogue update from New Belgium Brewing Company along the way.
The basic process is that I whip out my trusty cellphone, call home, and dial the appropriate extension. I then key in my latitude and longitude, and then record up to a five minute bit of audio to go with it. The script then sticks the latitude, longitude, and timestamp (local to the server) at the end of a comma-separated text file and will then invoke a background process of LAME to convert the file to mp3 for online listening. I’m probably only going to have time for a really simple web interface for the moment since I’ve got to hit the road by lunchtime tomorrow after some work in the morning, but once I’m back from this trip I’ll hopefully have a chance to spiff it up.
UPDATE 20081223:If you’re bored, and you watch http://omniblab.dogphilosophy.net/where you MIGHT see an update or to show up during the day, assuming everything works. Unfortunately I won’t actually know if it worked until tonight when I stop for the evening and get online to check it out…
ANOTHER UPDATE 20081223 (late): Now that I’ve stopped for the evening, I’ve fixed the stupid last-minute typo that was keeping the page from working. The audio isn’t automatically being converted to mp3, so until I get time to figure that out the audio parts of the updates won’t show up until I have time to log in and start the conversion by hand. Hopefully be able to fix that (and spiff up the display page) in a day or two.
Any questions, comments, or suggestions (or requests)?
Geotagging through Asterisk?
Between telemarketers annoying me into getting my upgrade to Asterisk 1.6 finished and the hasty long-overdue road-trip back to and from Idaho again, I’m reminded of an idea that has been fluttering around in the back of my head, not unlike a small bat in the top of a bell tower.
My vast hordes of cult-like fans always seem to want to know where I am. This is obviously an issue in a case where I’m going to be driving 1600 miles, then turning around and driving back, over the span of 4-6 days. It would be pretty easy to set up something on a web page somewhere with some kind of map. The real problem is – how do I update the map?
In some places, I could stop for a while, haul out Igor, boot up, find a public wireless network connection to the internet, and do the update that way. However, that’s time-consuming and awkward, and I want to get this trip successfully completed as quickly as I can. Plus, it’s not always easy to find public network access points, especially through the barren, windy, snowdrift-covered wastelands of Southern Wyoming where a chunk of my route will take me. I have a hypothetical solution, however…
Asterisk® is our Friend
I suppose this is slightly off the usual topics for this blog, but what the heck.
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