diff --git a/.github/workflows/unitTests.yml b/.github/workflows/unitTests.yml
index 69ca5a8c..7a8dc3c5 100644
--- a/.github/workflows/unitTests.yml
+++ b/.github/workflows/unitTests.yml
@@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
- php-version: [7.3, 7.4, 8.1]
+ php-version: [7.4, 8.1]
steps:
- uses: actions/checkout@v2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7775e77c..6f14ccf5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,8 @@
# Change Log
+## [4.57.0](https://github.com/plivo/plivo-php/tree/v4.57.0) (2023-09-13)
+**Feature - Number Masking**
+- Added Create, Delete, Update, Get and List Masking Session API
+
## [4.56.0](https://github.com/plivo/plivo-php/tree/v4.56.0) (2023-08-25)
**Feature - Added New Param 'carrier_fees', 'carrier_fees_rate', 'destination_network' in Get Message and List Message APIs**
- Added new params on message get and list response
diff --git a/src/Plivo/Resources/MaskingSession/MaskingSession.php b/src/Plivo/Resources/MaskingSession/MaskingSession.php
new file mode 100644
index 00000000..d28ac263
--- /dev/null
+++ b/src/Plivo/Resources/MaskingSession/MaskingSession.php
@@ -0,0 +1,34 @@
+properties = [
+ 'api_id' => $response['api_id'],
+ 'response' => $response['response']
+ ];
+
+ $this->pathParams = [
+ 'authId' => $authId,
+ 'sessionUuid' => $response['response']['session_uuid']
+ ];
+
+ $this->id = $response['response']['session_uuid'];
+
+ }
+}
\ No newline at end of file
diff --git a/src/Plivo/Resources/MaskingSession/MaskingSessionCreateResponse.php b/src/Plivo/Resources/MaskingSession/MaskingSessionCreateResponse.php
new file mode 100644
index 00000000..79693364
--- /dev/null
+++ b/src/Plivo/Resources/MaskingSession/MaskingSessionCreateResponse.php
@@ -0,0 +1,63 @@
+sessionUuid = $sessionUuid;
+ $this->virtualNumber = $virtualNumber;
+ $this->session = $session;
+
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getSessionUuid()
+ {
+ return $this->sessionUuid;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getVirtualNumber()
+ {
+ return $this->virtualNumber;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getSession()
+ {
+ return $this->session;
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/src/Plivo/Resources/MaskingSession/MaskingSessionInterface.php b/src/Plivo/Resources/MaskingSession/MaskingSessionInterface.php
new file mode 100644
index 00000000..644a65d3
--- /dev/null
+++ b/src/Plivo/Resources/MaskingSession/MaskingSessionInterface.php
@@ -0,0 +1,265 @@
+pathParams = [
+ 'authId' => $authId
+ ];
+ $this->uri = "Account/".$authId."/Masking/Session/";
+ }
+
+ /**
+ * Create a masking session
+ * @method
+ * @param {string} firstParty - The phone number or SIP endpoint of the first party.
+ * @param {string} secondParty - The phone number or SIP endpoint of the second party.
+ * @param array $optionalArgs
+ * + Valid arguments with their types
+ * + [number] sessionExpiry - The duration in seconds for which the masking session will be active.
+ * + [number] callTimeLimit - The maximum duration in seconds for each call in the masking session.
+ * + [boolean] record - Indicates whether the calls in the masking session should be recorded.
+ * + [string] recordFileFormat - The file format for the recorded calls.
+ * + [string] recordingCallbackUrl - The URL to which the recording callback will be sent.
+ * + [boolean] initiateCallToFirstParty - Indicates whether the call to the first party should be initiated automatically.
+ * + [string] callbackUrl - The URL to which the callback for the masking session will be sent.
+ * + [string] callbackMethod] - The HTTP method for the callback request.
+ * + [number] ringTimeout - The duration in seconds for which the call will ring before being canceled.
+ * + [string] firstPartyPlayUrl - The URL to play audio to the first party when the call is established.
+ * + [string] secondPartyPlayUrl - The URL to play audio to the second party when the call is established.
+ * + [string] recordingCallbackMethod - The HTTP method for the recording callback request.
+
+ * @return JSON output
+ * @throws PlivoValidationException,PlivoResponseException
+ */
+ public function createMaskingSession($firstParty, $secondParty,
+ array $optionalArgs = [])
+ {
+ $mandatoryArgs = [
+ 'first_party' => $firstParty,
+ 'second_party' => $secondParty,
+ ];
+ $optionalArgs['isVoiceRequest'] = true;
+
+ if (ArrayOperations::checkNull($mandatoryArgs)) {
+ throw new PlivoValidationException(
+ "Mandatory parameters cannot be null");
+ }
+
+
+ $response = $this->client->update(
+ $this->uri,
+ array_merge($mandatoryArgs, $optionalArgs)
+ );
+
+ $responseContents = $response->getContent();
+ if(!array_key_exists("error",$responseContents)){
+ return new MaskingSessionCreateResponse(
+ $responseContents['api_id'],
+ $responseContents['session_uuid'],
+ $responseContents['virtual_number'],
+ $responseContents['message'],
+ $responseContents['session'],
+ $response->getStatusCode()
+ );
+ } else {
+ throw new PlivoResponseException(
+ $responseContents['error'],
+ 0,
+ null,
+ $response->getContent(),
+ $response->getStatusCode()
+
+ );
+ }
+
+ }
+
+ /**
+ * delete a masking session.
+ * @param string $sessionUuid
+ * @throws PlivoValidationException
+ */
+ public function deleteMaskingSession($sessionUuid)
+ {
+ if (ArrayOperations::checkNull([$sessionUuid])) {
+ throw
+ new PlivoValidationException(
+ 'session uuid is mandatory');
+ }
+ $optionalArgs['isVoiceRequest'] = true;
+ return $this->client->delete(
+ $this->uri . $sessionUuid . '/',
+ $optionalArgs
+ );
+
+ }
+
+ /**
+ * Get details of a masking session
+ * @param string $sessionUuid
+ * @throws PlivoValidationException
+ */
+ public function getMaskingSession($sessionUuid)
+ {
+ if (ArrayOperations::checkNull([$sessionUuid])) {
+ throw
+ new PlivoValidationException(
+ 'session uuid is mandatory');
+ }
+ $optionalArgs['isVoiceRequest'] = true;
+ $response = $this->client->fetch(
+ $this->uri . $sessionUuid . '/',
+ $optionalArgs
+ );
+
+ return new MaskingSession(
+ $this->client,
+ $response->getContent(),
+ $this->pathParams['authId']);
+ }
+
+ /**
+ * Update a masking session
+ * @method
+ * @param {string} sessionUuid
+ *
+ * @param array $optionalArgs
+ * + Valid arguments with their types
+ * + [number] sessionExpiry - The duration in seconds for which the masking session will be active.
+ * + [number] callTimeLimit - The maximum duration in seconds for each call in the masking session.
+ * + [boolean] record - Indicates whether the calls in the masking session should be recorded.
+ * + [string] recordFileFormat - The file format for the recorded calls.
+ * + [string] recordingCallbackUrl - The URL to which the recording callback will be sent.
+ * + [string] callbackUrl - The URL to which the callback for the masking session will be sent.
+ * + [string] callbackMethod] - The HTTP method for the callback request.
+ * + [number] ringTimeout - The duration in seconds for which the call will ring before being canceled.
+ * + [string] firstPartyPlayUrl - The URL to play audio to the first party when the call is established.
+ * + [string] secondPartyPlayUrl - The URL to play audio to the second party when the call is established.
+ * + [string] recordingCallbackMethod - The HTTP method for the recording callback request.
+
+ * @return ResponseUpdate
+ * @throws PlivoValidationException,PlivoResponseException
+ */
+ public function updateMaskingSession($sessionUuid,
+ array $optionalArgs = [])
+ {
+ if (ArrayOperations::checkNull([$sessionUuid])) {
+ throw
+ new PlivoValidationException(
+ 'session uuid is mandatory');
+ }
+ $optionalArgs['isVoiceRequest'] = true;
+
+ $response = $this->client->update(
+ $this->uri . $sessionUuid . '/',
+ $optionalArgs
+ );
+
+ $responseContents = $response->getContent();
+
+ if(!array_key_exists("error",$responseContents)){
+ return new MaskingSessionUpdateResponse(
+ $responseContents['api_id'],
+ $responseContents['message'],
+ $responseContents['session'],
+ $response->getStatusCode()
+ );
+ } else {
+ throw new PlivoResponseException(
+ $responseContents['error'],
+ 0,
+ null,
+ $response->getContent(),
+ $response->getStatusCode()
+
+ );
+ }
+
+ }
+
+
+ /**
+ * Get list of masking sessions
+ *
+ * @param array $optionalArgs
+ * + Valid arguments with their types
+ * + [string] firstParty - The phone number or SIP endpoint of the first party.
+ * + [string] secondParty - The phone number or SIP endpoint of the second party.
+ * + [string] virtual number - The virtual number associated with the masking session.
+ * + [string] status - The status of the masking session.
+ * + [string] created_time - Filter out the session based on its created time. The filter can be used in one of the following five forms:
+ * created_time: Input the exact value. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]].
+ * created_time\__gt: gt stands for greater than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all sessions whose created time is after 2012-03-21 11:47, use end_time\__gt=2012-03-21 11:47
+ * created_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 sessions whose created time is after or exactly at 2012-03-21 11:47[:30], use end_time\__gte=2012-03-21 11:47[:30]
+ * created_time\__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all sessions whose created time is before 2012-03-21 11:47, use end_time\__lt=2012-03-21 11:47
+ * created_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 sessions whose created time is before or exactly at 2012-03-21 11:47[:30], use end_time\__lte=2012-03-21 11:47[:30]
+ * + [string] expiry_time - Filter out the session based on its expiry time. The filter can be used in the following five forms:
+ * expiry_time: Input the exact value. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]].
+ * expiry_time\__gt: gt stands for greater than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all sessions whose expiry time is after 2012-03-21 11:47, use end_time\__gt=2012-03-21 11:47
+ * expiry_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 sessions whose expirty time is after or exactly at 2012-03-21 11:47[:30], use end_time\__gte=2012-03-21 11:47[:30]
+ * expiry_time\__lt: lt stands for lesser than. The format expected is YYYY-MM-DD HH:MM[:ss[.uuuuuu]]. E.g., To get all sessions whose expiry time is before 2012-03-21 11:47, use end_time\__lt=2012-03-21 11:47
+ * expiry_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 sessions whose expiry time is before or exactly at 2012-03-21 11:47[:30], use end_time\__lte=2012-03-21 11:47[:30]
+ * + [string] duration - Filter the results according to duration of session. The filter can be used in one of the following five forms:
+ * duration: Input the exact value. E.g., to filter out sessions that were exactly three minutes long, use duration=180
+ * duration\__gt: gt stands for greater than. E.g., to filter out sessions that were more than two hours in duration _duration\__gt=7200
+ * duration\__gte: gte stands for greater than or equal to. E.g., to filter out sessions that were two hours or more in duration bill_duration\__gte=7200
+ * duration\__lt: lt stands for lesser than. E.g., to filter out sessions that were less than seven minutes in duration bill_duration\__lt=420
+ * duration\__lte: lte stands for lesser than or equal to. E.g., to filter out sessions that were two hours or less in duration bill_duration\__lte=7200
+
+ * Note: The above filters can be combined to get sessions 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 MaskingSessionList
+ * @throws PlivoResponseException
+ */
+ public function listMaskingSession(array $optionalArgs = [])
+ {
+ $optionalArgs['isVoiceRequest'] = true;
+ $response = $this->client->fetch(
+ $this->uri,
+ $optionalArgs
+ );
+
+ $responseContents = $response->getContent();
+ if(!array_key_exists("error",$responseContents)){
+ return new MaskingSessionListResponse(
+ $responseContents['api_id'],
+ $responseContents['response']['meta'],
+ $responseContents['response']['objects'],
+ $response->getStatusCode()
+ );
+ } else {
+ throw new PlivoResponseException(
+ $responseContents['error'],
+ 0,
+ null,
+ $response->getContent(),
+ $response->getStatusCode()
+ );
+ }
+ }
+}
diff --git a/src/Plivo/Resources/MaskingSession/MaskingSessionListResponse.php b/src/Plivo/Resources/MaskingSession/MaskingSessionListResponse.php
new file mode 100644
index 00000000..19dd89f1
--- /dev/null
+++ b/src/Plivo/Resources/MaskingSession/MaskingSessionListResponse.php
@@ -0,0 +1,43 @@
+meta = $meta;
+ $this->objects = $objects;
+ }
+
+ public function getMeta()
+ {
+ return $this->meta;
+ }
+
+ public function getObjects()
+ {
+ return $this->objects;
+ }
+}
\ No newline at end of file
diff --git a/src/Plivo/Resources/MaskingSession/MaskingSessionUpdateResponse.php b/src/Plivo/Resources/MaskingSession/MaskingSessionUpdateResponse.php
new file mode 100644
index 00000000..351ad70e
--- /dev/null
+++ b/src/Plivo/Resources/MaskingSession/MaskingSessionUpdateResponse.php
@@ -0,0 +1,39 @@
+session = $session;
+
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getSession()
+ {
+ return $this->session;
+ }
+
+}
\ No newline at end of file
diff --git a/src/Plivo/RestClient.php b/src/Plivo/RestClient.php
index c9517891..48d6342d 100644
--- a/src/Plivo/RestClient.php
+++ b/src/Plivo/RestClient.php
@@ -6,6 +6,7 @@
use Plivo\Resources\Account\AccountInterface;
use Plivo\Resources\Application\ApplicationInterface;
use Plivo\Resources\Call\CallInterface;
+use Plivo\Resources\MaskingSession\MaskingSessionInterface;
use Plivo\Resources\Conference\ConferenceInterface;
use Plivo\Resources\Endpoint\EndpointInterface;
use Plivo\Resources\HostedMessaging\HostedMessageLOAInterface;
@@ -62,6 +63,7 @@
* @property HostedMessageLOAInterface hostedMessageLOA Interface to handle all HostedMessageLOA related api calls
* @property HostedMessagingNumberInterface hostedMessagingNumber Interface to handle all HostedMessagingNumber related api calls
* @property ZentrunkInterface Zentrunk Interface to handle all Zentrunk Call related api
+ * @property MaskingSessionInterface Masking session Interface to handle all session related api calls
*
*/
class RestClient
@@ -216,6 +218,10 @@ class RestClient
* @var ZentrunkInterface
*/
protected $_zentrunkCall;
+ /**
+ * @var MaskingSessionInterface
+ */
+ protected $_maskingSession;
/**
* RestClient constructor.
@@ -393,6 +399,17 @@ protected function getCalls()
}
return $this->_call;
}
+
+ /**
+ * @return MaskingSessionInterface
+ */
+ protected function getMaskingSessions()
+ {
+ if (!$this->_maskingSession) {
+ $this->_maskingSession = new MaskingSessionInterface($this->client, $this->client->getAuthId());
+ }
+ return $this->_maskingSession;
+ }
/**
* @return TokenInterface
*/
diff --git a/src/Plivo/Version.php b/src/Plivo/Version.php
index 37d63815..57d4a19b 100644
--- a/src/Plivo/Version.php
+++ b/src/Plivo/Version.php
@@ -20,7 +20,7 @@ class Version
/**
* @const int PHP helper library minor version number
*/
- const MINOR = 56;
+ const MINOR = 57;
/**
* @const int PHP helper library patch number
diff --git a/tests/Mocks/maskingSessionCreateResponse.json b/tests/Mocks/maskingSessionCreateResponse.json
new file mode 100644
index 00000000..55642f60
--- /dev/null
+++ b/tests/Mocks/maskingSessionCreateResponse.json
@@ -0,0 +1,35 @@
+{
+ "api_id": "1c8beb2c-01bf-4649-b0fb-5e3bd7836311",
+ "session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
+ "virtual_number": "+916361728680",
+ "message": "Session created",
+ "session": {
+ "first_party": "917708772011",
+ "second_party": "919976106830",
+ "virtual_number": "916361728680",
+ "status": "active",
+ "initiate_call_to_first_party": false,
+ "session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
+ "callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
+ "callback_method": "GET",
+ "created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
+ "modified_time": "2023-07-05 16:33:08.444312 +0000 UTC",
+ "expiry_time": "2023-07-05 12:43:08.222701 +0000 UTC",
+ "duration": 8247,
+ "amount": 0,
+ "call_time_limit": 14400,
+ "ring_timeout": 120,
+ "first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
+ "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "record": false,
+ "record_file_format": "mp3",
+ "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "recording_callback_method": "GET",
+ "interaction": null,
+ "total_call_amount": 0,
+ "total_call_count": 0,
+ "total_call_billed_duration": 0,
+ "total_session_amount": 0,
+ "last_interaction_time": ""
+ }
+ }
\ No newline at end of file
diff --git a/tests/Mocks/maskingSessionDeleteResponse.json b/tests/Mocks/maskingSessionDeleteResponse.json
new file mode 100644
index 00000000..d365fc8f
--- /dev/null
+++ b/tests/Mocks/maskingSessionDeleteResponse.json
@@ -0,0 +1,4 @@
+{
+ "api_id": "4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5",
+ "message": "Session expired"
+ }
\ No newline at end of file
diff --git a/tests/Mocks/maskingSessionGetResponse.json b/tests/Mocks/maskingSessionGetResponse.json
new file mode 100644
index 00000000..85e8ac7f
--- /dev/null
+++ b/tests/Mocks/maskingSessionGetResponse.json
@@ -0,0 +1,32 @@
+{
+ "api_id": "b503c0b9-a419-406f-8e49-9856844600ab",
+ "response": {
+ "first_party": "917708772011",
+ "second_party": "919976106830",
+ "virtual_number": "916361728680",
+ "status": "active",
+ "initiate_call_to_first_party": false,
+ "session_uuid": "4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5",
+ "callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
+ "callback_method": "GET",
+ "created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
+ "modified_time": "2023-07-05 10:25:40.877364 +0000 UTC",
+ "expiry_time": "2023-07-05 12:05:40.877364 +0000 UTC",
+ "duration": 6000,
+ "amount": 0,
+ "call_time_limit": 14400,
+ "ring_timeout": 120,
+ "first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
+ "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "record": false,
+ "record_file_format": "mp3",
+ "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "recording_callback_method": "GET",
+ "interaction": null,
+ "total_call_amount": 0,
+ "total_call_count": 0,
+ "total_call_billed_duration": 0,
+ "total_session_amount": 0,
+ "last_interaction_time": ""
+ }
+ }
\ No newline at end of file
diff --git a/tests/Mocks/maskingSessionListResponse.json b/tests/Mocks/maskingSessionListResponse.json
new file mode 100644
index 00000000..fd66fb11
--- /dev/null
+++ b/tests/Mocks/maskingSessionListResponse.json
@@ -0,0 +1,74 @@
+{
+ "api_id": "2900eb2b-0d47-4464-8eff-bbd413e15bf9",
+ "response": {
+ "meta": {
+ "limit": 20,
+ "next": null,
+ "offset": 0,
+ "previous": null,
+ "total_count": 2
+ },
+ "objects": [
+ {
+ "amount": 0,
+ "call_time_limit": 600,
+ "callback_method": "GET",
+ "callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
+ "created_time": "2023-07-05 10:25:40.877364 +0000 UTC",
+ "duration": 2863,
+ "expiry_time": "2023-07-05 11:13:23.895313 +0000 UTC",
+ "first_party": "917708772011",
+ "first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
+ "initiate_call_to_first_party": false,
+ "interaction": null,
+ "last_interaction_time": "",
+ "modified_time": "2023-07-05 11:03:23.895354 +0000 UTC",
+ "record": true,
+ "record_file_format": "mp3",
+ "recording_callback_method": "GET",
+ "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/c2146ba4-798d-49b0-8580-53851a16e055/",
+ "ring_timeout": 120,
+ "second_party": "919976106830",
+ "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "session_uuid": "c2146ba4-798d-49b0-8580-53851a16e055",
+ "status": "expired",
+ "total_call_amount": 0,
+ "total_call_billed_duration": 0,
+ "total_call_count": 0,
+ "total_session_amount": 0,
+ "virtual_number": "916361728680"
+ },
+ {
+ "amount": 0,
+ "call_time_limit": 14400,
+ "callback_method": "GET",
+ "callback_url": "http://plivobin.non-prod.plivops.com/w7mf5kw7",
+ "created_time": "2023-06-30 06:39:06.742974 +0000 UTC",
+ "duration": 6000,
+ "expiry_time": "2023-06-30 06:39:16.99714 +0000 UTC",
+ "first_party": "917708772011",
+ "first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
+ "initiate_call_to_first_party": false,
+ "interaction": null,
+ "last_interaction_time": "",
+ "modified_time": "2023-06-30 12:09:17.221954 +0000 UTC",
+ "record": false,
+ "record_file_format": "mp3",
+ "recording_callback_method": "GET",
+ "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "resource_uri": "/v1/Account/MAZTQXZDYWNZBMMJAZZJ/Masking/Session/dd3bb3c2-4f18-4988-87f1-9116b00bb875/",
+ "ring_timeout": 120,
+ "second_party": "919976106830",
+ "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "session_uuid": "dd3bb3c2-4f18-4988-87f1-9116b00bb875",
+ "status": "expired",
+ "total_call_amount": 0,
+ "total_call_billed_duration": 0,
+ "total_call_count": 0,
+ "total_session_amount": 0,
+ "virtual_number": "916361728680"
+ }
+ ]
+ }
+ }
\ No newline at end of file
diff --git a/tests/Mocks/maskingSessionUpdateResponse.json b/tests/Mocks/maskingSessionUpdateResponse.json
new file mode 100644
index 00000000..95d63e99
--- /dev/null
+++ b/tests/Mocks/maskingSessionUpdateResponse.json
@@ -0,0 +1,33 @@
+{
+ "api_id": "b5506536-83d0-498f-929f-4427cb6ca391",
+ "message": "Session updated",
+ "session": {
+ "first_party": "917708772011",
+ "second_party": "919976106830",
+ "virtual_number": "916361728680",
+ "status": "active",
+ "initiate_call_to_first_party": false,
+ "session_uuid": "7b5c5e17-e1e9-4ccd-a480-42f5c97fbe96",
+ "callback_url": "http://plivobin.non-prod.plivops.com/12tksfd1",
+ "callback_method": "GET",
+ "created_time": "2023-07-06 10:53:32.814078 +0000 +0000",
+ "modified_time": "2023-07-06 10:53:45.106122 +0000 UTC",
+ "expiry_time": "2023-07-06 11:03:45.106117 +0000 UTC",
+ "duration": 612,
+ "amount": 0,
+ "call_time_limit": 600,
+ "ring_timeout": 120,
+ "first_party_play_url": "https://s3.amazonaws.com/plivosamplexml/play_url.xml",
+ "second_party_play_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "record": true,
+ "record_file_format": "mp3",
+ "recording_callback_url": "https://plivobin-prod-usw.plivops.com/api/v1/speak.xml",
+ "recording_callback_method": "GET",
+ "interaction": null,
+ "total_call_amount": 0,
+ "total_call_count": 0,
+ "total_call_billed_duration": 0,
+ "total_session_amount": 0,
+ "last_interaction_time": ""
+ }
+ }
\ No newline at end of file
diff --git a/tests/Resources/MaskingSessionTest.php b/tests/Resources/MaskingSessionTest.php
new file mode 100644
index 00000000..9a2c1c0b
--- /dev/null
+++ b/tests/Resources/MaskingSessionTest.php
@@ -0,0 +1,132 @@
+ '919999999999',
+ 'second_party' => '919999999998'
+
+ ]);
+ $body = file_get_contents(__DIR__ . '/../Mocks/maskingSessionCreateResponse.json');
+
+ $this->mock(new PlivoResponse($request,201, $body));
+
+ $actual = $this->client->maskingSessions->createMaskingSession(
+ '919999999999', '919999999998');
+
+ $this->assertRequest($request);
+
+ self::assertNotNull($actual);
+
+ // $actual = json_decode($actual);
+
+ self::assertEquals($actual->message, "Session created");
+ self::assertEquals($actual->apiId, "1c8beb2c-01bf-4649-b0fb-5e3bd7836311");
+ }
+
+ function testUpdateMaskingSession()
+ {
+ $request = new PlivoRequest(
+ 'POST',
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Masking/Session/',
+ [
+ '4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5',
+ array(
+ 'call_time_limit' => 1600,
+ 'record_file_format' => 'wav'
+ )
+
+ ]);
+ $body = file_get_contents(__DIR__ . '/../Mocks/maskingSessionUpdateResponse.json');
+
+ $this->mock(new PlivoResponse($request,201, $body));
+
+ $actual = $this->client->maskingSessions->updateMaskingSession(
+ '4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5',
+ array('call_time_limit'=>1600,'record_file_format' => 'wav'
+ ));
+
+ self::assertNotNull($actual);
+
+ // $actual = json_decode($actual);
+
+ self::assertEquals($actual->message, "Session updated");
+ self::assertEquals($actual->apiId, "b5506536-83d0-498f-929f-4427cb6ca391");
+ }
+
+
+ function testDeleteMaskingSession()
+ {
+ $request = new PlivoRequest(
+ 'DELETE',
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Masking/Session/4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5',
+ []);
+ $body = file_get_contents(__DIR__ . '/../Mocks/maskingSessionDeleteResponse.json');
+
+ $this->mock(new PlivoResponse($request,204, $body));
+
+ $actual = $this->client->maskingSessions->deleteMaskingSession("4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5");;
+
+ self::assertNotNull($actual);
+ }
+
+
+ function testGetMaskingSession()
+ {
+ $request = new PlivoRequest(
+ 'GET',
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Masking/Session/4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5/',
+ []);
+ $body = file_get_contents(__DIR__ . '/../Mocks/maskingSessionGetResponse.json');
+
+ $this->mock(new PlivoResponse($request,200, $body));
+
+ $actual = $this->client->maskingSessions->getMaskingSession("4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5");
+
+ $this->assertRequest($request);
+
+ self::assertNotNull($actual);
+
+ self::assertEquals($actual->getId(), "4d04c52e-cea3-4458-bbdb-0bfc314ee7cd5");
+ }
+
+ function testListMaskingSession()
+ {
+ $request = new PlivoRequest(
+ 'GET',
+ 'Account/MAXXXXXXXXXXXXXXXXXX/Masking/Session/',
+ [
+ array('first_party'=>'916361728680',
+ 'second_party' => '917708772011'
+ )]);
+ $body = file_get_contents(__DIR__ . '/../Mocks/maskingSessionListResponse.json');
+
+ $this->mock(new PlivoResponse($request,200, $body));
+
+ $actual = $this->client->maskingSessions->listMaskingSession(array('first_party'=>'916361728680',
+ 'second_party' => '917708772011'));
+
+ self::assertNotNull($actual);
+
+ self::assertEquals($actual->meta, array('total_count'=>2, 'limit'=>20, 'next'=>null, 'offset'=>0, 'previous'=>null));
+ }
+
+
+
+}