From eb73c220f46b1ecb6738ce4245128c17d28a01bc Mon Sep 17 00:00:00 2001 From: James Seconde Date: Fri, 9 Aug 2024 12:08:29 +0100 Subject: [PATCH] Take out the default for record NCCO. API behaviour is changed if you specify the time, developers need choice on whether to set it (#493) --- src/Voice/NCCO/Action/Record.php | 12 ++++++------ test/Voice/NCCO/Action/RecordTest.php | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Voice/NCCO/Action/Record.php b/src/Voice/NCCO/Action/Record.php index 223da901..23cf690c 100644 --- a/src/Voice/NCCO/Action/Record.php +++ b/src/Voice/NCCO/Action/Record.php @@ -43,10 +43,7 @@ class Record implements ActionInterface */ protected $endOnKey; - /** - * @var int - */ - protected $timeOut = 7200; + protected ?int $timeOut = null; /** * @var bool @@ -126,7 +123,6 @@ public function toNCCOArray(): array $data = [ 'action' => 'record', 'format' => $this->getFormat(), - 'timeOut' => (string)$this->getTimeout(), 'beepStart' => $this->getBeepStart() ? 'true' : 'false', ]; @@ -146,6 +142,10 @@ public function toNCCOArray(): array $data['split'] = $this->getSplit(); } + if ($this->getTimeout()) { + $data['timeOut'] = (string)$this->getTimeout(); + } + if ($this->getEventWebhook()) { $data['eventUrl'] = [$this->getEventWebhook()->getUrl()]; $data['eventMethod'] = $this->getEventWebhook()->getMethod(); @@ -243,7 +243,7 @@ public function setEndOnSilence(int $endOnSilence): self return $this; } - public function getTimeout(): int + public function getTimeout(): ?int { return $this->timeOut; } diff --git a/test/Voice/NCCO/Action/RecordTest.php b/test/Voice/NCCO/Action/RecordTest.php index 7862a7c7..06a6c73d 100644 --- a/test/Voice/NCCO/Action/RecordTest.php +++ b/test/Voice/NCCO/Action/RecordTest.php @@ -26,7 +26,6 @@ public function testJsonSerializeLooksCorrect(): void $this->assertSame([ 'action' => 'record', 'format' => 'mp3', - 'timeOut' => '7200', 'beepStart' => 'false' ], (new Record())->jsonSerialize()); }