Skip to main content

Functions

Introduction

This page documents all the template functions that may be used for each SIP message.

Function definition

Each function that can be used within a template is defined below.

Function: toLower

This maps the strings.ToLower GO standard library function to the template engine. E.g. {{ toLower "ABC" }} will result in abc.

Function: toUpper

This maps the strings.ToUpper GO standard library function to the template engine. E.g. {{ toUpper "xyz" }} will result in XYZ.

Function: randstr

This function exposes the internal random string generator. It takes an integer parameter which specifies the length of the resulting string. E.g. {{ randstr 32 }} may produce a random string such as O701EC1wCbgAp5D3Gn7CQAhsuNApDENc.

Function: randint

This function exposes the internal random integer generator. It takes an integer parameter which specifies the length of the resulting string. E.g. {{ randint 32 }} may produce a random integer such as 99322844953488951571441534139796.

Function: ENV

This function allows one to include environment variables in the templates. It takes a variable name as parameter. E.g. {{ ENV "user" }} will output the username.