Transitioning from 7 to 10 digits

We use cisco phones and Cisco Unified Communications Manager for our VoIP calls. We opted to go with Asterisk for voicemail, and we manage that with FreePBX. Initially, we assigned 7 digit numbers, but have decided going forward that we’ll use 10 digits (and have been for a while). New installs are assigned a 10 digit number on their Cisco phone and a 10 digit number on their voicemail and things work as expected. Moving our phones to 10 digits is a pretty straight-forward process, but transitioning existing voicemail boxes to 10 digits is proving more challenging.

Is it as easy as a bulk admin job w/ the new numbers to be changed and a clever bash script to move/rename directories w/ the area code prepended?

Renumbering the extensions can be done with a bulk export/import of the extensions.

For moving the existing mail to the newly created mailboxes, you can either change the mailbox number in the bulk script (messy and difficult to maintain) or as you pointed out have a clever person write a script (I would not limit them to Bash) to move the directories.

Dicko will probably try and be clever and send you a single line convoluted script that you can decipher. He likes to write one line solutions and present them like a puzzle book (of course some fools just copy, paste and pray).

OK. I’ll try, assuming that both the old 7digit and the new 10digit extensions all currently exist, then

ADDAC=213;for f in $(grep -r "^[0-9]\{7\} " /etc/asterisk/voicemail.conf|awk '{print $1}');do echo "sed -i '/^${ADDAC}${f}/d' /etc/asterisk/voicemail.conf";echo "sed -i \"s/^\\(${f}.*$\\)/${ADDAC}\\1/\" /etc/asterisk/voicemail.conf";echo "mv -f /var/spool/asterisk/voicemail/default/$f /var/spool/asterisk/voicemail/default/${ADDAC}$f ";echo "mv -f   /var/spool/asterisk/voicemail/device/$f /var/spool/asterisk/voicemail/device/${ADDAC}$f ";done >

The see if that looks good


and if you like it then


If you don’t mind praying or are foolish, then leave out the echo thingies bits and don’t run it into a puzzle book .