Prefix Area Code With SER

I'm setting up a SER server for routing SIP calls to a PSTN gateway. Calls to the PSTN should always be 10 digits, just to remove any confusion, but I want to allow people to dial just 7 digits. I needed a way to look at the caller's phone number and prefix their destination number with their own area code. Hans fought this issue previously and couldn't get it to work just with SER, but instead had to exec a script. Not ideal, but it'll work. He didn't have the script at hand so I wrote my own in Perl.

First, the SER config snippet:

if (uri =~ "^sip:[0-9]{7}@") {

And the script:


use strict;
my $DEFAULT_AREA_CODE = '307';
my $to = $ARGV[0];
my $from = $ENV{SIP_HF_FROM};

# if it's not a 7 digit number
&output($to) if ($to !~ m/sip:\d{7}@/);

# if no from header. weird, but whatever.
&output($to) if (!$from);

# find area code addr
$from =~ m/<sip:(\d{3})\d{7}\@/;
my $area = $1;

# no area code? just assume one
$area = $DEFAULT_AREA_CODE if (!$area);

$to =~ s/sip:/sip:$area/;

sub output
   my $result = shift;
   print $result;
   exit 0;


Taste Test: Chocolate Sauce

Due to a slight mixup, we received a bottle of Hershey's Special Dark chocolate sauce. A week ago I had also made a bottle of Alton Brown's cocoa syrup, so I had a perfect chance to compare them. Incidentally, the dutch cocoa I used was also Hershey's.

I tasted them straight up, in spoons, at room temperature. I poured them out and handed them to my wife without telling her which was which. She gave them to me in random order. It wasn't hard to pick out which was mine though. It was the one with little gritty chocolate pieces. Whoops. I don't remember those being in there last week. Maybe I just couldn't taste it on the cheese cake. Or maybe they form while sitting in the fridge. I filtered it through a sieve, but maybe I need a finer mesh.

As far as the taste, the Hershey's tasted much sweeter. It was also less viscous, from the corn syrup no doubt. I think I preferred my own syrup as it had a much richer taste. For a Special Dark, I really expected more dark flavor. I wonder what the regular syrup is like.


Careful, Careful

Yesterday I was looking around in the cupboard to see how much of my sun-dried tomatoes were left. Off to the side I noticed another bottle of oil and popped it open. Turns out it was a garlic infused olive oil I made who knows how long ago. I gave a whiff and it was a little funky, so I wondered to myself how long an oil like that would last.

Well, later in the day I happened to browse to the garlic entry at Wikipedia. Apparently fresh garlic oil only lasts about a week and that's in the fridge. Mine had been sitting in at room temperature for a good six months. I was a prime candidate for dying of botulism. The thought of it scares me a little, honestly. Commercial oils use salt and acid to eliminate the risk. I tried to find instruction for how, but came up empty.

I guess in the future, I'll stick to fresh herb oil.


DRM, Apple, Macrovision

Steve Jobs' essay on DRM has stirred up quite the hornet's nest of controversy. That's a good thing really. Far too many decisions about DRM are made in smoke-filled back rooms by corporate executives.

Why would the big four music companies agree to let Apple and others distribute their music without using DRM systems to protect it? The simplest answer is because DRMs haven’t worked, and may never work, to halt music piracy.

He's absolutely right. If you know even the littlest bit about cryptography and if you think about it for just a few minutes, it's obvious that DRM is broken from the get go. You can't give somebody the secret and the key and expect the secret to stay that way for long. It's a no-brainer.

That's not what I'm here to critique. Seems that Fred "I'm high on crack" Amoroso, CEO of Macrovision, posted a response to Steve Jobs. You may remember Macrovision as the screwball way to prevent copying of VHS tapes. It works by changing one of the timing tracks such that other VCRs get confused, but TVs don't. It's actually quite easy to fix with a $30 signal cleaner.

Macrovision has a vested interest in DRM systems. That's their business. So it's no surprise they came out swinging at a call for DRM to be axed from the planet. Let's address his four main points:

DRM is broader than just music
While your thoughts are seemingly directed solely to the music industry, the fact is that DRM also has a broad impact across many different forms of content and across many media devices. Therefore, the discussion should not be limited to just music. It is critical that as all forms of content move from physical to electronic there is an opportunity for DRM to be an important enabler across all content, including movies, games and software, as well as music.

Digital media, no matter what it is, will benefit from unimpeded access. Could the TiVo have been created if the broadcast flag had been implemented? Would id Software have become the video game powerhouse it is if Barney Doom hadn't been created? Would Microsoft Office ever have been used if it hadn't been so easy to copy? DRM systems limit what can be done to only whatever the original creator thought of. Ain't nobody smart enough to think of every possible way to use something. Does it always work out well? Of course not. But that doesn't mean that DRM systems would guarantee success either.

DRM increases not decreases consumer value
I believe that most piracy occurs because the technology available today has not yet been widely deployed to make DRM-protected legitimate content as easily accessible and convenient as unprotected illegitimate content is to consumers. The solution is to accelerate the deployment of convenient DRM-protected distribution channels—not to abandon them. Without a reasonable, consistent and transparent DRM we will only delay consumers in receiving premium content in the home, in the way they want it. For example, DRM is uniquely suitable for metering usage rights, so that consumers who don't want to own content, such as a movie, can "rent" it. Similarly, consumers who want to consume content on only a single device can pay less than those who want to use it across all of their entertainment areas – vacation homes, cars, different devices and remotely. Abandoning DRM now will unnecessarily doom all consumers to a "one size fits all" situation that will increase costs for many of them.

DRM increases consumer value?!? Hang on, I need to wipe the milk off my screen. That's a riot. Consumers don't care about jumping through hoops. They don't want to be bothered with the fact that they can't hook their DVD player into their VCR because of the Macrovision encoding (been there). They want to be able to make copies of movies to take on their iPod or to let the kids put their peanut buttery fingers all over (done that). Just make it work and I will buy your content. That's really what it boils down to. Every thing a company does to make it harder to acquire content makes me that much more likely to turn to illegal distribution means. How is that a win for anybody?

DRM will increase electronic distribution
Well maintained and reasonably implemented DRM will increase the electronic distribution of content, not decrease it. In this sense, DRM is an important ingredient in the overall success of the emerging digital world and especially cannot be overlooked for content creators and owners in the video industry. Quite simply, if the owners of high-value video entertainment are asked to enter, or stay in a digital world that is free of DRM, without protection for their content, then there will be no reason for them to enter, or to stay if they've already entered. The risk will be too great.

The perceived risk will be too great for some. But what they really fear isn't that people will copy their content. That's a given whether there is DRM or not. What they are scared of is that somebody will out-think them. That they won't be able to keep up with the competition. Well, sorry buddy. Lead, follow or get out of the way. What will truly increase electronic distribution is giving content creators the ability to directly distribute their own content. That revolution has already come and it's not going to stop. For the vast majority of these artists, the real danger is obscurity. DRM only assures them of that.

DRM needs to be interoperable and open
I agree with you that there are difficult challenges associated with maintaining the controls of an interoperable DRM system, but it should not stop the industry from pursuing it as a goal. Truly interoperable DRM will hasten the shift to the electronic distribution of content and make it easier for consumers to manage and share content in the home – and it will enable it in an open environment where their content is portable across a number of devices, not held hostage to just one company's products. DRM supporting open environments will benefit consumer electronics manufacturers by encouraging and enabling them to create ever more innovative and sophisticated devices for consumers that play late running premium content from a number of sources.

So let me follow the logic through here to the next step. If an excessively restrictive DRM scheme is harmful, and a more interoperable system is better, doesn't it follow that a completely open system would be the best? It seems obvious to me. And doesn't it defy logic that a system built around keeping secrets could actually be "open"? The more open it becomes, the less DRM can be applied. You can't have your cake and eat it too.

Over the last few years I have seen the winds of change begin to shift in opposition to DRM. I expect that within 5 years we will see the effective disappearance of DRM, replaced with open content formats. And the world will be better for it. Until then, you can count me out of any DRM scheme which is not already broken. But wait, isn't that all of them?


Taste Test: Canned Tuna

I've always wondered the difference between tuna packed in oil and that packed in water. Actually I was in Twin Falls and I saw an episode of Ham on the Street where he promised to explain the difference. I unfortunately got a phone call or something before I got the answer. Well, I just had to find out for myself.

I purchased two cans of our normal brand, whatever the cheap Walmart brand is. Incidentally, we really dislike the Starkist tuna because it tastes way too fishy. I wouldn't be surprised if there isn't really any fish in the Walmart brand. Well, whatever.

The first thing I noticed is that the oil-packed tuna is really oily. Duh! Even after draining, it was just greasy. It had 6 grams of fat per serving verses only 1 gram in the water-packed. I suppose that's to be expected.

My aunt showed me a delicious way to mix tuna with mayo, celery and onion. She eats it on fresh baguettes. I love it. So that's what we did with it. I found that the oil-packed tuna didn't need as much mayo to get the same creamy texture. I debated about keeping the mayo amount the same or matching the texture. I ended up trying it both ways and really couldn't tell much difference, except in the appearance. An extra tablespoon of mayo is 11 grams of fat, so there goes all the savings of the water-packed tuna.

In the end, even with a blind test, neither my wife nor I could tell the difference. I could see the difference, but in my mouth they were the same. I think I'll stick with the water packed just because the oily tuna creeps me out, likely due to flashbacks of horrible food my college roommate used to make.


Storing Mushrooms

Mushrooms are great, whether shiitake, crimini, or even your run-of-the-mill button mushrooms. Our shrooms come in a little shrink wrapped container that is quite moisture resistant. That means that if you leave the little cuties in there for more than a week or so, they start to get soggy and nasty. That's just not acceptable.

A while back I heard a recommendation from a mushroom farmer on Good Food who said you should store them in a paper sack. Since the paper passes moisture, the mushrooms will dry out. And that's a good thing. The mushrooms will basically last forever (yeah, like you won't eat them before they go rotten). But just in case I always write the date on the bag, if for no other reason than to know how long my mushrooms have aged.

One thing I discovered is that it's a Bad Idea(tm) to wash the mushrooms before storing them. I tried it once thinking that the little amount of moisture the washing adds would just dry up. It doesn't. They turn into a squishy mess. The problem is that washing shriveled up mushrooms is a little difficult. So use the classic French method and dust them off with a brush.


Sync To Mp3 Player

My friend Hans posted on using rsync with his mp3 player. He came up with pretty much the same thing I did, so I figured not only was it about time to post to my blog again, but I should put up my script which works great for me.


RSYNC="rsync -vae ssh --delete --delete-excluded --modify-window=1"

case "$1" in
   ${RSYNC} --exclude-from "${MP3}/${NO}" "${MP3}/" "${USB}/"
   ${RSYNC} --exclude-from "${MP3}/${MAYBE}" "${MP3}/" "${USB}/"
   ${RSYNC} "${MP3}/" "${USB}/"


I stole the "--modify-window=1" bit from Hans, but the rest I wrote. The reason for the "no" and "maybe" files is that I listen to Coverville which is way too big to fit on my 256MB flash drive. So I only listen to that on my computer and export everything else. I also use it for a video podcast from Ming Tsai and whenever I get really far behind on a podcast.


Stuffed Tomatoes

Back in October Joseph started a fun game he titled "Weekend Challenge". It's a kind of theoretical Iron Chef, if you will. In the second episode, I entered a recipe for stuffed tomatoes and let me tell you, they sounded good. Really good. Ever since then I've wanted to actually try it out and see if it turned out as well as I hoped. Tonight I finally had a chance to test it out. Keep in mind that the following recipe is what I did make, but not necessarily what it will become. Stay tuned for a more thorough treatment.

Cream Cheese Stuffed Tomatoes

  • 4 large slicing tomotoes
  • 6 ounces cream cheese, softened
  • 1 cup shredded mozzarella cheese
  • 4 ounces ground sausage
  • 3 slices bacon, cooked and crumbled
  • basil
  • parmesan cheese
  • 1/4 cup finely diced onion
  • 1/4 cup finely diced green pepper
  • 2 cloves garlic, finely diced or pressed

Remove the top from each of the tomatoes. Remove the guts. Place in a non-reactive pan and roast at 350 degrees for 10 minutes.

Meanwhile, brown and drain the sausage. Saute the onion, pepper and garlic in a little of the sausage fat, if desired. Remove from heat. Add the cream cheese and mozzarella cheese and mix well. Season with basil and possibly salt to taste.

Spoon the cheese mixture into the tomato bowls. Top with generous portions of bacon bits and parmesan cheese. Return the tomatoes to the oven and cook 5 more minutes. Then crank up the broiler to put a little brown on the cheese.


  1. The taste was quite good. I enjoyed it immensely. I mean, how can you go wrong with sausage, bacon and cream cheese? I'm salivating just thinking back on it.
  2. I got the tomatoes roasted just about right. They should be soft but with not mushy. The crunch of the bacon and crispy parmesan contrasted nicely with the soft cheese and tomatoes.
  3. The tomatoes paired well with a sun-dried tomato bread, which I also made.

And now the bad.

  1. The sausage was barely noticeable. The quantity should have been at least double.
  2. The cheese was delicious but maybe too soft. My wife's stuffed pepper recipe uses rice for this purpose. I think rice doesn't fit quite right for this one. She suggested bread crumbs. I'm thinking of toasting them.
  3. I didn't remove enough of the tomatoes, especially along the bottom. Alton Brown recommends using a grapefruit spoon and that seems to be a pretty good idea.


Hibernate Ubuntu Edgy

I took the plunge yesterday and upgraded my laptop from Kubuntu Dapper to Edgy. For the most part I like it. Evolution is snappier, Firefox 2 is awesome, Amarok 1.4.3 works almost perfectly with my mp3 player. One thing I lost though, was the ability to hibernate my laptop. I did gain back the capability to suspend, which I'm sure I'll use because it's a lot quicker. But when I leave work at the end of the night I prefer to hibernate because who knows how long the system might sit in my bag.

But I got it working. Here's what I did. Now understand that this is just based on a few things I pulled together so that it Just Works(tm), but it may not be the Right Way(tm).


I've been working on a Unified Theory of Bacon lately. I have come to realize that anything tastes better with bacon. That's not to say that bacon can make a spew-a-licious carrot salad (you know the one with shredded carrot, mayo and raisins) into an edible side dish, but it wouldn't taste nearly so vile.

To put it simply, I love bacon. I was therefore delighted when I saw a tip on America's Test Kitchen about how to store bacon for easy use. We normally buy an extra package of bacon, cut it in half and freeze each of those. What if you just need a couple slices of bacon, say for some bacon mashed potatoes (which I'm making right at this very moment)? Instead of freezing the whole slab, take each piece and roll it up like it was a cinnamon bun. Toss them into a bag and stick them in the freezer. It's then a cinch to take out exactly how many you need (do plan 20 minutes ahead so they can thaw). It does take a little time to roll up an entire package of bacon, but really not too bad. Certainly no more than it does to split a 5 pound pile of hamburger into half pound portions.



Subscribe to RSS Subscribe to - All comments