Step # 1 Introduce following columns in database table cdr
:
starttime
answertime
endtime
cc_caller
unique_identifier
ALTER TABLE asterisk
.cdr
ADD COLUMN answertime
DATETIME NOT NULL DEFAULT '' AFTER sequence
;
ALTER TABLE asterisk
.cdr
ADD COLUMN starttime
DATETIME NOT NULL DEFAULT '' AFTER answertime
;
ALTER TABLE asterisk
.cdr
ADD COLUMN endtime
DATETIME NOT NULL DEFAULT '' AFTER starttime
;
ALTER TABLE asterisk
.cdr
ADD COLUMN cc_caller
VARCHAR(80) NOT NULL DEFAULT '' AFTER endtime
;
Step # 2
Add following section in asterisk file i.e. cdr_adaptive_odbc.conf. It will enable the CDR() function to recognize custom fields included in asterisk MySQL CDRs ODBC.
[adaptive_connection]
connection=asterisk
table=cdr
alias start => starttime
alias answer => answertime
alias end => endtime
Step # 3
Following is the dialplan (in file i.e. extensions.conf) to handle custom Asterisk MySQL CDRs ODBC.
[default-context]
exten => _X.,n,Set(CALLERID(num)=${cc_caller})
exten => _X.,n,Set(CDR(cc_caller)=${cc_caller})
Step # 4
You need to restart asterisk to apply such changes.