Skip to content

[mod_cdr_pg_csv] optionally honor force_process_cdr for B-leg CDRs#3063

Open
realsama wants to merge 1 commit into
signalwire:masterfrom
realsama:mod_cdr_pg_csv-honor-force-process-cdr
Open

[mod_cdr_pg_csv] optionally honor force_process_cdr for B-leg CDRs#3063
realsama wants to merge 1 commit into
signalwire:masterfrom
realsama:mod_cdr_pg_csv-honor-force-process-cdr

Conversation

@realsama

@realsama realsama commented Jul 1, 2026

Copy link
Copy Markdown

Description

mod_cdr_pg_csv chooses which legs to log solely from the global legs setting
(a | b | ab); there is no per-call override. With the default legs=a, the
B-leg of a bridged call (e.g. an outbound bridge / <Dial>) never produces a CDR
and cannot be billed from the pg_csv record, even when the application deliberately
wants it recorded.

mod_json_cdr and mod_format_cdr already handle this via the standard
force_process_cdr channel variable (SWITCH_FORCE_PROCESS_CDR_VARIABLE), reported
regardless of the leg filter. mod_cdr_pg_csv had no equivalent.

This adds an opt-in honor-force-process-cdr setting (default off). When
enabled, a B-leg whose force_process_cdr variable is set is logged even if the
legs filter would otherwise skip it. Enable in cdr_pg_csv.conf.xml:

<param name="honor-force-process-cdr" value="true" />

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Code cleanup / refactor

Related Issues

None.

Testing

Built against master. The same change (on a 1.10.12 base) is running in production:
with the setting on and a bridged B-leg exporting force_process_cdr=true, the dialed
leg now produces its own cdr row; with it off, output is identical to current behaviour.

  • Added/updated unit tests
  • Tested manually
  • Tested with live SignalWire credentials (if applicable)

Checklist

  • I have read the CONTRIBUTING guidelines
  • My code follows the project's style guidelines
  • I have added tests for my changes (if applicable)
  • I have updated documentation (if applicable)
  • All existing tests pass

mod_cdr_pg_csv chooses which legs to log solely from the global `legs`
setting (a|b|ab); there is no per-call override. With the default legs=a,
the B-leg of a bridged call never produces a CDR and cannot be billed from
the pg_csv record, even when the application deliberately wants it.

Add an opt-in `honor-force-process-cdr` setting (default off). When enabled,
a B-leg whose force_process_cdr channel variable is set is logged regardless
of the legs filter, mirroring the existing SWITCH_FORCE_PROCESS_CDR_VARIABLE
handling in mod_json_cdr and mod_format_cdr.

Default off, so existing behaviour is unchanged.
@realsama

realsama commented Jul 2, 2026

Copy link
Copy Markdown
Author

Hi @andywolk could you please take a quick look at this one file PR when you get a chance? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant