Summary: | ASTERISK-03515: [patch] Let CDR have variables | ||
Reporter: | Anthony Minessale (anthm) | Labels: | |
Date Opened: | 2005-02-14 18:10:27.000-0600 | Date Closed: | 2008-01-15 15:28:36.000-0600 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Core/General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) cdr_csv2.c ( 1) cdr_custom_csv.c ( 2) cdr.conf ( 3) cdr2_rev0.diff ( 4) cdr2_rev1.diff ( 5) cdr2_rev2.diff | |
Description: | This patch lets the cdr object have 2nd class members by implementing it's own variables the same way channel variables are done. So far I have the api and an example added to app_cdr.c With the patch applied you could do the following: exten => 08,1,noop exten => 08,n,SetVarCDR(TEST1=woohoo1) exten => 08,n,SetVarCDR(TEST2=woohoo2) exten => 08,n,SetVarCDR(TEST3=woohoo3) exten => 08,n,ShowCDR exten => 08,n,Hangup This would set the vars to the cdr then show it to you on the console and hangup. Also you could do exten => 08,1,noop exten => 08,n,SetVarCDR(TEST1=woohoo1|TEST2=woohoo2|TEST3=woohoo3) exten => 08,n,ShowCDR exten => 08,n,Hangup and if you so choose if any values in the list are -c then a channel var would be set with the same name / val exten => 08,1,noop exten => 08,n,SetVarCDR(-c|TEST1=woohoo1|TEST2=woohoo2|TEST3=woohoo3) exten => 08,n,ShowCDR exten => 08,n,Hangup I'd also like to make the default getvar try to pull the value from the cdr if not found as a local or global var but I won't go there yet. ****** ADDITIONAL INFORMATION ****** Disclaimer on file anthmct@yahoo.com | ||
Comments: | By: Olle Johansson (oej) 2005-02-15 15:04:31.000-0600 Please explain usage - will these be included in the CDR or will these affect the cdr driver in any way? Curious... By: Anthony Minessale (anthm) 2005-02-15 16:51:22.000-0600 when you make your own cdr driver you can use them for instance picture cdr_csv2.so that lets you draw up a template for what you want to log you could expand %x to the familiar key x and %{XYZ} to the cdr channel var XYZ template => "%chan_name","%{MYVAR}" By: Mark Spencer (markster) 2005-02-16 00:09:38.000-0600 Okay, Corydon is in agreement with this strategy. This patch can be merged as soon as a few things are fixed: 1) Formatting is still incorrect (there is a mixture of spaces and tabs). 2) ast_cdr_setvar does not appear to work correctly on cdr's that are linked (i.e. it only sets it on the first -- presumably you'd want to be able to set it on th eothers as well). 3) getvar and setvar should both be using const char *'s and getvar should probably return a const char *. 4) Would "ShowCDR" having a command line equivalent be valuable? This isn't a requirement, just an question. I'm not sure how valuable viewing the CDR before a call is finished is. By: Anthony Minessale (anthm) 2005-02-16 09:05:58.000-0600 OK I'll work on it, showcdr was just so i could prove it was workin =) i'll probably omit that but i *could* expand show channel <X> to also traverse the cdrs just for consistancy sake. I'd like to know if it'd be a good idea to make the channel getvar try it's cdr if it cant find the requested var as a local var nor a global as for the linked good thing I laid out a flags construct (woohoo for foresight) -r can mean recursive! By: drmac (drmac) 2005-02-18 09:41:44.000-0600 Personally, I like bug:3441 better because its more of a global setting rather than context specific (what a programming pain to have some CDRs be XX in length and some in YY length). However, I forsee a problem with this bug and ASTERISK-3366 using RealTime. How do you dynamically change/add CDR fields when columns in databases are static-ish? Our class 4/5 switch has over 50 different fields to it, so don't be worried about crowding the CDR itself. Whatever happens, please oh please add in seperate columns for dialed number and translated number. By: Anthony Minessale (anthm) 2005-02-18 17:29:08.000-0600 Added a ton, please evaluate ASAP before all the files change =) See patches to readme for explanation. I didn't remove the formatting stuff cos the patch would be bigger the issue is already in the various file so apply a tabifier. By: Mark Spencer (markster) 2005-02-19 15:04:42.000-0600 How about we use ${CDR(foo)} for consistency with ${ENV(foo)}? I'm fine with SetVarCDR app, no need to have a GetVarCDR. By: Anthony Minessale (anthm) 2005-02-19 15:58:55.000-0600 Do we gotta use CDR() ? It's more code to find the ), it breaks my :: for recursive plus you can _set_ CDR: vars too so it has an excuse to be different ENV() is read only right =D By: Anthony Minessale (anthm) 2005-02-20 17:17:53.000-0600 ok fine ${CDR(XYX)} it is... I say uncle (fu**a) lol Spoke to markster and addressed his concerns. SetVar has been retrofitted with the ability to take an endless list of name/value pairs and can natively set ${CDR(XYX)} (see show application setvar) edited on: 02-20-05 17:25 By: Mark Spencer (markster) 2005-02-21 01:38:54.000-0600 Working on the merge but it's going to take some time... Will try to finish tomorrow. By: Anthony Minessale (anthm) 2005-02-21 12:51:57.000-0600 updated to meet the proper kramifications By: Mark Spencer (markster) 2005-02-23 16:51:47.000-0600 Added to CVS with some modifications. Please reopen or post a new bug if I broke anything. Thanks! By: Russell Bryant (russell) 2005-02-26 13:13:58.000-0600 not included in 1.0 By: Anthony Minessale (anthm) 2005-03-16 19:45:09.000-0600 what about the cdr_csv2 it lets you set the exact format of the csv file look at cdr_csv2.c and cdr.conf edited on: 03-16-05 19:46 By: Mark Spencer (markster) 2005-03-17 09:47:35.000-0600 It leaks a cfg if there is no entry for cdr_csv2. We also would need a way for this to coexist with the existing cdr stuff. What about formatting of ints vs. strings? By: Anthony Minessale (anthm) 2005-03-17 10:04:02.000-0600 here it is as cdr_custom_csv.c since it uses all CDR variables in the format it is all char so no issues with ints. By: Mark Spencer (markster) 2005-03-20 02:06:56.000-0600 There is nothing "CSV about this at all. Perhaps it's more logical to call it cdr_custom and remove any reference to CSV from its description? By: Mark Spencer (markster) 2005-03-20 02:07:17.000-0600 Also, if no entries are listed, we shouldn't bother registering it right? By: Mark Spencer (markster) 2005-03-24 16:03:30.000-0600 Added to CVS head, thanks! By: Olle Johansson (oej) 2005-04-01 00:35:18.000-0600 ---New feature, not added to 1.0. By: Digium Subversion (svnbot) 2008-01-15 15:25:56.000-0600 Repository: asterisk Revision: 5068 U trunk/apps/app_forkcdr.c U trunk/cdr.c U trunk/cli.c U trunk/doc/README.cdr U trunk/doc/README.variables U trunk/include/asterisk/cdr.h U trunk/include/asterisk/channel.h U trunk/pbx.c ------------------------------------------------------------------------ r5068 | markster | 2008-01-15 15:25:56 -0600 (Tue, 15 Jan 2008) | 2 lines Merge anthm's CDR updates (bug ASTERISK-3515) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=5068 By: Digium Subversion (svnbot) 2008-01-15 15:28:36.000-0600 Repository: asterisk Revision: 5253 U trunk/cdr/Makefile A trunk/cdr/cdr_custom.c A trunk/configs/cdr_custom.conf ------------------------------------------------------------------------ r5253 | markster | 2008-01-15 15:28:35 -0600 (Tue, 15 Jan 2008) | 2 lines Add custom CDR (bug ASTERISK-3515) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=5253 |