Skip to content

feat: add configurable Call-ID generators#869

Open
darwvin-dev wants to merge 3 commits into
SIPp:masterfrom
darwvin-dev:split-call-id-generators
Open

feat: add configurable Call-ID generators#869
darwvin-dev wants to merge 3 commits into
SIPp:masterfrom
darwvin-dev:split-call-id-generators

Conversation

@darwvin-dev
Copy link
Copy Markdown

@darwvin-dev darwvin-dev commented May 23, 2026

Summary:
Add a new -cid_type option for built-in Call-ID generators while keeping -cid_str as the default behavior. This adds UUID, compact UUID, random, and timestamp-based Call-ID modes, along with unit coverage for each mode.

Reasoning:
-cid_str is flexible and should remain the default, but it still assumes callers want to describe the Call-ID shape as a formatting pattern. In practice there are cases where a ready-made generator is more convenient or more consistent: interoperability testing against systems that expect UUID-like identifiers, quickly switching between predictable and opaque identifiers during troubleshooting, and avoiding repeated hand-built templates for common styles.

This change keeps backward compatibility by leaving -cid_str and the legacy formatting path untouched unless -cid_type is explicitly selected. The new modes provide a small set of built-in generators that cover the common cases without removing the existing customization path.

What is included:

  • New -cid_type CLI option.
  • Built-in default, uuid, uuid-compact, random, and timestamp generator modes.
  • Existing -cid_str behavior retained as the default path.
  • Unit coverage for each mode.

What is not included:

  • No startup wizard behavior. That is split into a separate PR for review on its own merits.

Comment thread src/sipp.cpp Fixed
@darwvin-dev
Copy link
Copy Markdown
Author

Follow-up on the GitHub Advanced Security note: the latest commit (ec7ff64) removes the custom loop-counter option parser path and reuses the existing string option parsing path, then validates -cid_type after option parsing.

The current GitHub Actions runs show action_required rather than executing jobs, so I cannot get a fresh hosted CI result until a maintainer approves the workflows for this PR.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new -cid_type CLI option to select built-in Call-ID generator modes (while preserving -cid_str as the default/legacy formatting path), and introduces unit tests validating the generated Call-ID shapes.

Changes:

  • Added -cid_type option parsing with supported Call-ID modes (default/format, uuid, uuid-compact, random, timestamp).
  • Refactored Call-ID construction into dedicated helper functions and added new generator implementations.
  • Added unit tests covering each Call-ID generation mode.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/sipp.cpp Adds -cid_type option, parses/validates the selected Call-ID mode.
src/call.cpp Implements the new Call-ID generators, routes call creation through the selected mode, and adds unit tests.
include/sipp.hpp Introduces CID_MODE_* constants and a global call_id_mode setting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/call.cpp Outdated
int count = 0;

while (*src && count < MAX_HEADER_LEN - 1) {
if (*src == '%') {
Comment thread src/sipp.cpp Outdated
{"aa", "Enable automatic 200 OK answer for INFO, NOTIFY, OPTIONS and UPDATE.", SIPP_OPTION_SETFLAG, &auto_answer, 1},
{"base_cseq", "Start value of [cseq] for each call.", SIPP_OPTION_CSEQ, nullptr, 1},
{"cid_str", "Call ID string (default %u-%p@%s). %u=call_number, %s=ip_address, %p=process_number, %r=random_integer, %%=% (in any order).", SIPP_OPTION_STRING, &call_id_string, 1},
{"cid_type", "Call ID generation mode. Values: default, uuid, uuid-compact, random, timestamp. Modes other than default ignore -cid_str.", SIPP_OPTION_STRING, &call_id_mode_string, 1},
@orgads
Copy link
Copy Markdown
Contributor

orgads commented May 26, 2026

Since you already refactor, please C++-ify it. Make it a class, and use std::ostringstream instead of a bunch of static functions.

@darwvin-dev
Copy link
Copy Markdown
Author

Thanks for the review done in 221dbb9: Call-ID generation is now handled by a CallIdBuilder class using std::ostringstream btw fixed the trailing % edge case and updated the -cid_type help text to match the accepted aliases.

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.

4 participants