Skip to content

Commit

Permalink
Take out the default for record NCCO. API behaviour is changed if you…
Browse files Browse the repository at this point in the history
… specify the time, developers need choice on whether to set it (#493)
  • Loading branch information
SecondeJK authored Aug 9, 2024
1 parent 89365d5 commit eb73c22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/Voice/NCCO/Action/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,7 @@ class Record implements ActionInterface
*/
protected $endOnKey;

/**
* @var int
*/
protected $timeOut = 7200;
protected ?int $timeOut = null;

/**
* @var bool
Expand Down Expand Up @@ -126,7 +123,6 @@ public function toNCCOArray(): array
$data = [
'action' => 'record',
'format' => $this->getFormat(),
'timeOut' => (string)$this->getTimeout(),
'beepStart' => $this->getBeepStart() ? 'true' : 'false',
];

Expand All @@ -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();
Expand Down Expand Up @@ -243,7 +243,7 @@ public function setEndOnSilence(int $endOnSilence): self
return $this;
}

public function getTimeout(): int
public function getTimeout(): ?int
{
return $this->timeOut;
}
Expand Down
1 change: 0 additions & 1 deletion test/Voice/NCCO/Action/RecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public function testJsonSerializeLooksCorrect(): void
$this->assertSame([
'action' => 'record',
'format' => 'mp3',
'timeOut' => '7200',
'beepStart' => 'false'
], (new Record())->jsonSerialize());
}
Expand Down

0 comments on commit eb73c22

Please sign in to comment.