-
Notifications
You must be signed in to change notification settings - Fork 582
Description
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:
- Manually patch the vendor file (not recommended, gets overwritten on updates)
- Use the Voice\Stream class directly with nest() instead of a helper method
Steps to Reproduce
- Install twilio/sdk version 8.8.4 (or any recent version)
- Attempt to use $response->stream() on a VoiceResponse instance
- 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.