get realtime CDR to your mysql from asterisk
astercc works as a daemon in linux, it get events from asterisk AMI and store the CDR to two mysql table.
the first table is "curcdr" which will store all simultaneous calls, when call starts there would be a new record in the table, and when it stops, the record would be removed to another table "mycdr"
the record could be:
mysql> select * from curcdr;
+------+------+----------+---------------+-----------------+---------------------+---------------------+-----------------+-----------------+-------------+---------+--------+--------+----------------+----------------+-------------+
| id | src | dst | srcchan | dstchan | starttime | answertime | srcuid | dstuid | disposition | groupid | userid | credit | callshopcredit | resellercredit | creditlimit |
+------+------+----------+---------------+-----------------+---------------------+---------------------+-----------------+-----------------+-------------+---------+--------+--------+----------------+----------------+-------------+
| 3880 | 8807 | 8806 | SIP/8807-6fc2 | SIP/8806-d962 | 2008-02-28 12:26:01 | 2008-02-28 12:26:10 | 1204172801.3813 | 1204172801.3814 | link | 0 | 0 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
| 3881 | 8000 | 84350822 | SIP/8000-1684 | SIP/trunk1-a73d | 2008-02-28 12:26:13 | 0000-00-00 00:00:00 | 1204172812.3815 | 1204172813.3816 | dial | 0 | 0 | 0.0000 | 0.0000 | 0.0000 | 0.0000 |
+------+------+----------+---------------+-----------------+---------------------+---------------------+-----------------+-----------------+-------------+---------+--------+--------+----------------+----------------+-------------+
and the record in mycdr could be
mysql> select * from mycdr order by id desc limit 0,2;
+------+---------------------+------+----------+---------------+-----------------+----------+---------+-------------+-------------+-----------+-----------------+-----------------+----------+--------+----------------+----------------+---------+--------+
| id | calldate | src | dst | channel | dstchannel | duration | billsec | disposition | accountcode | userfield | srcuid | dstuid | calltype | credit | callshopcredit | resellercredit | groupid | userid |
+------+---------------------+------+----------+---------------+-----------------+----------+---------+-------------+-------------+-----------+-----------------+-----------------+----------+--------+----------------+----------------+---------+--------+
| 3682 | 2008-02-28 12:26:13 | 8000 | 84350822 | SIP/8000-1684 | SIP/trunk1-a73d | 5 | 0 | NO ANSWER | | UNBILLED | 1204172812.3815 | 1204172813.3816 | | 0.0000 | 0.0000 | 0.0000 | 0 | 0 |
| 3681 | 2008-02-28 12:24:40 | 8806 | 8807 | SIP/8806-c36f | SIP/8807-0139 | 8 | 6 | ANSWERED | | UNBILLED | 1204172719.3811 | 1204172720.3812 | | 0.0000 | 0.0000 | 0.0000 | 0 | 0 |
+------+---------------------+------+----------+---------------+-----------------+----------+---------+-------------+-------------+-----------+-----------------+-----------------+----------+--------+----------------+----------------+---------+--------+
2 rows in set (0.00 sec)
so if you want to get real time cdr datas from your asterisk for your application, you can try astercc, it provide 5 free channels, means it could catch 5 simultaneous calls in your asterisk, it has been tested that astercc could catch as much as 240 simultaneous calls.
astercc daemon could be download from http://sourceforge.net/project/showfile ... _id=202441, if you only want to get the calls information, you just need astercc and astercc.conf in directory daemon in the package







