Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twilio\TwiML\Voice\Dial::setAnswerOnBridge and other XML boolean attributes should be rendered as strings "true" and "false" #791

Open
stevebauman opened this issue Jan 19, 2024 · 0 comments

Comments

@stevebauman
Copy link

stevebauman commented Jan 19, 2024

Issue Summary

We've been instructed by your support that the XML attribute (and all other boolean attributes on TwiML verbs) should be output in XML content as "true" and "false", not as 1 and 0, as your PHP API suggests inside of its doc blocks when using the suggested bool types:

Screenshot_2024-01-19_at_12_06_27_PM

Code Snippet

This behaviour occurs when you pass a PHP boolean into your PHP API in any of the verb functions:

/**
* Add AnswerOnBridge attribute.
*
* @param bool $answerOnBridge Preserve the ringing behavior of the inbound
* call until the Dialed call picks up
*/
public function setAnswerOnBridge($answerOnBridge): self {
return $this->setAttribute('answerOnBridge', $answerOnBridge);
}

use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();

$dial = $response->dial('...');

$dial->setAnswerOnBridge(true);

Output:

<?xml version="1.0"?>
<Response>
  <Dial answerOnBridge="1" ...>
    <Number>+15552345678</Number>
  </Dial>
</Response>

Technical details:

  • twilio-php version: 6.44.4
  • php version: 8.2.14

Can you please confirm whether this is actually the case whether or not this matters on your backend? If so, these doc blocks should all be adjusted, or have the boolean values be casted to raw strings automatically prior to being output in the XML.

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

No branches or pull requests

1 participant