[Home]

Summary:ASTERISK-02493: app_math adds Sum, Multiply, Divide, Subtract, Modulus, GT, LT, GTE, LTE, EQ functions to asterisk
Reporter:scaredycat (scaredycat)Labels:
Date Opened:2004-09-28 15:37:20Date Closed:2008-01-15 15:08:54.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) math.tar.gz
Description:Adds mathmatical functions that will work on floating point numbers.

Comments:By: Brian West (bkw918) 2004-09-28 18:56:02

Examples of usage please :P

By: scaredycat (scaredycat) 2004-09-28 19:09:01

:D

exten => 11099,1,SUM(RV,1,20)
exten => 11099,2,NOOP(\${RV})
exten => 11099,3,MULTIPLY(RV,10,2)
exten => 11099,4,NOOP(\${RV})
exten => 11099,5,DIVIDE(RV,10,2)
exten => 11099,6,NOOP(\${RV})
exten => 11099,7,SUBTRACT(RV,10,2)
exten => 11099,8,NOOP(\${RV})
exten => 11099,9,MODULUS(RV,2,10)
exten => 11099,10,NOOP(\${RV})
exten => 11099,11,DIVIDE(RV,10,0)
exten => 11099,12,NOOP(\${RV})
exten => 11099,13,SUBTRACT(RV,10,200)
exten => 11099,14,NOOP(\${RV})
exten => 11099,15,DIVIDE(RV,1,20)
exten => 11099,16,NOOP(\${RV})
exten => 11099,17,LT(RV,1,20)
exten => 11099,18,NOOP(\${RV})
exten => 11099,19,GTE(RV,1,20)
exten => 11099,20,NOOP(\${RV})
exten => 11099,21,GT(RV,101,20)
exten => 11099,22,NOOP(\${RV})
exten => 11099,23,EQ(RV,1,20)
exten => 11099,24,NOOP(\${RV})
exten => 11099,25,LTE(RV,20,20)
exten => 11099,26,NOOP(\${RV})

results in:

-- Starting simple switch on 'Zap/2-1'
-- Executing Sum("Zap/2-1", "RV|1|20") in new stack
-- Executing NoOp("Zap/2-1", "21.000000") in new stack
-- Executing Multiply("Zap/2-1", "RV|10|2") in new stack
-- Executing NoOp("Zap/2-1", "20.000000") in new stack
-- Executing Divide("Zap/2-1", "RV|10|2") in new stack
-- Executing NoOp("Zap/2-1", "5.000000") in new stack
-- Executing Subtract("Zap/2-1", "RV|10|2") in new stack
-- Executing NoOp("Zap/2-1", "-8.000000") in new stack
-- Executing Modulus("Zap/2-1", "RV|2|10") in new stack
-- Executing NoOp("Zap/2-1", "2.000000") in new stack
-- Executing Divide("Zap/2-1", "RV|10|0") in new stack
-- Executing NoOp("Zap/2-1", "0.000000") in new stack
-- Executing Subtract("Zap/2-1", "RV|10|200") in new stack
-- Executing NoOp("Zap/2-1", "190.000000") in new stack
-- Executing Divide("Zap/2-1", "RV|1|20") in new stack
-- Executing NoOp("Zap/2-1", "0.050000") in new stack
-- Executing LT("Zap/2-1", "RV|1|20") in new stack
-- Executing NoOp("Zap/2-1", "TRUE") in new stack
-- Executing GTE("Zap/2-1", "RV|1|20") in new stack
-- Executing NoOp("Zap/2-1", "FALSE") in new stack
-- Executing GT("Zap/2-1", "RV|101|20") in new stack
-- Executing NoOp("Zap/2-1", "TRUE") in new stack
-- Executing EQ("Zap/2-1", "RV|1|20") in new stack
-- Executing NoOp("Zap/2-1", "FALSE") in new stack
-- Executing LTE("Zap/2-1", "RV|20|20") in new stack
-- Executing NoOp("Zap/2-1", "TRUE") in new stack
-- Hungup 'Zap/2-1'

By: twisted (twisted) 2004-10-01 11:37:19

My \$0.02 (USD)

We shouldn't use seperate applicaiton registrations for each function.  IMHO, each function should be able to be used in a string, for example:

exten => 11099,1,Math(RV=1+20)
exten => 11099,2,NoOp(\${RV})
exten => 11099,3,Math(RV=10*20)
exten => 11099,4,NoOp(\${RV})

and so on..  You get the Idea I think.

By: Mark Spencer (markster) 2004-10-03 10:20:35

Added, but merged into one application called "Math" with multiple operations.

By: Russell Bryant (russell) 2004-10-03 10:47:16

not included in the 1.0 branch

By: Digium Subversion (svnbot) 2008-01-15 15:08:54.000-0600

Repository: asterisk
Revision: 3892

U   trunk/apps/Makefile
A   trunk/apps/app_math.c

------------------------------------------------------------------------
r3892 | markster | 2008-01-15 15:08:54 -0600 (Tue, 15 Jan 2008) | 2 lines

Add (heavily modified) math application (bug ASTERISK-2493)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=3892