Summary:ASTERISK-12606: mysql cdr not loging custom fields
Reporter:mbrevda (lazytt)Labels:
Date Opened:2008-08-18 09:02:25Date Closed:2011-06-07 14:08:15
Versions:Frequency of
Description:When trying to add custom fields to the mysql crd table, asterisk will not log the values assigned to them. I added a field called "monitor" and tried using the following dialplan:

exten => s,1000,Set(CDR(monitor)=${CALLFILENAME}.${MIXMON_FORMAT})

However, all asterisk adds is:
cdr_addon_mysql.c: cdr_mysql: SQL command as follows: INSERT INTO cdr (calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) VALUES ('2008-08-18 17:01:59','\"lazytt\" <220>','220','123456','from-internal', 'SIP/220-09024700','Zap/1-1','Dial','ZAP/g0/123456|300|T',10,5,'ANSWERED',3,'','1219068119.2','')

Using the same dialplan with variables such as userfeild works


core show function CDR says:
...You may, however,  supply
a name not on the above list, and create your own
variable, whose value can be changed with this function,
and this variable will be stored on the cdr...

using asterisk addons 1.4.6
Comments:By: snuffy (snuffy) 2008-08-18 09:09:10

MySQL doesn't have an 'adaptive' option which means you are limited to standard fields and you can either store that info in part of 'userfield' or you can use cdr_adaptive_odbc which will allow you to have as many custom fields as you want.

NOTE: adaptive_odbc is only in 1.6 or trunk not 1.4

By: Sean Bright (seanbright) 2008-08-18 10:56:38

cdr_mysql in the 1.6.0 version of asterisk-addons (which is only compatible with Asterisk 1.6.0) has an 'adaptive' mode now.  There is no backport available that I am aware of.

By: Leif Madsen (lmadsen) 2008-08-18 17:24:53

As mentioned by the other two posters you need CDR adaptive ODBC in order to write custom fields to the database.

Backport available in the svncommunity via http://svncommunity.digium.com/view/tilghman/branches/1.4/