Asterisk: Automatically Update externip When Your IP Address Changes

I got tired of updating Asterisk’s externip setting every time my IP address changed, so I wrote this quick script, saved as /usr/local/bin/asterisk_update_externip:

#!/bin/bash

ip_url="http://automation.whatismyip.com/n09230945.asp"

oldip=`grep externip /etc/asterisk/sip.conf |sed 's/;.*//' |grep -v ^$ |sed s/.*=\ *//`
ip=`curl -s "$ip_url" |head -n 1`

if [ "$oldip" != "$ip" ]
then
        #echo "Updating IP"
        sed -i "s/externip = $oldip/externip = $ip/" /etc/asterisk/sip.conf
        asterisk -r -x "core reload"

fi

I put it in /etc/cron.d/asterisk-externip as follows:

# Update Asterisk's SIP External IP
3,8,13,18,23,28,33,38,43,48,53,58 * * * * root asterisk_update_externip

Enjoy!

Posted in sysadmin | 1 Comment

VOIP Routing for Non-US, 10-Digit NANPA Numbers in Asterisk

I got my AT&T bill this morning with $150 in long distance charges for calls to Canada. After cursing AT&T under my breath I resolved not to let this happen again.  Knowing AT&T charges exorbitant rates for international calls ($1.39/minute to Canada? Really?) I have international calls set to route through a VOIP provider where I pay 1.39 CENTS to call Canada and the rest of the developed world.  As soon as you hit 011 on our phone system you’re automatically routed to VOIP.  The problem is, thanks to NANPA, Canadian phone numbers, and some islands in the Caribbean, look just like US numbers, 1-XXX-XXX-XXXX, but charge like you’re calling Iran.  What to do? Continue reading

Posted in Personal | Leave a comment

Nagios Plugin to Check Memory

After a search for a check_memory plugin for Nagios turned up only a Korn shell script, I quickly wrote the following in Ruby for Linux, which I hereby release into the public domain.   Why?  All my servers have Ruby, but not Korn shell.

Continue reading

Posted in sysadmin | 2 Comments

Microsoft Word Template for Window Envelopes

Here is a template for Word that will put the addresses in the right place when printed and placed in a #10 window envelope.  Here’s how to use it:

  1. Enter your return address and the recipient’s address in the boxes at the top of the page.  Be sure to keep the address within the boxes.
  2. Write your letter and print it.
  3. Fold the letter along the line on the right side of the first page.  This will make sure that the folded letter is large enough so it doesn’t slide around in the envelope and move the addresses out of the windows.

Download the template for Word 2007

Update: Letter_No10_Envelope.dot – Word 97-2003 version

Posted in Personal | 9 Comments

FaceFeeder Turns Your Facebook News Feed Into an Atom Feed

Here it is, my first Google App:  FaceFeeder.  I thought it would be nice to be able to see my Facebook news feed in Google Reader and there didn’t seem to be any way to do it, so I wrote a quick application called FaceFeeder.

FaceFeeder – Turn your Facebook news feed into an Atom feed.

Posted in Personal | Leave a comment

The Problem with eFax

Maybe I’m the last person to find this out, but just in case you’re about to go through the hassle of signing up for eFax, let me save you the trouble.  eFax is crap! Here’s why:

Faxes Forced to be Included in Emails

There’s no way to have eFax just notify you of an incoming fax.  They HAVE to send you the whole fax as an attachment.  What if you’re receiving a credit card number in a fax? Well tough luck, it’s getting sent unencrypted.

Bad Customer Service

eFax won’t help you with most customer service issues on the phone.  Instead, they expect you to use their online chat.  And the reps are very slow and unhelpful.  When you try to cancel your account, they make you go through a long survey and your account won’t be canceled until you fully answer all their questions.  And forget about getting a refund for unused service.  If your account just renewed for a year (with no notice) and you try to cancel, too bad, you’re not getting your money back.

Can’t Keep Your Number

You put your fax number on your business cards, on your website, in your email signature, maybe company letterhead, etc.   For whatever reason, maybe one the ones listed here, you decide to switch from eFax.  Get your credit card out, because you’re going to need new business cards.  eFax’s customer agreement says

YOU FURTHER UNDERSTAND AND AGREE THAT YOU ARE NOT THE OWNER OF ANY eFAX NUMBER ASSIGNED TO YOU BY j2 GLOBAL YOU ARE EXPRESSLY PROHIBITED FROM CAUSING OR ATTEMPTING TO CAUSE THE eFAX NUMBER ASSIGNED TO YOUR ACCOUNT TO BE TRANSFERRED TO ANY OTHER SERVICE PROVIDER, TELEPHONE CARRIER OR ANY OTHER PERSON OR ENTITY (ALSO SOMETIMES REFERRED TO AS “PORTING” THE TELEPHONE NUMBER). IN THE EVENT YOU ARE FOUND TO HAVE VIOLATED THIS PROHIBITION YOU AGREE TO IMMEDIATELY RETURN THE NUMBER TO j2 GLOBAL AND PAY TO j2 GLOBAL AN AMOUNT EQUAL TO $500 (OR THE EQUIVALENT IN LOCAL CURRENCY). YOU AUTHORIZE j2 GLOBAL TO CHARGE YOUR ACCOUNT CREDIT CARD OR TAKE ANY OTHER MEASURES REQUIRED TO COLLECT THIS PAYMENT.

Other than that, eFax is OK.  🙂

Posted in Personal | 5 Comments

Got my Canon Rebel T2i – and VigLink

I caved and bought the Canon Rebel T2i with a 10% off coupon from Best Buy.  And I let them talk me into getting their 4 year accidental damage warranty for another $200.  Which actually seems like a pretty decent deal.  Think they’ll cover whatever lens I have attached if it breaks?

credit: chris runoff (flickr)

So yes, this is kind of a random post, but it serves a purpose.  I’ve embedded links to Amazon, Best Buy, and B&H to test out VigLink, which is supposed to make all your links into affiliate links.  They take a 25% cut but claim they negotiate better affiliate commissions to make up for it.  Sounds like a win-win and maybe a better way for bloggers to make money, as long as they don’t start shamelessly promoting products with stealth affiliate links.

Posted in Personal | Leave a comment

Crist creates oil spill recovery task force

The South Florida Business Journal reports that Charlie Crist “has issued an executive order creating an economic recovery task force whose job will be to help Florida businesses and industries recover from losses associated with the Deepwater Horizon oil spill.”

Sounds like a big government scheme that might just as easily have come from Charlie’s best buddy Barack Obama.  Now that Governor Crist has left the Republican Party he is completely unrestrained.  Too bad he hasn’t resigned as governor to focus on his campaign.  (too much free publicity)

Read more: Crist creates oil spill recovery task force – South Florida Business Journal:

Posted in News | Leave a comment

PuTTY SSH / Windows Clipboard Integration

Getting text out of your SSH sessions can be annoying.  If it fits in a screen, I usually just select the text in PuTTY to copy it– no big deal.  Otherwise, I have to either email it to myself or put it in a file, log in with WinSCP, and download the file.  Way too much trouble.

Today I started searching for a better solution and found a patch for PuTTY by Diomidis Spinellis.  Unfortunately it was for an old version of PuTTY.  However with a little effort I updated the patch to PuTTY 0.60.

Here’s how it works:
Continue reading

Posted in sysadmin | 13 Comments

Converting iPhone 3GS Videos to play on Samsung Blu-ray Player

Wow, the iPhone 3GS takes nice videos!  I recently made a quick video of Murphy at the dog park and noticed that it looks great even full-screen on my 20″ monitor at work.  I was curious how it would look on TV, but my Samsung BD-P3600 didn’t like the .mov file the iPhone created.  Here’s how I converted it:

ffmpeg -i IMG_0270.MOV -vcodec libxvid -aspect 4:3 -b 4000k -ab 128k mdog.avi

You will need ffmpeg for Windows.  I used FFmpeg svn rev 19159

By the way, here’s the video:

Posted in Personal | Leave a comment