[Asterisk-Users] Increment Variable

Michael Collins mcollins at fcnetwork.biz
Wed Feb 15 15:58:42 MST 2006


Doug,

The TFOT book recommends using expressions instead of dialplan
functions:

exten => s,1,Set(mainLoop=$[${mainLoop} + 1])

-MC

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Douglas
Garstang
Sent: Wednesday, February 15, 2006 2:10 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: [Asterisk-Users] Increment Variable

What's the best way to increment a numeric variable in the dial plan?
I tried this...

exten => s,1,Set(mainLoop=${MATH(${mainLoop}+1)})

but that converts it to a floating point number (WHY???), so I end up
with 1.0000, which later on means I have to perform string manipulation
to get rid of the .0000. 

Thanks
Doug
_______________________________________________
--Bandwidth and Colocation provided by Easynews.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