2 Mathematical dialplan function
4 Yeah, I thought it was a little insane too..
8 Sum, Multiply, Divide, Subtract, Modulus, GT, LT, GTE, LTE, EQ functions to Asterisk
10 All functions follow the same basic pattern for parameters:
12 parameter 1 = the math expression
13 parameter 2 = the type of result
15 Perform calculation on number 1 to number 2. Valid ops are:
16 +,-,/,*,%,<,>,>=,<=,==
17 and behave as their C equivalents.
19 <type_of_result> - wanted type of result:
20 f, float - float(default)
25 Each math expression is performed as
27 Action param1 on param2
42 exten => 11099,1,Set(RV=${MATH(1+20)})
43 exten => 11099,n,NOOP(${RV})
44 exten => 11099,n,Set(RV=${MATH(10*2)})
45 exten => 11099,n,NOOP(${RV})
46 exten => 11099,n,Set(RV=${MATH(10*2)})
47 exten => 11099,n,NOOP(${RV})
48 exten => 11099,n,Set(RV=${MATH(10-2)})
49 exten => 11099,n,NOOP(${RV})
50 exten => 11099,n,Set(RV=${MATH(2%10)})
51 exten => 11099,n,NOOP(${RV})
52 exten => 11099,n,Set(RV=${MATH(10/0)})
53 exten => 11099,n,NOOP(${RV})
54 exten => 11099,n,Set(RV=${MATH(10-200)})
55 exten => 11099,n,NOOP(${RV})
56 exten => 11099,n,Set(RV=${MATH(1-20)})
57 exten => 11099,n,NOOP(${RV})
58 exten => 11099,n,Set(RV=${MATH(1<20)})
59 exten => 11099,n,NOOP(${RV})
60 exten => 11099,n,Set(RV=${MATH(1>=20)})
61 exten => 11099,n,NOOP(${RV})
62 exten => 11099,n,Set(RV=${MATH(101>20)})
63 exten => 11099,n,NOOP(${RV})
64 exten => 11099,n,Set(RV=${MATH(1==20)})
65 exten => 11099,n,NOOP(${RV})
66 exten => 11099,n,Set(RV=${MATH(20<=20)})
67 exten => 11099,n,NOOP(${RV})
68 exten => 11099,n,Set(RV=${MATH(123%16,int)})
69 exten => 11099,n,NOOP(${RV})