Skip to content

Missing stream() method in VoiceResponse class despite Stream class being present #884

@cferrer333

Description

@cferrer333

Description

The VoiceResponse class is missing the stream() helper method to add TwiML elements, even though the Voice\Stream class exists in the SDK.

Current Behavior

The stream() method is not available in Twilio\TwiML\VoiceResponse, despite:

  • The Voice\Stream class existing at /src/Twilio/TwiML/Voice/Stream.php
  • Other TwiML verbs (dial, say, play, etc.) having corresponding helper methods
  • Stream being a documented TwiML verb in Twilio's official documentation

Affected File: src/Twilio/TwiML/VoiceResponse.php

SDK Version: 8.8.4 (and earlier versions back to at least 6.44.4)

Expected Behavior

The VoiceResponse class should include a stream() method similar to other TwiML verb methods:

/**

  • Add Stream child.
  • @param array $attributes Optional attributes
  • @return Voice\Stream Child element.
    */
    public function stream($attributes = []): Voice\Stream {
    return $this->nest(new Voice\Stream($attributes));
    }

Workaround

Currently, developers must either:

  1. Manually patch the vendor file (not recommended, gets overwritten on updates)
  2. Use the Voice\Stream class directly with nest() instead of a helper method

Steps to Reproduce

  1. Install twilio/sdk version 8.8.4 (or any recent version)
  2. Attempt to use $response->stream() on a VoiceResponse instance
  3. Observe that the method doesn't exist

Additional Context

This appears to be a code generation issue, as the Stream class exists but wasn't added to the VoiceResponse method list. Other similar TwiML verbs like connect(), dial(), gather(), start(), and refer() all have
corresponding helper methods.

According to https://www.twilio.com/docs/voice/twiml/stream, is a valid voice TwiML verb and should be accessible via the standard API pattern.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions