[asterisk-users] MATH

Thomas Perron thomas.perron at gmail.com
Sun Jan 31 09:37:29 CST 2010


hi
i don't claim to be a star at this but there must be some obvious part missing;
my dial plan is below.  out put from cli follows.

exten => 3011,1,Answer()
exten => 3011,n,Set(TOTAL=0)
exten => 3011,n,Set(TOTAL=${Math(${TOTAL}+300,int)})
exten => 3011,n,WaitExten(3)
exten => 988,1,SayNumber(${TOTAL})

[Jan 31 10:21:35] ERROR[1318]: pbx.c:2770 ast_func_read: Function Math
not registered
    -- Executing [3011 at default:3] Set("SIP/64.85.162.137-c0132f50",
"TOTAL=") in new stack
    -- Executing [3011 at default:4]
WaitExten("SIP/64.85.162.137-c0132f50", "3") in new stack
[Jan 31 10:21:38] WARNING[1318]: pbx.c:7855 pbx_builtin_waitexten:
Timeout but no rule 't' in context 'default'
  == Spawn extension (default, 3011, 4) exited non-zero on
'SIP/64.85.162.137-c0132f50'
localhost*CLI>  Function Math not registered
No such command ' Function Math not registered' (type 'help Function
Math' for other possible commands)



2010/1/31 Håkon Nessjøen <haakon at avelia.no>:
> You probably have to do a
>
> exten => s,1,n,Set(TOTAL=0)
>
> in the start of the call, to initialize the TOTAL variable
>
> On Sun, Jan 31, 2010 at 4:29 AM, Thomas Perron <thomas.perron at gmail.com>
> wrote:
>>
>> thanks for the response.
>> I tried to simplify and am now tuning the following, but it is not
>> responding with anything.
>> something wrong with timing?
>> here is what I have:
>>
>> exten => 1625,1,Answer()
>> exten => 1625,n,Set(TOTAL=${MATH(${TOTAL}+500,int)})
>> exten => 1625,n,WaitExten(3)
>> exten => 9625,1,Answer()
>> exten => 9625,n,SayNumber(${TOTAL})
>>
>>
>> output from the console ....
>>
>> [Jan 30 22:25:16] WARNING[22987]: func_math.c:194 math: '' is not a valid
>> number
>>    -- Executing [1625 at default:2] Set("SIP/64.85.162.137-c00d10e0",
>> "TOTAL=") in new stack
>>    -- Executing [1625 at default:3]
>> WaitExten("SIP/64.85.162.137-c00d10e0", "3") in new stack
>> [Jan 30 22:25:19] WARNING[22987]: pbx.c:7855 pbx_builtin_waitexten:
>> Timeout but no rule 't' in context 'default'
>>  == Spawn extension (default, 1625, 3) exited non-zero on
>> 'SIP/64.85.162.137-c00d10e0'
>>
>>
>> 2010/1/30 Håkon Nessjøen <haakon at avelia.no>:
>> > Try something like:
>> >
>> > exten => 1,1,WaitExten(3)
>> > exten => 1,1,Set(TOTAL=${MATH(${TOTAL}+500,int)})
>> > exten => 1,n,WaitExten(3)
>> > exten => 2,1,Set(TOTAL=${MATH(${TOTAL}+200,int)})
>> > exten => 2,n,WaitExten(3)
>> > exten => 3,1,Set(TOTAL=${MATH(${TOTAL}+300,int)})
>> > exten => 3,n,WaitExten(3)
>> > exten => 9,1,SayNumber(${TOTAL})
>> >
>> > Or something. Never used either math or saynumber before, but according
>> > to
>> > the documentation, something like this should work..
>> >
>> >
>> > On Sat, Jan 30, 2010 at 3:06 PM, Thomas Perron <thomas.perron at gmail.com>
>> > wrote:
>> >>
>> >> total up for current call.
>> >> then read back the number
>> >>
>> >>
>> >>
>> >> 2010/1/30 Håkon Nessjøen <haakon at avelia.no>:
>> >> > For all calls combined, or for the current call?
>> >> >
>> >> > On Sat, Jan 30, 2010 at 2:48 PM, Thomas Perron
>> >> > <thomas.perron at gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> 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
>> >> >
>> >> >
>> >> > --
>> >> > _____________________________________________________________________
>> >> > -- 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
>> >> >
>> >>
>> >> --
>> >> _____________________________________________________________________
>> >> -- 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
>> >
>> >
>> > --
>> > _____________________________________________________________________
>> > -- 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
>> >
>>
>> --
>> _____________________________________________________________________
>> -- 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
>
>
> --
> _____________________________________________________________________
> -- 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