For comparison and contrast: We handle this in PostgreSQL by having
Kamailio write to the 'acc' table, and adding triggers that operate on
'acc' events and populate or update another table, 'cdr', with actual
CDRs in the desirable one-row-per-call way.
The advantage to doing it that way versus in route script is that it's
transactional in nature; an error will result in all the cascading
queries being rolled back. It also makes it much easier to insinuate
business layer stuff into the cascade, or extend the trigger cascade
with additional logic, because PL/PgSQL provides certain features of a
general-purpose programming environment that Kamailio does not, given
its domain specificity.
It also eliminates unnecessary data interchange between the Kamailio
process and the RDBM, given that most of the work is done in the
database itself, causing additional latency and being a possible
source of data corruption.
In short, it lets us have a relatively clean Kamailio config and
deputise all the business layer stuff to the database backend in a
very hierarchical, maintainable way. That way, the Kamailio route
script can stick to doing what it does best: operating on SIP messages.
--
Alex Balashov - Principal
Evariste Systems LLC
1170 Peachtree Street
12th Floor, Suite 1200
Atlanta, GA 30309
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web:
http://www.evaristesys.com/