Skip to content

Add paused and wrapupTime fields to static member config lines#1

Merged
filip3oliveira merged 4 commits into
masterfrom
add-paused-wrapuptime-fields
Jul 21, 2026
Merged

Add paused and wrapupTime fields to static member config lines#1
filip3oliveira merged 4 commits into
masterfrom
add-paused-wrapuptime-fields

Conversation

@filip3oliveira

Copy link
Copy Markdown
Contributor

Why

Core (clearvox/core) is reverting linear-strategy queue ring order from a penalty encoding to ordered flat-file member => lines (see core#3488). Those lines bypass Asterisk's realtime queue_members table entirely for linear queues, which is where the member's paused state used to be written from.

Asterisk's static member line supports paused as an optional positional field (after ringinuse and wrapuptime), but this Member value object had no way to set it.

What changed

  • Added $wrapupTime and $paused constructor params + getters/setters to Member.
  • Extended toString() to emit them as the correct trailing positional fields, following the existing cascading-null pattern (a later field forces every field before it to be emitted, even empty, to keep position). Existing 5-field behavior is unchanged when the new fields are left unset.
  • Field order (matches Asterisk's reload_single_member() parsing): interface,penalty,membername,state_interface,ringinuse,wrapuptime,paused.

Tests

Extended MemberTest: paused-only, paused-false, and all-7-fields cases. Also hand-verified the exact output strings by running the class directly under PHP 8.2 (this package's PHPUnit ~4.0 doesn't run there) — all match expected Asterisk config syntax.

Asterisk's member => line accepts these as the 6th/7th positional
fields after ringinuse. Needed by core so linear-strategy static
members (delivered as flat-file lines, not realtime queue_members
rows) can still carry their paused state.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the Clearvox\Asterisk\Queue\Member value object to support emitting Asterisk static queue member config lines with the additional trailing positional fields wrapuptime and paused, enabling linear-strategy queues to preserve member pause state without relying on realtime DB tables.

Changes:

  • Added wrapupTime and paused properties plus constructor params and accessors on Member.
  • Updated Member::toString() to output up to 7 positional fields (interface,penalty,membername,state_interface,ringinuse,wrapuptime,paused) using cascading null placeholders to preserve field positions.
  • Extended MemberTest with additional toString() assertions for paused-related output.

Reviewed changes

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

File Description
src/Clearvox/Asterisk/Queue/Member.php Adds wrapupTime/paused support and extends toString() to emit correct positional fields for Asterisk static member lines.
tests/Clearvox/Asterisk/Queue/MemberTest.php Adds test cases validating the new paused output and the full 7-field serialization.

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

Comment thread src/Clearvox/Asterisk/Queue/Member.php
Comment thread tests/Clearvox/Asterisk/Queue/MemberTest.php
setPaused() cast every input to bool, so setPaused(null) silently
became setPaused(false) instead of unsetting the field like the
constructor's $paused = null does. Also adds the wrapupTime-only
cascading-null case flagged as untested.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comment thread src/Clearvox/Asterisk/Queue/Member.php
Comment thread src/Clearvox/Asterisk/Queue/Member.php
Comment thread src/Clearvox/Asterisk/Queue/Member.php
Comment thread src/Clearvox/Asterisk/Queue/Member.php
Comment thread src/Clearvox/Asterisk/Queue/Member.php
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread src/Clearvox/Asterisk/Queue/Member.php Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

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

Comments suppressed due to low confidence (1)

src/Clearvox/Asterisk/Queue/Member.php:151

  • setWrapupTime() assigns the raw input to $this->wrapupTime, which can diverge from the constructor’s behavior (constructor casts non-null to int). This makes getWrapupTime()/toString() potentially return/emit non-integers despite the @param/@return docs stating int|null. Consider mirroring the constructor logic by casting non-null values to int (and preserving null to unset).
    public function setWrapupTime($wrapupTime)
    {
        $this->wrapupTime = $wrapupTime;
        return $this;

@filip3oliveira
filip3oliveira merged commit 9884a23 into master Jul 21, 2026
1 check passed
@filip3oliveira
filip3oliveira deleted the add-paused-wrapuptime-fields branch July 21, 2026 13:11
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.

2 participants