[asterisk-dev] [Code Review] INCrement DECrement functionality for Asterisk

Tilghman Lesher tlesher at digium.com
Mon May 4 17:49:03 CDT 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/243/#review765
-----------------------------------------------------------


I cannot view the diff.

- Tilghman


On 2009-05-04 04:00:15, greenfieldtech wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/243/
> -----------------------------------------------------------
> 
> (Updated 2009-05-04 04:00:15)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> Over the course of time, developing Asterisk dialplans becomes fairly cumbersome, especially when writing While() loops in the dialplan. Mainly, when we want to iterate a few times, the ever annoying Set(Var=$[${Var} + 1]) is really annoying.
> INCrement and DECrement follow the old PASCAL functions, allowing to increment and decrement a variable.
> 
> The functions are built to handle both numeric and alpha-numeric values. If an alpha-numeric value is given, the functions will simply bail out and issue a LOG_NOTICE accordingly.
> 
> In order to implement this, i've added some functionality to func_math.c and added a new ast_is_numeric function to strings.h
> 
> Please find attached patches for TRUNK under bug tracker issue 15025.
> 
> For some reason, the post-review script doesn't work (kpf is aware of the issue).
> 
> 
> This addresses bug N/A.
>     http://bugs.digium.com/view.php?id=N/A
> 
> 
> Diffs
> -----
> 
>   /funcs/funcs/func_math.c 191953 
> 
> Diff: http://reviewboard.digium.com/r/243/diff
> 
> 
> Testing
> -------
> 
> The below dialplan illustrates the usage of these functions within a dialplan:
> 
> [incdec]
> exten => _X.,1,Answer
> exten => _X.,n,Wait(1)
> exten => _X.,n,Set(MyVar=10)
> exten => _X.,n,Noop(${INC(MyVar)})
> exten => _X.,n,Noop(MyVAR is Now: ${MyVar})
> exten => _X.,n,Noop(${DEC(MyVar)})
> exten => _X.,n,Noop(MyVAR is Now: ${MyVar})
> exten => _X.,n,While($[DEC(MyVar) > 0])
> exten => _X.,n,Noop(MyVAR is Now: ${MyVar})
> exten => _X.,n,EndWhile
> exten => _X.,n,Noop(${INC(NoVar)})
> exten => _X.,n,Set(NewVar=ab)
> exten => _X.,n,Noop(${INC(NewVar)})
> exten => _X.,n,Noop(NewVAR is Now: ${NewVar})
> 
> 
> Screenshots
> -----------
> 
> INC and DEC running
>   http://reviewboard.digium.com/r/243/s/1/
> 
> 
> Thanks,
> 
> greenfieldtech
> 
>




More information about the asterisk-dev mailing list