onHoldUnholdPressed method

void onHoldUnholdPressed()

Either places the call on hold, or unholds the call based on the current hold state.

State Management via CallHandler:

  • Uses callHandler.changeState() as the single source of truth for state transitions
  • When unholding: Sets state to CallState.active
  • When holding: Sets state to CallState.held
  • Ensures proper callback execution and consistency across the SDK

Implementation

void onHoldUnholdPressed() {
  if (onHold) {
    _sendHoldModifier('unhold');
    onHold = false;
    callHandler.changeState(CallState.active);
  } else {
    _sendHoldModifier('hold');
    onHold = true;
    callHandler.changeState(CallState.held);
  }
}