Hi Ross, I'm doing something similar, with the xml_curl module and php, but I use both legs. It's probably a lot more complicated than it could be, but it suits our purpose. We are doing PBX hosting, so we get situations where an inbound call is transferred twice, then gets transferred back out to a cell phone on another trunk, or an outbound call is then transferred to a different external extension. I also want to try for 1 entry per call where practical. Problem is, it isn't always practical. I capture both legs. If it's a b-leg, some processing is done to extract useful information, and it is entered into the blegs table. When an a-leg is processed, a short timer elapses (to allow any accompanying b-legs to be inserted), before a query is done to retrieve all the b-legs that go with the call (match on uuid of a-leg). If there is only an a-leg, or an a-leg and one b-leg, the values are combined and a single entry is made into the cdr table. Some filtering is done in the b-leg query to discard dead legs of a ring group and so on. If there are multiple b-legs, the a-leg is recorded more or less as-is, and the b-legs are also recorded, with matching uuids to tie them together. When we run our bills, calls with multiple entries appear as a nested row. This keeps things simple, but still allows for accurate records when a call takes multiple hops. It's handy to be able to look at the phone bill and see which calls are being passed around an office. It also allows us to bill things accurately in a metered-usage scenario. -Tim Ross McKillop wrote:
Hi,
I'm curious how others handle CDRs from FreeSWITCH. I need them to end up in a MySQL database and the easiest way I've found of achieving this is to use the mod_xml_cdr module to call a PHP script that inserts the row. Is there a preferred way of achieving this?