Summary: | ASTERISK-13941: [patch] New feature for incrementing and decrementing channel variables | ||
Reporter: | Nir Simionovich (GreenfieldTech - Israel) (greenfieldtech) | Labels: | |
Date Opened: | 2009-04-11 18:06:58 | Date Closed: | 2009-04-12 22:54:06 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Applications/NewFeature |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) inc_dec_asterisk_1_4_trunk.patch ( 1) inc_dec_asterisk_1.4-r187962M.patch | |
Description: | Ok, the following patch is a rough idea that I've been toying around with lately. The idea was to create 2 new functions to allow a user to increment and decrement a variable, from the dialplan, without issuing the Set command. ****** ADDITIONAL INFORMATION ****** In general, the function conform to the old (WAY OLD) inc/dec functions that existed in Pascal (for those who remember it). The included patch will compile with Asterisk SVN version 1.4 from the following branch version: SVN-branch-1.4-r187962M It was tested using the following dialplan, which generated the proper output: exten => _X.,1,Answer exten => _X.,n,Set(TestVar=1) exten => _X.,n,Noop(TestVar is now ${TestVar}) exten => _X.,n,Inc(TestVar) exten => _X.,n,Noop(TestVar is now ${TestVar}) exten => _X.,n,While($[${TestVar} < ${EXTEN}]) exten => _X.,n,Noop(TestVar is now ${TestVar}) exten => _X.,n,Inc(TestVar) exten => _X.,n,EndWhile exten => _X.,n,While($[${TestVar} > 1]) exten => _X.,n,Noop(TestVar is now ${TestVar}) exten => _X.,n,Dec(TestVar) exten => _X.,n,EndWhile Please note the syntax of these functions, as they don't require the variable to be refrenced with the ${} signs. In general, the patch compiles nicely and functions properly, apart from a small compile time warning as following: pbx.c: In function pbx_builtin_decvar: pbx.c:6040: warning: newvalue is used uninitialized in this function pbx.c: In function pbx_builtin_incvar: pbx.c:6001: warning: newvalue is used uninitialized in this function I couldn't figure out if there is a more Asteriskian method of initializing the variables inside the function, so assistance in this case is much appreciated. Nir | ||
Comments: | By: Nir Simionovich (GreenfieldTech - Israel) (greenfieldtech) 2009-04-11 18:08:53 Disregard first upload, it's wrong! By: Nir Simionovich (GreenfieldTech - Israel) (greenfieldtech) 2009-04-11 18:48:10 Please close this report, I'm re-working this for 1.6 trunk, following a discussion on #asterisk-dev with tzafrir and snuff By: Clod Patry (junky) 2009-04-12 22:54:05 closed per reporter ask. When you will want to re-open, feel free to ask in #asterisk-dev. Thanks. |