Functions

You can use pre-defined functions in message manipulations for special operations such as changing a returned value from lower case to upper case (see example below).

Functions can be used in fields where manipulation terms are read-only:

Message Manipulation Sets: 'Condition' and 'Action Value' fields
Pre-Parsing Message Manipulation Sets: "Replace-With" manipulation term
Call Setup Rules: 'Request Key', 'Condition', and 'Action Value' fields

Syntax:

Func.<FunctionName>(<Message Manipulation Term>) 

The following table describes the supported functions.

Supported Functions

Function

Description

Func.Now

Inserts the current timestamp) since the Unix epoch. The value is measured in seconds. The time is counted since the Unix epoch, which is a standard point in time -- January 1, 1970 at 00:00:00 UTC (also written as 1970-01-01T00:00:00Z). For example, if Func.Now returns 1722259200, it means 1,722,259,200 seconds have passed since 1970-01-01T00:00:00Z, and this number corresponds to a date like 2024-07-29 00:00:00 UTC.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)
Pre-Parsing Manipulations Sets ('Replace-With' field)

Func.DateTime

Inserts the current date and time (timestamp) in standard ISO 8601 format (e.g., 2025-07-22T13:55:38Z).

Note: The function is typically used in the ‘Action Value’ field in the Message Manipulations table and can be used in any SIP header or body.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)
Pre-Parsing Manipulations Sets ('Replace-With' field)

Func.Json-Escape

Escapes the following special characters:

"" (double quotes)
\ (backslash)

The function uses the backslash (\) to escape the characters, for example, "foo" becomes /"foo/".

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' and 'Action Value' fields)

Func.Encrypt

Encrypts the value of the specified SIP header, using AES-256 encryption key algorithm. The key is configured using the [EncryptKeyAES256] parameter.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Note:  This function is intended for SIP headers that are not used by the  device for classification or routing. For example, you may want to encrypt the value of a proprietary SIP header called "P-Access-Network-Info" that may contain sensitive information.

Func.Decrypt

Decrypts the AES-256 encrypted value of the specified SIP header. The key is configured using the [EncryptKeyAES256] parameter.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Note:  This function is intended for SIP headers that are not used by the  device for classification or routing. For example, you may want to encrypt the value of a proprietary SIP header called "P-Access-Network-Info" that may contain sensitive information.

Func.Decrement

If the message manipulation term is evaluated to be integer x, the function returns x – 1. If the term is evaluated to be a non-integer, no action is done.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Func.Increment

If a message manipulation term is evaluated to be integer x, the function returns x + 1. If the term is evaluated to be a non-integer, no action is done.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Func.Length

Returns the length of the evaluated message manipulation term string.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Func.To-Lower

Changes characters in the evaluated message manipulation term to lowercase.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Func.To-Upper

Changes characters in the evaluated message manipulation term to uppercase.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Func.URL-Decode

Decodes evaluated Message Manipulation term characters according to RFC 3986 Section 2. Translates each encoded character in the string to the character itself.

Example: ‘User%40audiocodes.com’ is decoded to ‘User@audiocodes.com’.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Func.URL-Encode

Encodes evaluated message manipulation term characters according to RFC 3986 Section 2. It replaces reserved characters in a string with their hexadecimal representation (preceded by "%").  All characters are encoded except the following (considered unreserved):

Alphabet characters (A-Z, a-z)
Digit characters (0-9)
Hyphen "-"
Underscore "_"
Dot "."
Tilde "~"

For example, "user@abc.com" is encoded to "user%40abc.com".

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)

Func.UUID-Generate

Generates a random Universally Unique Identifier (UUID) value.

You can use this function in the following tables:

Call Setup Rules ('Condition' and 'Action Value' fields)
Message Manipulation Sets ('Condition' and 'Action Value' fields)
Message Conditions ('Condition' field)
Pre-Parsing Manipulations Sets ('Replace-With' field)

Currently, concatenated message manipulation terms inside the function's parentheses is not supported. For example, the following is not supported: Func.To-Upper(header.form.url.user + ‘@’ + header.to.url.host). However, for fields supporting concatenation, you can concatenate the function as shown in the following example:

Func.To-Upper(header.form.url.user) + ‘@’ + Func.To-Upper(header.to.url.host)

Examples:

The following Message Manipulation rule returns the timestamp to the header "ProcessTime" in the outgoing SIP INVITE message:

Message Type

Condition

Action Subject

Action Type

Action Value

invite.request

-

Header.ProcessTime

Add

Func.Now

Below is an example of the added date and time to the X-History header:

ProcessTime: 1,722,259,200
The following Message Manipulation rule adds the current date and time to the header "X-History" in the outgoing SIP INVITE message:

Message Type

Condition

Action Subject

Action Type

Action Value

invite.request

-

Header.X-History

Add

Func.DateTime

Below is an example of the added date and time to the X-History header:

X-History: 2025-07-22T13:55:38Z
The following Message Manipulation rule escapes the double quotes and backslashes of the My-Authentication header value in the outgoing SIP INVITE message:

Message Type

Condition

Action Subject

Action Type

Action Value

invite.request

-

Header.My-Authentication

Modify

Func.Json-Escape(Header.My-Authentication)

Before manipulation:

My-Authentication: BEARER token, "skipValidation": true\, "foo": "bar"

After manipulation whereby special characters are escaped:

My-Authentication: BEARER token, \"skipValidation\": true\\, \"foo\": \"bar\"
The following Message Manipulation rule encrypts the value of the header "My-Identifier" in the outgoing SIP INVITE message:

Message Type

Condition

Action Subject

Action Type

Action Value

invite.request

-

Header.My-Identifier

Modify

Func.Encrypt(Header.My-Identifier)

The following Message Manipulation rule adds the header "My-Host" to the outgoing SIP message, whose value is set to the source host, which is converted into upper case letters, using the function To-Upper:

Message Type

Condition

Action Subject

Action Type

Action Value

invite.request

-

Header.My-Host

Add

Func.To-Upper(Param.Call.Src.Host)

If the above rule is used and the host part in the From header of the SIP message is "JohnB":

From: <SIP:1000@JohnB>; tag-1c1000228485

After manipulation, the following header with the host value in upper case ("JOHNB") is added to the outgoing message:

From: <SIP:1000@JohnB>; tag-1c1000228485
My-Host: JOHNB
The following Call Setup rule performs an ENUM query on an ENUM server for the source user and if found, it returns a string from the URL that is defined by regex (the string after "us-ascii,"), and then converts encoded characters in the string and adds it as the name in the From header.

Request Type

Request Key

Condition

Action Subject

Action Type

Action Value

Enum

Param.Call.Src.User

Enum.Found Exists AND Enum.Result.Url regex 'us-ascii,(.*)'

Header.From.Name

Modify

Func.URL-Decode($1)

If the above rule is used and the returned URL from the ENUM query is:

: pstndata:cnam/7039532959;;charset=us-ascii,John%20Bow

The rule then extracts and decodes " John%20Bow" to "John Bow" and adds it to the From header:

From: "John Bow" <sip:+61424795803@abc.rob.com.au>;tag=1c1474248679
The following Message Manipulation rule adds the header "My-Identifier" to the outgoing SIP message, whose value is a randomly generated UUID, using the function UUID-Generate:

Message Type

Condition

Action Subject

Action Type

Action Value

invite.request

-

Header.My-Identifier

Add

Func.UUID-Generate