How to correlate 3-way call?

My typical use case for FreePBX is as follows:

  1. A Caller calls into the main DID number for my FreePBX instance
  2. An IVR answers with a menu to select from one of several queues
  3. Caller select a queue
  4. An agent from selected queue answers
  5. Caller gives the agent a number (for target Callee) to dial and add to the existing call
  6. Agent dials Callee number given, when number is answered, agent merges the new call to the existing call making it a 3-party call (Caller, Agent, Callee)
  7. After talking for some time agent hangs up. I am assuming this will end calls to original Caller as well as the Callee called by agent (please confirm)

I need to be able to correlate:

  1. the original call from original Caller to agent
  2. with the second call added by agent to the Callee.

Looking at both CDR and CEL reports I see no way to correlate the two calls.

Here is an example from CEL log:

Date Caller Dialed Duration Play Details
Fri, Jan 6, 2023 2:50 PM Agent extension Callee number 5 - show
Fri, Jan 6, 2023 2:50 PM Caller number DID number 96 - show

Here is the same call log from CDR:

Call Date Recording System CallerID Outbound CallerID DID App Destination Disposition Duration Userfield Account CDR Table CDR Graph
Fri, 6 Jan 2023 14:51 1673034667.142 Agent extension Dial Callee number ANSWERED 00:28
Fri, 6 Jan 2023 14:50 1673034605.138 “Operator:Caller number” Dial Agent extension ANSWERED 01:30
Fri, 6 Jan 2023 14:50 1673034601.136 Caller number DID number Queue 3000 ANSWERED 01:35

Is there a CORRELATION ID that can be somehow assigned and available in the CEL or CDR log? Also, am I better of using CDR or CEL log for my custom report? Seems CEL is better because it exports JSON but CDR is better because it has more granular data.

Lastly, can anyone guide me as to how to access the CEL or CDR report via an API call. The aternative would be to export the CDR or CEL report via GUI and then feed the CSV or JSON file to my custom report builder. I am hoping there is a better way to source the CDR/CEL data. TIA.

The 3-party call happens on the endpoint, it is not something Asterisk (and thus FreePBX) is aware of. You can only guess/assume that it has happened from our side.

Thank @jcolp if you see my updated post with CEL example log it seems that the second call from Agent to Callee is indeed something that asterisk is aware off. What seems to be missing is some way to correlate the two reliably. Am I mistaken in this?

If you are not bridging the call within the phone, LinkedID is intended to fulfil that purpose. It looks like FreePBX may not capture all the fields logged.

Asterisk generally tries to push call logging out of the system, as most people want to ensure that is captured, rather than read it at their own leisure.

It’s aware of the calls - but it’s not aware of what the phone is doing with them such as conferencing them together on the phone.

@jcolp super helpful. Thanks.

The Introduction in the CDR link you shared clearly describes the very problem I am having with multi-party calls and correlating them.

Seems if I can somehow bridge the calls within asterisk then I will have a LinkID as my CORRELATION ID. I am assuming this requires that the Callee phone number is dialed by the caller in response to an IVR prompt (rather than manually by the agent) and then somehow the call is bridged with Asterisk. This would be much better for my scenario. Any pointers on how to accomplish such a asterisk initiated bridging with my IVR would be really helpful. Thanks again for your superb help.