diff --git a/src/Voice/Bxml/Ring.php b/src/Voice/Bxml/Ring.php index 0f39db7..01bc62d 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,14 @@ public function toBxml($doc) { $element->setAttribute("duration", $this->duration); } + if(isset($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 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); }