From 309d35da97fc0328af2670d127548ca76bdf3c98 Mon Sep 17 00:00:00 2001 From: Yechiel Date: Sat, 23 Nov 2024 22:48:24 -0500 Subject: [PATCH] saveRecordingById --- src/RingCentral.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/RingCentral.php b/src/RingCentral.php index dff820e..e166f65 100644 --- a/src/RingCentral.php +++ b/src/RingCentral.php @@ -253,6 +253,14 @@ public function saveRecordingById(string $recordingId, string $disk, string $pat return $result ? $path : false; } + public function saveRecordingById(string $recordingId, ?string $disk = null, string $path = ''): string|false { + $response = $this->getRecordingById($recordingId); + $ext = ($response->header('Content-Type') == 'audio/mpeg') ? '.mp3' : '.wav'; + $path = trim($path, '/').'/'.Str::random(2).'/'.Str::random(40).$ext; + $result = Storage::disk($disk)->put($path, $response->body()); + return $result ? $path : false; + } + public function listWebhooks(): Collection { return $this->get('/subscription')->collect('records'); }