From 33c5137f52dd7e3b8c7f355ff16420a720bba6be Mon Sep 17 00:00:00 2001 From: Cameron Koegel Date: Wed, 27 Oct 2021 13:58:15 -0400 Subject: [PATCH 1/3] DX-2284 Updated Ring Verb --- src/Voice/Bxml/Ring.php | 15 ++++++++++++++- tests/BxmlTest.php | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Voice/Bxml/Ring.php b/src/Voice/Bxml/Ring.php index 0f39db7..6e8f320 100644 --- a/src/Voice/Bxml/Ring.php +++ b/src/Voice/Bxml/Ring.php @@ -16,12 +16,21 @@ class Ring extends Verb { /** * Sets the duration attribute for Ring * - * @param float $duration The duration in seconds for the ring + * @param float $duration The duration in seconds for the ring */ public function duration($duration) { $this->duration = $duration; } + /** + * Sets the answerCall attribute for Ring + * + * @param boolean $answerCall Determines whether or not to answer the call when Ring is executed on an unanswered incoming call + */ + public function answerCall($answerCall) { + $this->answerCall = $answerCall; + } + public function toBxml($doc) { $element = $doc->createElement("Ring"); @@ -29,6 +38,10 @@ public function toBxml($doc) { $element->setAttribute("duration", $this->duration); } + if(isset($this->answerCall)) { + $element->setAttribute("answerCall", $this->answerCall); + } + return $element; } } diff --git a/tests/BxmlTest.php b/tests/BxmlTest.php index c154d80..c1f0e49 100644 --- a/tests/BxmlTest.php +++ b/tests/BxmlTest.php @@ -370,11 +370,12 @@ public function testBridge() { public function testRing() { $ring = new BandwidthLib\Voice\Bxml\Ring(); $ring->duration(5); + $ring->answerCall(false); $response = new BandwidthLib\Voice\Bxml\Response(); $response->addVerb($ring); - $expectedXml = ''; + $expectedXml = ''; $responseXml = $response->toBxml(); $this->assertEquals($expectedXml, $responseXml); } From 00c5b99449f57c5aed37aa853f4775da7c10cf15 Mon Sep 17 00:00:00 2001 From: Cameron Koegel Date: Wed, 27 Oct 2021 14:03:48 -0400 Subject: [PATCH 2/3] changed answerCall to string --- tests/BxmlTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/BxmlTest.php b/tests/BxmlTest.php index c1f0e49..888dd63 100644 --- a/tests/BxmlTest.php +++ b/tests/BxmlTest.php @@ -370,7 +370,7 @@ public function testBridge() { public function testRing() { $ring = new BandwidthLib\Voice\Bxml\Ring(); $ring->duration(5); - $ring->answerCall(false); + $ring->answerCall("false"); $response = new BandwidthLib\Voice\Bxml\Response(); $response->addVerb($ring); From ca9d7831478cc83876000ea1a682cd5872f0daec Mon Sep 17 00:00:00 2001 From: Cameron Koegel Date: Thu, 28 Oct 2021 09:26:58 -0400 Subject: [PATCH 3/3] updated ring answerCall to accept boolean --- src/Voice/Bxml/Ring.php | 6 +++++- tests/BxmlTest.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Voice/Bxml/Ring.php b/src/Voice/Bxml/Ring.php index 6e8f320..01bc62d 100644 --- a/src/Voice/Bxml/Ring.php +++ b/src/Voice/Bxml/Ring.php @@ -39,7 +39,11 @@ public function toBxml($doc) { } if(isset($this->answerCall)) { - $element->setAttribute("answerCall", $this->answerCall); + if ($this->answerCall) { + $element->setattribute("answerCall", "true"); + } else { + $element->setattribute("answerCall", "false"); + } } return $element; diff --git a/tests/BxmlTest.php b/tests/BxmlTest.php index 888dd63..c1f0e49 100644 --- a/tests/BxmlTest.php +++ b/tests/BxmlTest.php @@ -370,7 +370,7 @@ public function testBridge() { public function testRing() { $ring = new BandwidthLib\Voice\Bxml\Ring(); $ring->duration(5); - $ring->answerCall("false"); + $ring->answerCall(false); $response = new BandwidthLib\Voice\Bxml\Response(); $response->addVerb($ring);