[asterisk-users] MATH

Danny Nicholas danny at debsinc.com
Mon Feb 1 08:42:52 CST 2010


Here's how I would do this based on the post "below" (it's below in outlook
express)
Exten => 866,1,Goto(tommath,s,1)
[tommath]
- exten => s,1,Read(NUMBER,instruct,2,skip,5)
- exten => s,n,Gotoif($["${NUMBER}" = "1"]?one)
- exten => s,n,Gotoif($["${NUMBER}" = "2"]?two) 
- exten => s,n,Gotoif($["${NUMBER}" = "3"]?three)
- exten => s,n,Gotoif($["${NUMBER}" = "20"]?done)
- exten => s,playback(system) - error message
- exten => s,n,Goto(tommath,s,1)
- exten => s,n(one),Set(TOTAL=${MATH(${TOTAL}+500,int)})
- exten => s,n,Goto(tommath,s,1)
- exten => s,n(two),Set(TOTAL=${MATH(${TOTAL}+200,int)})
- exten => s,n,Goto(tommath,s,1)
- exten => s,n(three),Set(TOTAL=${MATH(${TOTAL}+300,int)})
- exten => s,n,Goto(tommath,s,1)
- exten => s,n(done),SayNumber(${TOTAL})
- exten => s,n,playback(vm-goodbye)
- exten => s,n,hangup
Regards,
Danny Nicholas
--

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Thomas Perron
Sent: Saturday, January 30, 2010 7:48 AM
To: asterisk-users at lists.digium.com
Subject: [asterisk-users] MATH

I want to create a script for IVR that compiles responses, aggregates
them to a total number.
Then, run an equation based on the result.

Press 1 for X (X is a positive number 500)
Press 2 for Y (Y is a positive number 200)
Press 3 for Z (Z is a positive number 300)

Press 20 to calculate the results
= 500+200+300 =1000
then,
exten => s,n,Read(NUMBER,,1000)
exten => s,n,SayDigits(${NUMBER})

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list