# &adminguide;

## Overview

The module reads content of files at startup and can evaluate the variables inside during runtime.

## Dependencies

### &kamailio; Modules

The following modules must be loaded before this module:

- None.

### External Libraries or Applications

The following libraries or applications must be installed before running &kamailio; with this module loaded:

- None.

## Parameters

### `tpl` (str)

The definition of a template file:

- "name=_string_;fpath=_number_;bsize=_number_"

The parameter can be set multiple times to get more templates in same configuration file.

- name - name of the template.

- fpath - path to the template file.

- bsize - buffer size to evaluate the template (default: 1024).

Default value is NULL.

#### Set `tpl` parameter

    ...
    modparam("pvtpl", "tpl", "name=tpl1;fpath=/etc/kamailio/tpl1.pvtpl;bsize=512;")
    modparam("pvtpl", "tpl", "name=tpl2;fpath=/etc/kamailio/tpl2.pvtpl;bsize=256;")
    ...

## Functions

### `pvtpl_render(tplname, res)`

Render the template 'tplname' using config variables, setting the result in the variable specified by 'res'.

This function can be used from ANY_ROUTE.

#### `pvtpl_render` usage

    ...
    pvtpl_render("t1", "$var(out)");
    ...

## Template File

The template file can contain text and config variables that are evaluate when running pvtpl_render() functions.

The templates files are loaded at startup and prepared for runtime. It is no option to reload the template files.

### Template file

    ...
    {
      "from": "$fu",
      "to": "$tu",
      "x" : $var(x)
    }
    ...