Search:
     
3CX Phone System for Windows Download the Free Edition

Asterisk func math

Synopsis:

 Performs Mathematical Functions

Description:

 MATH(<number1><op><number 2>[,<type_of_result>])
 
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

Max. value: 2147483647 (signed long)

% is the modulo operator
int cuts of all decimals (it does not perform any rounding)

Notes

MATH() can only perform a single operation per MATH statement.

Return value

Returns the resulting string.

Example


exten => s,1,Set(i=${MATH(123%16,int)})
sets var i=11 (modulo)

See also


Created by: murf,Last modification on Sat 03 of Apr, 2010 [16:01 UTC] by JustRumours


Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

 





Search: