[asterisk-users] Asterisk 1.6.2.10 & CDR custom added field

Tilghman Lesher tilghman at meg.abyt.es
Fri Mar 25 15:12:14 CDT 2011


On Friday 25 March 2011 04:36:28 Jonas Kellens wrote:
> On 03/25/2011 08:19 AM, Tilghman Lesher wrote:
> > On Thursday 24 March 2011 04:50:48 Jonas Kellens wrote:
> >> On 03/24/2011 10:45 AM, Rizwan Hisham wrote:
> >>> You have to use adaptive cdr for this functionality. In 1.8 the conf
> >>> file for adaptive cdr is cdr_adaptive_odbc.conf. The sample conf
> >>> file should tell you everything.
> >>> 
> >>> If you are using some other cdr engine then you will have to jump
> >>> into the code of asterisk to make it log the item you want, which
> >>> includes creating an extra variable in the cdr data struction,
> >>> creating a function to set/get its value from dialplan, and then
> >>> changing the sql command to include the extra variable for
> >>> insertion into DB.
> >> 
> >> I thought it was possible in asterisk 1.6.2 to add extra mysql-fields
> >> ?? In asterisk 1.4 you just have one 'userfield', but in 1.6.2 it is
> >> possible to add custom fields... I just don't know how.
> >> 
> >> This is what the wiki
> >> (http://www.voip-info.org/wiki/view/Asterisk+cdr+mysql) tells :
> >> 
> >> "/Module now permits arbitrary columns to be created and populated,
> >> just like cdr_adaptive_odbc, simply by adding the column to the
> >> table and defining the corresponding CDR() variable/"
> >> 
> >> Where is the information on this ?
> > 
> > Same as always, in the configs/ directory of addons 1.6.2.  The sample
> > configuration file contains common examples of the added
> > functionality.
> > 
> > Also, there's a note on it in UPGRADE.txt, in the root directory of
> > addons 1.6.2.  If you have any further questions, you're welcome to
> > ask this list.
> 
> alias start => calldate
> alias callerid => clid
> ;alias uniqueid => uniqueid
> 
> But this is not explained...

Alias allows you to rename a standard named column to another column
name.  I agree that the commented items are confusing.  However, both of
the uncommented ones are common renames of the standard columns.

> So please can you confirm how I think it should work :
> 
> In my dialplan I have :
> 
> /exten => 600,n,Set(CDR(mycolumn)="myvalue")/
> 
> So I should add the following to cdr_mysql.conf :
> 
> /[columns]
> static "mycolumn" => mycolumn/

No, what this will do is add the static definition of the literal value
"mycolumn" to the mycolumn field.  What you actually want is to add
the field to your table (ALTER TABLE ... ADD COLUMN ...) and add it to
your extensions.conf (and reload).  That's it.  There is literally nothing
you have to change in the cdr_mysql.conf file to add an extra column.  There
is also literally nothing you have to change in the cdr_mysql.conf file to
_delete_ a standard column.  Just have the column not appear in the backend
table (ALTER TABLE ... DROP COLUMN ...) and reload Asterisk.  The "static"
definition is for implicit values only.  The "alias" column is just for
renaming standard columns.

-- 
Tilghman



More information about the asterisk-users mailing list