|Summary:||ASTERISK-11342: [patch] new REALTIME_STORE() and REALTIME_DESTROY() functions|
|Reporter:||Sergey Tamkovich (sergee)||Labels:|
|Date Opened:||2008-01-31 06:15:17.000-0600||Date Closed:||2008-02-06 10:22:50.000-0600|
|Environment:||Attachments:||( 0) func-rt-store-destroy-r101373.diff|
( 1) func-rt-store-destroy-r101746.diff
( 2) rt-func-store-destroy-multivalue.diff
( 3) rt-func-store-destroy-r102238.diff
|Description:||This patch adds new dialplan functions, which utilize store&destroy RT API. |
creates a new record in the RT storage, and sets field to value specified on the right.
acts in the same way as REALTIME(), except that it removes matched record from RT storage.
|Comments:||By: Sergey Tamkovich (sergee) 2008-01-31 14:48:42.000-0600|
otherwiseguy, do you need any feedback from me? any improvments?
By: Terry Wilson (twilson) 2008-01-31 20:53:12.000-0600
Sorry, had to leave earlier today right after I took this. I'm going to look at it and test it out tonight.
By: Terry Wilson (twilson) 2008-01-31 22:56:48.000-0600
I really like the idea of having these around, thinking about a few changes though. The documentation for REALTIME_STORE is off. It references the name REALTIME() and it says it returns the unique id if it was generated, but doesn't do that yet (see XXX comment and the fact that it is write only). At least not to the dialplan, which is what the user would expect from the docs.
Also, I think if we do a REALTIME_STORE function, we need it to be able to handle multiple fields/values. Having to make the call for each column is too awkward (especially if we don't return a uniqueid to the dialplan).
Would you consider adding the ability to set multiple fields/values at once? Basically have a REALTIME_STORE(family,field1,field2,...,fieldn)=value1,value2,...,valuen. See the ARRAY() function in func_strings as it is similar.
By: Terry Wilson (twilson) 2008-01-31 23:15:23.000-0600
Of course, thinking about this, it would be a lot of work and I think would involve coming up with some non varargs functions for doing store() operations in realtime.
By: Sergey Tamkovich (sergee) 2008-02-01 01:34:53.000-0600
otherwiseguy, i wrote documentation before the function itself :)
when i start to code i realized 2 things:
1. There is no way to generate va_list during runtime, so we can't have variable list of parameters in dialplan function, unless we change an API and remove all references to va_list structures.
2. Asterisk doesn't provide a method for returning a value in this style:
I suppose that parser simply is not capable of handling such constructions, however i'm not sure here.
i fixed documentation in this patch. As of other changes: i've read on mailing list that smaller commits are preferable, so if you won't mind - i'll open a separate issue for API changes (which are required to enable support for variable argument list in REALTIME*() functions).
By: Terry Wilson (twilson) 2008-02-01 11:56:39.000-0600
Corydon and I talked a lot last night about how to go about adding functions to the API to support variable numbers of arguments to the realtime engine. I think we've decided on an argc/argv kind of approach. Leaving existing functions in place and possibly adding functions like ast_realtime_store_argv(char *family, int argc, char *argv), etc. No promises if/when that will get done, though.
Technically you could return the insert id by setting a channel variable.
By: Sergey Tamkovich (sergee) 2008-02-01 13:43:40.000-0600
well, if there is no definite timeframe for adding argc/agrv APIs, let's commit this code as is, and then we'll evolve it?
By: Sergey Tamkovich (sergee) 2008-02-04 03:51:02.000-0600
The last version of this patch creates a channel variable named 'RTSTOREID' it contains an inset id returned by RealTime engine.
By: Terry Wilson (twilson) 2008-02-05 13:34:27.000-0600
I went ahead and added the ability to do multiple fields/values (a max of 30). It is not the most attractive solution, but it does at least add the functionality until any possible architectural change decisions were made.
Thought I'd go ahead and post it here, get some feedback before committing.
By: Sergey Tamkovich (sergee) 2008-02-05 14:19:57.000-0600
otherwiseguy, i can't see your file in the file list.
By: Terry Wilson (twilson) 2008-02-05 15:50:46.000-0600
Sorry, I changed accounts that I used to use a long time ago and no license was attached to this one. Should be fixed now.
By: Sergey Tamkovich (sergee) 2008-02-06 03:52:17.000-0600
otherwiseguy, I tested you version. It works like a charm! Thank you very much for your support!
By: Digium Subversion (svnbot) 2008-02-06 10:20:58.000-0600
r102700 | twilson | 2008-02-06 10:20:58 -0600 (Wed, 06 Feb 2008) | 10 lines
Add REALTIME_STORE and REALTIME_DESTROY dialplan functions provided by sergee.
I just added the ability to set multiple fields at once after discussions with
Tilghman and Russell. Currently limited to 30 fields.
(closes issue ASTERISK-11342)
Reported by: sergee
rt-func-store-destroy-multivalue.diff uploaded by otherwiseguy (license 396)
Tested by: sergee, otherwiseguy
By: Terry Wilson (twilson) 2008-02-06 10:22:49.000-0600
patch committed. thanks, sergee!