diff --git a/CHANGELOG.md b/CHANGELOG.md index 4394e226..fdd9c7cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Change Log +## [4.42.1](https://github.com/plivo/plivo-php/tree/v4.42.1) (2023-02-28) +-Added Exception handling for Retrieve all Calls API [Retrieve details of all calls](https://www.plivo.com/docs/voice/api/call#retrieve-all-calls) + ## [4.42.0](https://github.com/plivo/plivo-php/tree/v4.42.0) (2023-02-27) **Feature - Enhance MDR filtering capabilities ** - Added new fields on MDR object response diff --git a/src/Plivo/Resources/Call/CallInterface.php b/src/Plivo/Resources/Call/CallInterface.php index e0ed0ae1..b897bfd2 100644 --- a/src/Plivo/Resources/Call/CallInterface.php +++ b/src/Plivo/Resources/Call/CallInterface.php @@ -202,27 +202,28 @@ public function getQueued($queuedCallUuid) * + [string] subaccount - The id of the subaccount, if call details of the subaccount are needed. * + [string] call_direction - Filter the results by call direction. The valid inputs are inbound and outbound. * + [string] from_number - Filter the results by the number from where the call originated. For example:
- To filter out those numbers that contain a particular number sequence, use from_number={sequence}
- To filter out a number that matches an exact number, use from_number={exact_number} + * To filter out those numbers that contain a particular number sequence, use from_number={sequence}
+ * To filter out a number that matches an exact number, use from_number={exact_number} * + [string] to_number - Filter the results by the number to which the call was made. Tips to use this filter are:
- To filter out those numbers that contain a particular number sequence, use to_number={sequence}
- To filter out a number that matches an exact number, use to_number={exact_number} + * To filter out those numbers that contain a particular number sequence, use to_number={sequence}
+ * To filter out a number that matches an exact number, use to_number={exact_number} * + [string] bill_duration - Filter the results according to billed duration. The value of billed duration is in seconds. The filter can be used in one of the following five forms:
- bill_duration: Input the exact value. E.g., to filter out calls that were exactly three minutes long, use bill_duration=180
- bill_duration\__gt: gt stands for greater than. E.g., to filter out calls that were more than two hours in duration bill_duration\__gt=7200
- bill_duration\__gte: gte stands for greater than or equal to. E.g., to filter out calls that were two hours or more in duration bill_duration\__gte=7200
- bill_duration\__lt: lt stands for lesser than. E.g., to filter out calls that were less than seven minutes in duration bill_duration\__lt=420
- bill_duration\__lte: lte stands for lesser than or equal to. E.g., to filter out calls that were two hours or less in duration bill_duration\__lte=7200 + * bill_duration: Input the exact value. E.g., to filter out calls that were exactly three minutes long, use bill_duration=180
+ * bill_duration\__gt: gt stands for greater than. E.g., to filter out calls that were more than two hours in duration bill_duration\__gt=7200
+ * bill_duration\__gte: gte stands for greater than or equal to. E.g., to filter out calls that were two hours or more in duration bill_duration\__gte=7200
+ * bill_duration\__lt: lt stands for lesser than. E.g., to filter out calls that were less than seven minutes in duration bill_duration\__lt=420
+ * bill_duration\__lte: lte stands for lesser than or equal to. E.g., to filter out calls that were two hours or less in duration bill_duration\__lte=7200 * + [string] end_time - Filter out calls according to the time of completion. The filter can be used in the following five forms:
- end_time: The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended at 2012-03-21 11:47[:30], use end_time=2012-03-21 11:47[:30]
- end_time\__gt: gt stands for greater than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after 2012-03-21 11:47, use end_time\__gt=2012-03-21 11:47
- end_time\__gte: gte stands for greater than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after or exactly at 2012-03-21 11:47[:30], use end_time\__gte=2012-03-21 11:47[:30]
- end_time\__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before 2012-03-21 11:47, use end_time\__lt=2012-03-21 11:47
- end_time\__lte: lte stands for lesser than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before or exactly at 2012-03-21 11:47[:30], use end_time\__lte=2012-03-21 11:47[:30] - Note: The above filters can be combined to get calls that ended in a particular time range. The timestamps need to be UTC timestamps. + * end_time: The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended at 2012-03-21 11:47[:30], use end_time=2012-03-21 11:47[:30]
+ * end_time\__gt: gt stands for greater than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after 2012-03-21 11:47, use end_time\__gt=2012-03-21 11:47
+ * end_time\__gte: gte stands for greater than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended after or exactly at 2012-03-21 11:47[:30], use end_time\__gte=2012-03-21 11:47[:30]
+ * end_time\__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before 2012-03-21 11:47, use end_time\__lt=2012-03-21 11:47
+ * end_time\__lte: lte stands for lesser than or equal. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all calls that ended before or exactly at 2012-03-21 11:47[:30], use end_time\__lte=2012-03-21 11:47[:30] + * Note: The above filters can be combined to get calls that ended in a particular time range. The timestamps need to be UTC timestamps. * + [int] limit - Used to display the number of results per page. The maximum number of results that can be fetched is 20. * + [int] offset - Denotes the number of value items by which the results should be offset. E.g., If the result contains a 1000 values and limit is set to 10 and offset is set to 705, then values 706 through 715 are displayed in the results. This parameter is also used for pagination of the results. * @return CallList + * @throws PlivoResponseException */ public function getList(array $optionalArgs = []) { @@ -234,6 +235,17 @@ public function getList(array $optionalArgs = []) $calls = []; + $responseContents = $response->getContent(); + if(array_key_exists("error",$responseContents)){ + throw new PlivoResponseException( + $responseContents['error'], + 0, + null, + $response->getContent(), + $response->getStatusCode() + ); + } + foreach ($response->getContent()['objects'] as $call) { $newCall = new Call($this->client, $call, $this->pathParams['authId'], $call['call_uuid']); diff --git a/src/Plivo/Version.php b/src/Plivo/Version.php index d0552aac..41629c40 100644 --- a/src/Plivo/Version.php +++ b/src/Plivo/Version.php @@ -25,7 +25,7 @@ class Version /** * @const int PHP helper library patch number */ - const PATCH = 0; + const PATCH = 1; /** * @return string */