I’m constantly struggling with keeping my network tool bag organized. It’s great after I organize it, but one job needs to be done and it’s completely disorganized again.

I have a ton of tools, carry everything I need to install network cabling, turn up T1 lines, troubleshoot analog lines, I can even do basic electrical work with what’s in my bag. It’s exploding with stuff, since I carry everything I could possibly need.

So I’ve been looking into a new bag.

The one I’m probably going to settle on is: Custom LeatherCraft 1539 18 Multi-Compartment Tool Carrier. It looks like it’ll do the trick. My current bag is a “bucketmouth” type bag, so there’s not really much organization, it’s so full of stuff I can’t zip it, so maybe this one will be great!

So Level3 uses the E.164 recommendation for sending caller information. The problem with this is that they send a + prefix to the phone number. The problem with sending the + in the caller number, is that a common desk phone (Polycom/Cisco/Yealink/Aastra) will try to make an IP call to the number, or just fail. It seems like only cell phones handle the + character in a number.

So to keep that plus out of the network, I added the following code to my kamailio.cfg to “filter” out the + before sending to the caller.


$avp(s:from)=$fu;
$avp(s:from) = $(fu{re.subst,/\+1//g});
  if ($(avp(s:from){s.len}) == 0) { $avp(s:from)  = $fu; }
uac_replace_from("$avp(s:from)");

Maybe there is a better way, but this is working in production. Let me know if anyone has a better method!

Sometimes the Cisco OIP program can be a pain in the ass!

Another partner registers the deal. You are awarded the business, taking less margin than the behemoth vendor in town, to get the deal. Now you’d like to increase your margins and you aren’t able to get the best pricing because behemoth vendor has protected pricing.

Kinda makes for an unfair advantage, and prohibits Cisco’s other partners from growing their business. Keeping the big guy in town big and the small guys small.

My suggestion, OIP Rebate program. When the deal is registered by someone else, but I am awarded the business. I should get that OIP discount as a rebate check.

Come on Cisco! Help your partners grow!

I had a need to build an array of months between a set month and the current month. My purpose was to let the user choose a month to build a report for.

I’m using HTML::Mason, but you get the idea.

You’ll need Date::Manip::Recur


<select name="months" id="months">
% # Loop through the date objects
% for (@dates) {
%   # Assign the current month value to a scalar.
%   my $curMonth = $_->value();
%   # I only cared to see YYYYMM so I regex'd it.
%   $curMonth =~ s/^(\d{4})(\d{2}).*$/$1$2/;
      <option value="<% $curMonth %>"><% parseMonth($curMonth) %></option>
% }
</select>

<%init>
# Returns a date like "2011-01-01"
my $monStart = getOldestEntry($account);

use Date::Manip::Recur;
  my $recur = new Date::Manip::Recur;
  # Parse out the first of the month for every month since start until today.
  my $err = $recur->parse('0:0*0:0:0:0:0',$monStart,$monStart,"Today");
  # Return an array object of dates
  my @dates = $recur->dates();

sub parseMonth {
use Time::Local;
use Date::Format;
  my $md = shift;

  # Match on YYYYMM
  $date =~ m/^(\d{4})(\d{2})/;
  my $year = $1; my $mon = $2;

  # Convert to epoch
  my $time = timelocal(0,0,0,1,$mon-1,$year);

# Return back (%B %Y) as "August 2010"
return(time2str("%B %Y", $time));
}
</%init>

My 4-Stroke Ryobi S430 Weed Trimmer has been great, I’ve not had problems like others have had with their, except it leaks gas on my right arm my from the fuel cap breather while I’m weed eating.

I haven’t hung it up in my garage because when I do, it constantly drips fuel out. I’m about to see if I can find a non-vented cap for storage, so I can hang it up without leaking. I know it needs the breather to run. I kinda wish I spent more money for a better built unit.

Any ideas?

I needed to quickly generate a full directory for a receptionist console. Since Trixbox doesn’t do this, I wrote some Perl to do so. It’s pretty simple, you will need to install Polycom::Contact::Directory from CPAN. It will connect to the localhost MySQL server and pull all extensions out, make an xml and save it to the appropriate path. You will need to supply the MAC address, I guess I could modify a bit to pull the MAC out of the Endpoint Manager table, but I like being able to just supply the MAC.

Thanks Zachary Blair for the easy module!


#!/usr/bin/perl -w
# Quick script to hack out a directory for a mac address. I use it for the
# receptionist's BLF on her IP650 with sidecars.
use strict;
use Polycom::Contact::Directory;
use DBI;

# Grab the MAC address from ARGV and make a file
my $mac = $ARGV[0] or die "No MAC Specified\n";
my $contactFile = "/tftpboot/polycom/contacts/$mac-directory.xml";

# Create a new Empty Directory
my $dir = Polycom::Contact::Directory->new();
# Connect to the trixbox MySQL DB
my $dbh = DBI->connect('dbi:mysql:asterisk:localhost:3306','root','passw0rd',{ RaiseError => 1});

# Pull an array ref for the extensions
my $userAry = $dbh->selectall_arrayref("SELECT extension,name FROM users ORDER BY extension");

$dbh->disconnect();

# Set counter for speed dial index
my $x = 1;

# Loop through extensions
for my $a (@$userAry) {
# Split the trixbox name into first and last.
my ($fn,$ln) = split(/\s+/,$a->[1],2);

# My contacts are generally dirty, I'll make them look better. Some people may want
# to comment this out if you have people with unique capitalization.
$fn = ucfirst(lc($fn));
$ln = ucfirst(lc($ln));

# Insert the record into the object.
# I like the labels to be: extension firstname lastname "3721 Awesome Dude"
#  -- buddy_watching lets the polycom monitor BLF status. For this to work,
#     you must have feature.1.name="presence" feature.1.enabled="1" in
#     /tftpboot/sip.cfg
#  -- Check Polycom::Contact Documentation for Options
$dir->insert(
{   first_name => $fn,                  # <fn> in xml
last_name  => $ln,                  # <ln> in xml
contact    => "$a->[0]",            # <ct> in xml
label      => "$a->[0] $fn $ln",    # <lb> in xml
buddy_watching => 1,                # <bw> in xml
speed_index => $x,                  # <sd> in xml
buddy_block => 0,                   # <bb> in xml
auto_divert => 0,                   # <ad> in xml
auto_reject => 0,                   # <ar> in xml

},
);
$x++;
}

# Save the contact file.
$dir->save($contactFile);

1;