I get an error when I execute this code exten => rejected,n,Hangup($[-1*${Z}]) May 2 13:42:09] WARNING[23128]: ast_expr2.fl:468 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected $end, expecting '-' or '!' or '(' or '<token>'; Input: -1* The variable "Z" has a negative number, which is the code that I need to use in the hangup. Any idea how can I do this? There is no ABS() function in Asterisk. I already filed a request for it but it turns up that it will cost me money. How can I remove the sign from a number? Philip
3 possibilities - 1 use an AGI; 2 use a system command 3 (hopefully the simplest) just use a Set command. Which one you actually end up using may depend on your Asterisk flavor. -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of CDR Sent: Wednesday, May 02, 2012 12:48 PM To: asterisk-users at lists.digium.com Subject: [asterisk-users] parsing issue I get an error when I execute this code exten => rejected,n,Hangup($[-1*${Z}]) May 2 13:42:09] WARNING[23128]: ast_expr2.fl:468 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected $end, expecting '-' or '!' or '(' or '<token>'; Input: -1* The variable "Z" has a negative number, which is the code that I need to use in the hangup. Any idea how can I do this? There is no ABS() function in Asterisk. I already filed a request for it but it turns up that it will cost me money. How can I remove the sign from a number? Philip -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Have you tried the MATH() function? -----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of CDR Sent: Wednesday, May 02, 2012 1:48 PM To: asterisk-users at lists.digium.com Subject: [asterisk-users] parsing issue I get an error when I execute this code exten => rejected,n,Hangup($[-1*${Z}]) May 2 13:42:09] WARNING[23128]: ast_expr2.fl:468 ast_yyerror: ast_yyerror(): syntax error: syntax error, unexpected $end, expecting '-' or '!' or '(' or '<token>'; Input: -1* The variable "Z" has a negative number, which is the code that I need to use in the hangup. Any idea how can I do this? There is no ABS() function in Asterisk. I already filed a request for it but it turns up that it will cost me money. How can I remove the sign from a number? Philip -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
On Wed, May 02, 2012 at 01:48:04PM -0400, CDR wrote:> I get an error when I execute this code > exten => rejected,n,Hangup($[-1*${Z}]) > > May 2 13:42:09] WARNING[23128]: ast_expr2.fl:468 ast_yyerror: > ast_yyerror(): syntax error: syntax error, unexpected $end, expecting > '-' or '!' or '(' or '<token>'; Input: > -1* > > The variable "Z" has a negative number, which is the code that I need > to use in the hangup. > Any idea how can I do this? There is no ABS() function in Asterisk. I > already filed a request for it but it turns up that it will cost me > money. How can I remove the sign from a number?If you're sure Z is non-null and negative, then exten => rejected,n,Hangup($[-(${Z})]) -- Barry