diff --git a/src/RingCentral.php b/src/RingCentral.php index 4e4d7ba..8530712 100644 --- a/src/RingCentral.php +++ b/src/RingCentral.php @@ -189,7 +189,7 @@ protected function getMessages(string $extensionId, ?Carbon $fromDate = null, ?C 'perPage' => $perPage, ]; if ($fromDate) { - $dtat['dateFrom'] = $fromDate->toIso8601String(); + $data['dateFrom'] = $fromDate->toIso8601String(); } if ($toDate) { $data['dateTo'] = $toDate->toIso8601String(); @@ -210,12 +210,7 @@ public function getMessageAttachmentById(string $extensionId, string $messageId, return $this->get('/account/~/extension/'.$extensionId.'/message-store/'.$messageId.'/content/'.$attachementId); } - public function getCallLog(string $id): Collection { - $r = $this->get("/account/~/call-log/{$id}"); - return $r->collect(); - } - - public function getCallLogs(?Carbon $fromDate = null, ?Carbon $toDate = null, bool $withRecording = true, ?int $perPage = 100): Collection { + public function getCallLogs(?Carbon $fromDate = null, ?Carbon $toDate = null, bool $withRecording = true, ?int $perPage = 100, ?string $sessionId = null): Collection { $data = [ 'type' => 'Voice', 'perPage' => $perPage, @@ -224,10 +219,13 @@ public function getCallLogs(?Carbon $fromDate = null, ?Carbon $toDate = null, bo $data['dateFrom'] = $fromDate->toIso8601String(); } if ($toDate) { - $dtat['dateTo'] = $toDate->toIso8601String(); + $data['dateTo'] = $toDate->toIso8601String(); } if ($withRecording) { - $dtat['recordingType'] = 'All'; + $data['recordingType'] = 'All'; + } + if ($sessionId) { + $data['sessionId'] = $sessionId; } $r = $this->get('/account/~/call-log', $data); return $r->collect('records'); @@ -242,10 +240,10 @@ public function getCallLogsForExtensionId(string $extensionId, ?Carbon $fromDate $data['dateFrom'] = $fromDate->toIso8601String(); } if ($toDate) { - $dtat['dateTo'] = $toDate->toIso8601String(); + $data['dateTo'] = $toDate->toIso8601String(); } if ($withRecording) { - $dtat['recordingType'] = 'All'; + $data['recordingType'] = 'All'; } $r = $this->get('/account/~/extension/'.$extensionId.'/call-log', $data); return $r->collect('records');