Extension Import Tool

Click here for the code.

Click here for a sample import.

Click here to download the application.


The Extension Import Tool, or extimport is a command line program for bulk importing user extensions into a PBX from a properly formatted CSV file. The program takes a single argument: the CSV file to be imported, and ignores all other arguments passed to it. The program will verify that the specified file exists and will exit with an error status if does not. Attempting to use the program with no arguments will simply display usage information and the program will exit normally.

An example use of the program is:

extimport example.csv

It is imperitive that the CSV file specified when running the program is formatted in such a way that the program can use it. The required format uses twelve columns: Type, Extension, Description, Caller ID Number, Enable Voicemail, Voicemail Password, Voicemail Email, SIP Secret, Enable Follow Me, Follow Me Number, Emergency Caller ID Number, and Follow Me Ring Time. The file should have one row per extension to be imported. Information in columns beyond the twelfth will be ignored by the program. Several of the fields will accept blank values, the specifics of which will be outlined below.

An example CSV file might be:

sip,100,Joe,18285555555,1,100,joe@joe.com,password,1,,,20
virtual,200,Jim,18287777777,1,200,,,1,18288888888,,60
sip,101,Sal,18289999999,1,101,,secret,,,18280000000,
sip,102,Amy,,,,,longpassword,,,,
sip,103,Jan,18282222222,1,103,jan@jan.com,password,1,,,
virtual,201,Bob,18283333333,1,201,,,1,18284444444,,

Type

This determines whether the line contains information for a SIP extension or a Virtual extension. This field will accept any value. Using the value sip will tell the program to use a SIP extension while any other value will tell the program to use a Virtual extension.

Extension

This determines the extension number that will be assigned to the extension being imported. Acceptable values are three or more digit unsigned integers excluding three digit values beginning with the number nine. For example 922 would not be an acceptable value.

Description

This determines a non-numerical means of identifying the extension. This field takes a string as a value. In most cases the first and last name of the person assigned to the extension are used, however generic descriptions are also acceptable.

Caller ID Number

This determines the outbound caller ID number to be used with this extension. You may optionally leave this field blank if you would prefer to use the system default outbound caller ID. Acceptable values are eleven digit unsigned integers.

Enable Voicemail

This determines whether voicemail will be enabled for the extension. To enable voicemail, please use a value of 1 in this field. To not enable voicemail, please leave this field blank.

Voicemail Password

This determines the default password for the voicemail box associated with the extension. Acceptable values are three or more digit unsigned integers. Please use a value for this field if voicemail will be enabled for the extension, otherwise please leave this field blank.

Voicemail Email

This determines whether or not the email attachment voicemail feature is turned on, and if so to which email address it should send the attachment. Acceptable values are valid email addresses. You may optionally leave this field blank to turn off the email attachment feature. If voicemail will not be enabled for the extension, please leave this field blank.

SIP Secret

This determines the SIP secret or password associated with the extension. This field accepts a string. The value of this field is ignored when importing virtual extensions. A value is required in this field when importing SIP extensions. Be careful to avoid the use of commas in this value as they could cause errors while running the program.

Enable Follow Me

This determines whether the Follow Me feature is enabled for the extension. To enable the Follow Me feature, please use a value of 1 in this field. To not enable the Follow Me feature, please leave this field blank.

Follow Me Number

This determines a single optional additional phone number to add into the Follow Me settings. Acceptable values are eleven digit unsigned integers. If you do not intend to add a number here, please leave this field blank.

Emergency Caller ID Number

This determines the outbound caller ID number to be used when the extension makes an outbound phone call to an emergency line such as 911. Acceptable values are eleven digit unsigned integers. While not technically required, best practise is to always use a value here when importing SIP extensions. Values in this field are ignored when importing Virtual extensions.

Follow Me Ring Time

This determines the Ring Time as specified in the Follow Me settings for the extension. Acceptable values are unsigned integers beginning at 1 and ending at 60. The default value is 20. If left blank, the default value will be used.

Notes on running the Extension Import Tool

  • On a successful import, the Extension Import Tool will display no output
  • Best practise is to place the Extension Import Tool at /usr/local/bin/extimport
  • Best practise is to place CSV files to be imported in /root or /tmp