Calling; String Functions - Snom 4S Administrator's Manual

Sip proxy/registrar version 2.30
Table of Contents

Advertisement

[
S N O M
the brackets. The arguments must be variable names including the dollar
sign and it is not allowed to use expressions in the argument list.
By providing arguments that are not initialized when the function
is being called, you can set up local variables for the function. This trick is
known from other scripting languages like gawk.
The sequence in which you define your functions do not matter.
The functions are set up when the script is loaded. When you actually
execute a function, the definition is already available, even if it appears
later in the script.

Calling

Once you have defined your function, you can use it in any
expression. In the simplest case, a statement consists of a single function
call, which looks like a procedure call.
To avoid endless looping when a function calls itself (directly
or indirectly through recursion), the number of nested function calls is
limited. The default value for this limit is 50. If that limit has been reached,
every function just returns an empty string, so that the processing of the
current proxy action stops. In such a case, the proxy will write a log
message. This will allow the operator to find these conditions.

String Functions

String functions are helpful to manipulate parts of strings and to
find out if a string contains a certain patterns.
length
To get the length of a string, call length with the string as
argument. The result will be an integer number.
Example:
length("1234") will return "4".
substr
To get a part of a string, you can use the substr function. It takes
two or three arguments.
The first argument is the string that should be used. The second
argument is the position in the string. It refers to the character counted
40 • Scripting
4 S P
/ R
R O X Y
E G I S T R A R
M
]
A N U A L

Advertisement

Table of Contents
loading

Table of Contents