CDR for b_leg when incoming call is forwarded


Dec 14, 2020
By default, when there is a incoming call and the call is forwarded to another outside number, fusion will combine both legs of the call into 1 CDR record and the direction will be outbound even though it is originally a inbound call, because this was applied later, at the stage when the call was forwarded to the outside number.

The only situation where this will not be the case is when the call comes in to a ring group and the ring group destination is a outside number, in that case there will be 2 CDR records, 1 for the inbound call and a 2nd for the outbound call, both CDR records will have the correct info for the "caller destination", the "destination" and for the "direction". (this will also be the case when the call is forwarded to another outside number using follow me).

I want to have this behavior for every scenario when a call comes in and is forwarded to another number, be it outbound destination, call transfer, call forward, DISA etc.

I tried setting log-b-leg to true in autoload_configs/xml_cdr.conf.xml and in default settings I enabled b_leg for inbound and outbound, I got 2 CDR records, but the record for the a_leg has the same direction as the b_leg instead of the a_leg being inbound. and the b_leg:
- caller_destination is empty
- destination is the original caller id of the number that placed the incoming call instead of being the number where the call was forwarded to.
- the domain and account code is empty in the database

How can get for every incoming call that is being forwarded to a outside number, 2 CDR records, with the correct caller_destination, destination and direction?