Handset Templates

Handset Templates

Template files stored under the manufacturer specific Handset directory are always treated as a Velocity file and pre-processed before being delivered to the requesting phone.

When Noojee Provision recieves a provisioning request for a handset it first identifies the manufacturer and then finds the appropriate template for the handset. This is done by identifying the manufacturer and possibly the model of the phone based on the request sent from the phone (this is usually done by using the mac address of the phone). The template is then pulled from the appropriate template directory under the Noojee Provision directory (.e.g. handsets/snom/templates/snom320.hml).

The template file is actually a Velocity template file and the standard template contains a number of velocity variables.

Velocity variables are of the form $<variablename>

e.g. $Extension

Noojee Provision makes the following variables available to the Velocity template.

VariableTypeDescription
$ExtensionStringthe handsets extension no.
$AsteriskUsernameStringThe handset's Asterisk username used to auth the handsets SIP account.
$AsteriskPasswordStringThe handset's Asterisk password used to auth the handsets SIP account.
$DirectoryVector<DirectoryItem>List of white pages entries.
$HandsetHandsetA set of handset properties.
$SystemSystemVariablesA set of system variables.

 -

You can make use of these variables to dynamically change the content of the handset template file.

A typical use might be if you want certain phones to have specific speed dials setup. If the phones of interest can be identified by their Extension number then you can customize the template as follows:

 #if ($Extension == "100")
    fkey0!: line
    fkey1!: dest 101
    fkey2!: dest 102
#elseif ($Extension == "101")
    fkey0!: line
    fkey1!: dest 100
    fkey2!: dest 102
#end 

In this example there are two extensions (100 and 101) which require customization of the template.

The #if statements basically says; if the extenions is 100 then include the next three lines in the template, else if the extension is 100 then include the second group of three lines in the template.

You can include as many #elseif statements as necessary. If you need to configure only one extension then just use the following format:

#if ($Extension == "100")
    fkey0!: line
    fkey1!: dest 101
    fkey2!: dest 102
#end

In either case the lines beginning with a '#' just disappear from the resulting template.