Summary:ASTERISK-05282: Per README.cdr can set your own extra variables by using Set(CDR(name)=value)
Reporter:Dave Van Abel (dvanabel)Labels:
Date Opened:2005-10-11 20:10:47Date Closed:2011-06-07 14:10:38
Versions:Frequency of
Description:Unable to use "Set(CDR(name)=value) for a new column = call_type. However, am able to set userfield by uncommenting userfield=1 in cdr_mysql.conf

Before trying this function, we DID add the new column to the cdr table.

We do have db = asterisk,table = cdr.
We are able to write to the cdr table just like always.
We were able to add this line to extensions.conf & have it write the userfield value: exten => 2001,3,Set(CDR(userfield)=999)

Data added in extensions.conf file as follows:

exten => 2001,1,Playback(transfer)
; sample code is: Set(CDR(name)=value)
exten => 2001,2,Set(CDR(userfield)=999)
exten => 2001,3,Set(CDR(call_type)=I)
exten => 2001,4,Dial(SIP/2001,20)
exten => 2001,5,Hangup

Thinking "call_type" needed to be set in cdr_mysql.conf, we added it like this:


But no luck, so removed it.


Sample output from CLI>

== Registered application 'WaitForSilence'
[cdr_addon_mysql.so] => (MySQL CDR Backend)
 == Parsing '/etc/asterisk/cdr_mysql.conf': Found
 == Manager registered action DBGet
 == Manager registered action DBPut
 == Parsing '/etc/asterisk/enum.conf': Found
Asterisk Ready.
*CLI>     -- Executing Playback("SIP/2000-39ae", "transfer") in new stack
   -- Playing 'transfer' (language 'en')
   -- Executing Set("SIP/2000-39ae", "CDR(userfield)=999") in new stack
   -- Executing Set("SIP/2000-39ae", "CDR(call_type)=I") in new stack
   -- Executing Dial("SIP/2000-39ae", "SIP/2001|20") in new stack
   -- Called 2001
   -- SIP/2001-678f is ringing
   -- SIP/2001-678f answered SIP/2000-39ae
   -- Attempting native bridge of SIP/2000-39ae and SIP/2001-678f
Comments:By: Olle Johansson (oej) 2005-10-11 22:41:34

Only the cdr_custom driver supports this new functionality.