openclaw - 💡(How to fix) Fix [voice-call] maxS2SRuntimeMs: limit cumulative S2S active time, not wall-clock call duration [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#56177Fetched 2026-04-08 01:44:06
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
closed ×1commented ×1locked ×1
RAW_BUFFERClick to expand / collapse

Currently maxDurationSeconds kills the entire call at a wall-clock limit. A 40-minute hold queue would get terminated. The meaningful limit is cumulative S2S WebSocket open time (= actual billing, = unproductive conversation).

Design:

  • maxDurationSeconds: raise to 7200 (zombie-call safety net only)
  • maxS2SRuntimeMs: new config field; tracks cumulative S2S open time, paused during hold, resumes on reconnect
  • Default: 600,000 ms (10 min of actual conversation)
  • When exceeded: bot says goodbye and ends call gracefully

Where to implement:

  • Track in OpenAIRealtimeS2SSession: start timer on connect(), stop/accumulate on close()/pauseForHold()
  • Expose getTotalS2SRuntimeMs() method
  • In webhook.ts: check runtime after each resumeFromHold(), end call gracefully if exceeded

extent analysis

Fix Plan

To implement the new maxS2SRuntimeMs config field and track cumulative S2S open time, follow these steps:

  • Update the OpenAIRealtimeS2SSession class:
    • Add a startTimer method to track the cumulative S2S open time when connect() is called.
    • Add a stopAndAccumulate method to pause the timer when close() or pauseForHold() is called.
    • Implement the getTotalS2SRuntimeMs() method to return the total S2S runtime.
  • Update the webhook.ts file:
    • Check the S2S runtime after each resumeFromHold() call.
    • End the call gracefully if the maxS2SRuntimeMs limit is exceeded.

Example Code

// OpenAIRealtimeS2SSession class
private s2sRuntimeMs: number = 0;
private timer: NodeJS.Timeout;

connect(): void {
  this.timer = setInterval(() => {
    this.s2sRuntimeMs += 1000; // increment by 1 second
  }, 1000);
}

close(): void {
  clearInterval(this.timer);
}

pauseForHold(): void {
  clearInterval(this.timer);
}

resumeFromHold(): void {
  this.timer = setInterval(() => {
    this.s2sRuntimeMs += 1000; // increment by 1 second
  }, 1000);
}

getTotalS2SRuntimeMs(): number {
  return this.s2sRuntimeMs;
}

// webhook.ts
const maxS2SRuntimeMs = 600000; // 10 minutes

resumeFromHold(): void {
  const s2sSession = new OpenAIRealtimeS2SSession();
  const totalS2SRuntimeMs = s2sSession.getTotalS2SRuntimeMs();
  if (totalS2SRuntimeMs > maxS2SRuntimeMs) {
    // end call gracefully
    console.log('Max S2S runtime exceeded. Ending call.');
    // add call termination logic here
  }
}

Verification

To verify the fix, test the following scenarios:

  • A call that exceeds the maxS2SRuntimeMs limit should end gracefully.
  • A call that is put on hold and then resumed should not increment the S2S runtime while on hold.
  • A call that is terminated due to exceeding the maxS2SRuntimeMs limit should log a message indicating the reason for termination.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [voice-call] maxS2SRuntimeMs: limit cumulative S2S active time, not wall-clock call duration [1 comments, 1 participants]