C.33. MATH()

MATH(number1 operator number2[,typeofresult])
Calculates simple mathematical expressions. Allowed operators are : +, -, /, *, <, >, <=, >=, ==, % (modulo). The typeofresult may be: f, float (default), i, int (integer), h, hex (hexadecimal), c, char (byte output).
; Calculate 3*8 as an integer:
exten => 123,1,Set(i=${MATH(3*8,int)})

Note

Internal help for this application in Asterisk 1.4:
  -= Info about function 'MATH' =- 

[Syntax]
MATH(<number1><op><number 2>[,<type_of_result>])

[Synopsis]
Performs Mathematical Functions

[Description]
Perform calculation on number 1 to number 2. Valid ops are: 
    +,-,/,*,%,<,>,>=,<=,==
and behave as their C equivalents.
<type_of_result> - wanted type of result:
  f, float - float(default)
  i, int - integer,
  h, hex - hex,
  c, char - char
Example: Set(i=${MATH(123%16,int)}) - sets var i=11
diff output to internal help in Asterisk 1.2:
- none -