Decimal Problems

sergiogal

Joined
Nov 26, 2007
Messages
18
Likes
0
Points
1
#1
Hi,
I have this Extension:

exten => h,n,Noop( --- CDR(billsec) : ${CDR(billsec)})
exten => h,n,Noop( --- Tarifa : ${tarifa})
exten => h,n,Set(tasacion=$[${CDR(billsec)}*${tarifa}])

When this extensions execute the result is incorrect:
[May 22 07:26:35] VERBOSE[17541] logger.c: -- Executing [h@Discar:4] NoOp("SIP/5555109903-0bb7a308", "--- CDR(billsec) : 20" ) in new stack
[May 22 07:26:35] VERBOSE[17541] logger.c: -- Executing [h@Discar:5] NoOp("SIP/5555109903-0bb7a308", "--- Tarifa : 0.07" ) in new stack
[May 22 07:26:35] WARNING[17541] ast_expr2.y: non-numeric argument
[May 22 07:26:35] VERBOSE[17541] logger.c: -- Executing [h@Discar:6] Set("SIP/5555109903-0bb7a308", "tasacion=0" ) in new stack
[May 22 07:26:35] VERBOSE[17541] logger.c: -- Executing [h@Discar:7] NoOp("SIP/5555109903-0bb7a308", "--- Tasacion : 0" ) in


If ${tarifa} is an integer the result is correct, but is decimal the result is 0

Help!!
Thanks!!!
 

jgutierrez

Joined
Feb 28, 2008
Messages
5,737
Likes
0
Points
0
#2
Try the following:
Code:
exten => h,n,Set(tasacion=$[ ${CDR(billsec)}*${tarifa} ])
That is a common mistake, to don't leave a space between the []
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,970
Messages
131,032
Members
17,680
Latest member
ncortes1984
Top