feat: add configurable Call-ID generators#869
Conversation
|
Follow-up on the GitHub Advanced Security note: the latest commit ( The current GitHub Actions runs show |
There was a problem hiding this comment.
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_typeoption 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.
| int count = 0; | ||
|
|
||
| while (*src && count < MAX_HEADER_LEN - 1) { | ||
| if (*src == '%') { |
| {"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}, |
|
Since you already refactor, please C++-ify it. Make it a class, and use std::ostringstream instead of a bunch of static functions. |
|
Thanks for the review done in |
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:
What is not included: