Decimal Problems

Discussion in 'General' started by sergiogal, May 22, 2009.

  1. sergiogal

    Joined:
    Nov 26, 2007
    Messages:
    18
    Likes Received:
    0
    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!!!
     
  2. jgutierrez

    Joined:
    Feb 28, 2008
    Messages:
    5,737
    Likes Received:
    0
    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 []
     

Share This Page