CDR Replacement With CEL

Home » Asterisk Users » CDR Replacement With CEL
Asterisk Users No Comments

hi,

i’m trying replace CDR with CEL

reasons:

– minimize Stasis listeners (CDR)

– CEL, CDR produces “similar” data

– own logic of CDR meaning like “calldate,src,dst,direction,..” dst is always first connected point in PBX – real user or IVR/queue etc., numbers are only attributes of object “user”

do you have any tips/logic/comments for this goal?

my custom cdr table

CREATE TABLE `cdr` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL COMMENT ‘user id’,
`tenant_id` int(11) NOT NULL COMMENT ‘tenant id’,
`calldate` datetime NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
`clid` varchar(80) NOT NULL DEFAULT ”,
`src` varchar(80) NOT NULL DEFAULT ”,
`dst` varchar(80) NOT NULL DEFAULT ”,
`duration` int(11) NOT NULL DEFAULT ‘0’,
`billsec` int(11) NOT NULL DEFAULT ‘0’,
`disposition` varchar(45) NOT NULL DEFAULT ” COMMENT ‘asterisk hangup cause’,
`way` enum(‘loc’,’in’,’out’) NOT NULL DEFAULT ‘loc’ COMMENT ‘call direction (loc – local, in – incoming, out – outgoing)’,
`trunk` varchar(80) NOT NULL COMMENT ‘used SIP trunk’,
`hangupcause` varchar(10) NOT NULL COMMENT ‘hangup cause’,
`hangupside` varchar(10) NOT NULL COMMENT ‘hangup on which side’,
`uniqueid` varchar(64) NOT NULL DEFAULT ”,
`linkedid` varchar(64) NOT NULL,
`data` json NOT NULL COMMENT ‘metadata’,
`stamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT ‘creation date’,
PRIMARY KEY (`id`),
KEY `dst` (`dst`),
KEY `uniqueid` (`uniqueid`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CEL pairing for simple call scenario

user_id = own variable (from cel userfield or CELGenUserEvent app)
tenant_id = own variable (from cel accountcode or CELGenUserEvent app)
calldate = eventtime src = cid_num dst = exten duration = eventtime(event HANGUP) – eventtime(eventtype BRIDGE_ENTER) (no eventtype PICKUP,FORWARD,*TRANSFER) (or howto identify event RINGING?)
billsec = eventtime(event HANGUP) – eventtime(eventtype ANSWER) (no eventtype PICKUP,FORWARD,*TRANSFER)
way = own variable (CELGenUserEvent app)
disposition = extra: {“hangupcause”:16,”hangupsource”:”SIP/siptrunk-00000a80″,”dialstatus”:”ANSWER”}
trunk = own variable (CELGenUserEvent app)
hangupcause = extra: {“hangupcause”:16,”hangupsource”:”SIP/siptrunk-00000a80″,”dialstatus”:”ANSWER”}
hangupside = ???