[Home]

Summary:ASTERISK-17620: clid field empty in mysql table when using cdr_addon_mysql
Reporter:Warren Selby (wcselby)Labels:
Date Opened:2011-03-29 21:12:50Date Closed:2011-03-31 01:44:11
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Addons/cdr_mysql
Versions:1.8.3 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:As reported by Eric Davenport on the asterisk mailing list and confirmed tonight by myself:

The clid field is not being populated with any data for calls when using mysql call detail records.  The same calls generate the clid field in the Master.csv file.  Reproduced this tonight on fresh installs of asterisk 1.8.3.2 and asterisk 1.8.4-rc2 on a fresh install of ubuntu server 10.04, installing everything from source.

Record from mysql table:
mysql> select * from asterisk.cdr;
+-------+---------------------+------+-------+-----+----------+--------------------+--------------------+---------+--------------+----------+---------+-------------+----------+-------------+--------------+-----------+
| recid | calldate            | clid | src   | dst | dcontext | channel            | dstchannel         | lastapp | lastdata     | duration | billsec | disposition | amaflags | accountcode | uniqueid     | userfield |
+-------+---------------------+------+-------+-----+----------+--------------------+--------------------+---------+--------------+----------+---------+-------------+----------+-------------+--------------+-----------+
|     1 | 2011-03-29 20:25:45 |      | xlite | 100 | default  | SIP/xlite-00000000 | SIP/isip-00000001  | Dial    | SIP/isip,60  |       15 |       9 | ANSWERED    |        3 |             | 1301448345.0 |           |
|     2 | 2011-03-29 20:26:06 |      | isip  | 101 | default  | SIP/isip-00000002  | SIP/xlite-00000003 | Dial    | SIP/xlite,60 |       33 |      21 | ANSWERED    |        3 |             | 1301448366.2 |           |
+-------+---------------------+------+-------+-----+----------+--------------------+--------------------+---------+--------------+----------+---------+-------------+----------+-------------+--------------+-----------+
2 rows in set (0.00 sec)

Record from /var/log/asterisk/cdr-csv/Master.csv:
warren@astcdr:~$ cat /var/log/asterisk/cdr-csv/Master.csv
"","xlite","100","default","""xlite"" <xlite>","SIP/xlite-00000000","SIP/isip-00000001","Dial","SIP/isip,60","2011-03-30 01:25:45","2011-03-30 01:25:51","2011-03-30 01:26:00",15,9,"ANSWERED","DOCUMENTATION","1301448345.0",""
"","isip","101","default","""isip"" <isip>","SIP/isip-00000002","SIP/xlite-00000003","Dial","SIP/xlite,60","2011-03-30 01:26:06","2011-03-30 01:26:18","2011-03-30 01:26:39",33,21,"ANSWERED","DOCUMENTATION","1301448366.2",""


Relevant CLI (from a later call, when I remembered to set verbose and debug to 10):
*CLI> core set verbose 10
Verbosity was 5 and is now 10
*CLI> core set debug 10
Core debug was 0 and is now 10
 == Using SIP RTP CoS mark 5
   -- Executing [101@default:1] Verbose("SIP/isip-00000000", "Calling xlite client") in new stack
Calling xlite client
   -- Executing [101@default:2] Dial("SIP/isip-00000000", "SIP/xlite,60") in new stack
 == Using SIP RTP CoS mark 5
   -- Called xlite
   -- SIP/xlite-00000001 is ringing
   -- SIP/xlite-00000001 answered SIP/isip-00000000
   -- Remotely bridging SIP/isip-00000000 and SIP/xlite-00000001
 == Spawn extension (default, 101, 2) exited non-zero on 'SIP/isip-00000000'

****** ADDITIONAL INFORMATION ******

Fresh install of ubuntu 10.04 server.  Using latest source installs of:
asterisk-1.8.4-rc2.tar.gz and asterisk-1.8.3.2.tar.gz (tested both)
dahdi-linux-complete-2.4.1+2.4.1.tar.gz
libpri-1.4.11.5.tar.gz

Using latest apt-get install of:
gcc
make
perl
build-essential
libxml2-dev
ncurses-dev
libnewt-dev
openssl
mysql-server
mysql-client
libmysql++-dev

Built asterisk with all three mysql add-ons installed from the asterisk-addons section of make menuselect (app_mysql, cdr_mysql, res_config_mysql).  Using sample configs except for adding two sip soft-clients to sip.conf and a little dialplan in extensions.conf to ring between the two soft-clients, and cdr_mysql.conf.

/etc/asterisk/cdr_mysql.conf:
[global]
hostname=localhost
dbname=asterisk
table=cdr
password=PASSWORD
user=asterisk
port=3306
;sock=/var/lib/mysql/mysql.sock
;timezone=UTC ; Previously called usegmtime
userfield=1
loguniqueid=yes

[columns]
;static "<value>" => <column>
;alias <cdrvar> => <column>
alias start => calldate
alias callerid => clid
;alias src => src
;alias dst => dst
;alias dcontext => dcontext
;alias channel => channel
;alias dstchannel => dstchannel
;alias lastapp => lastapp
;alias lastdata => lastdata
;alias duration => duration
;alias billsec => billsec
;alias disposition => disposition
;alias amaflags => amaflags
;alias accountcode => accountcode
;alias userfield => userfield
;alias uniqueid => uniqueid

mysql> describe asterisk.cdr;
+-------------+-----------------------+------+-----+---------------------+----------------+
| Field       | Type                  | Null | Key | Default             | Extra          |
+-------------+-----------------------+------+-----+---------------------+----------------+
| recid       | mediumint(8) unsigned | NO   | PRI | NULL                | auto_increment |
| calldate    | datetime              | NO   | MUL | 0000-00-00 00:00:00 |                |
| clid        | varchar(80)           | NO   |     |                     |                |
| src         | varchar(80)           | NO   | MUL |                     |                |
| dst         | varchar(80)           | NO   | MUL |                     |                |
| dcontext    | varchar(80)           | NO   |     |                     |                |
| channel     | varchar(80)           | NO   |     |                     |                |
| dstchannel  | varchar(80)           | NO   |     |                     |                |
| lastapp     | varchar(80)           | NO   |     |                     |                |
| lastdata    | varchar(80)           | NO   |     |                     |                |
| duration    | int(11)               | NO   |     | 0                   |                |
| billsec     | int(11)               | NO   |     | 0                   |                |
| disposition | varchar(45)           | NO   | MUL |                     |                |
| amaflags    | int(11)               | NO   |     | 0                   |                |
| accountcode | varchar(20)           | NO   | MUL |                     |                |
| uniqueid    | varchar(32)           | NO   | MUL |                     |                |
| userfield   | varchar(255)          | NO   |     |                     |                |
+-------------+-----------------------+------+-----+---------------------+----------------+
17 rows in set (0.00 sec)
Comments:By: Tilghman Lesher (tilghman) 2011-03-31 01:41:46

Well, after a little testing, it appears that there's nothing wrong with the module, but it's a configuration file error.  Apparently, the CallerID field is actually named "clid" internally, which is why when we aliased "callerid" to "clid", it left out the value (since CDR(callerid) is never specified anywhere).

Mea culpa.  I am committing a fix to the configuration file, because that's where the error lies.

By: Digium Subversion (svnbot) 2011-03-31 01:43:20

Repository: asterisk
Revision: 311930

U   branches/1.8/configs/cdr_mysql.conf.sample

------------------------------------------------------------------------
r311930 | tilghman | 2011-03-31 01:43:19 -0500 (Thu, 31 Mar 2011) | 6 lines

Incorrect default example; the field is actually internally named "clid", not "callerid".

(closes issue ASTERISK-17620)
Reported by: wcselby
Tested by: tilghman

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=311930

By: Digium Subversion (svnbot) 2011-03-31 01:44:10

Repository: asterisk
Revision: 311931

_U  trunk/
U   trunk/configs/cdr_mysql.conf.sample

------------------------------------------------------------------------
r311931 | tilghman | 2011-03-31 01:44:10 -0500 (Thu, 31 Mar 2011) | 13 lines

Merged revisions 311930 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r311930 | tilghman | 2011-03-31 01:43:18 -0500 (Thu, 31 Mar 2011) | 6 lines
 
 Incorrect default example; the field is actually internally named "clid", not "callerid".
 
 (closes issue ASTERISK-17620)
 Reported by: wcselby
 Tested by: tilghman
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=311931