Skip to content

Commit

Permalink
Merge pull request #245 from plivo/VT-4165
Browse files Browse the repository at this point in the history
VT-4165:filtering added
  • Loading branch information
ajay-plivo authored May 5, 2022
2 parents 194cdc5 + a7706f3 commit ea55779
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [v4.32.0](https://github.com/plivo/plivo-node/tree/v4.32.0) (2022-05-05)
**Features - List all recordings**
- `fromNumber` and `toNumber` added in filtering params [List all recordings](https://www.plivo.com/docs/voice/api/recording#list-all-recordings)
- `record_min_member_count` param added to [Add a participant to a multiparty call using API](https://www.plivo.com/docs/voice/api/multiparty-call/participants#add-a-participant)

## [v4.31.0](https://github.com/plivo/plivo-node/tree/v4.31.0) (2022-04-27)
**Feature - 10DLC API callback**
- Added callback support for campaign, brand, link number request.
Expand Down
7 changes: 7 additions & 0 deletions lib/resources/multiPartyCall.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ export class MultiPartyCall extends PlivoResource{
params.maxParticipants = 10
}

if(params.recordMinMemberCount || params.recordMinMemberCount === 0){
validRange('recordMinMemberCount', params.recordMinMemberCount, false, 1, 2)
}
else {
params.recordMinMemberCount = 1
}

if(params.waitMusicUrl){
validUrl('waitMusicUrl', params.waitMusicUrl, false)
}
Expand Down
7 changes: 7 additions & 0 deletions lib/resources/recordings.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export class RetrieveRecordingResponse {
this.recordingType = params.recordingType;
this.recordingUrl = params.recordingUrl;
this.resourceUri = params.resourceUri;
this.fromNumber = params.fromNumber;
this.toNumber = params.toNumber;
}
}

Expand All @@ -45,6 +47,11 @@ export class ListRecordingResponse {
this.recordingType = params.recordingType;
this.recordingUrl = params.recordingUrl;
this.resourceUri = params.resourceUri;
this.fromNumber = params.fromNumber;
this.toNumber = params.toNumber;
this.mpcName = params.mpcName;
this.conferenceUuid = params.conferenceUuid;
this.mpcUuid = params.mpcUuid;
}
}

Expand Down
12 changes: 9 additions & 3 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2005,7 +2005,9 @@ export function Request(config) {
recording_start_ms: '1407235163907.00000',
recording_type: 'conference',
recording_url: 'http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-11e4-a664-0026b945b52x.mp3',
resource_uri: '/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/'
resource_uri: '/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-11e4-a664-0026b945b52x/',
from_number: '+919999323467',
to_number: '+919891865130',
}
});
}
Expand Down Expand Up @@ -2034,7 +2036,9 @@ export function Request(config) {
recording_start_ms: '1407235163907.00000',
recording_type: 'conference',
recording_url: 'http://s3.amazonaws.com/recordings_2013/c2186400-1c8c-1124-a664-0026b945b522.mp3',
resource_uri: '/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-1124-a664-0026b945b522/'
resource_uri: '/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/c2186400-1c8c-1124-a664-0026b945b522/',
from_number: '+919999323467',
to_number: '+919891865130',
},
{
add_time: '2014-08-05 16:05:21.993853+05:30',
Expand All @@ -2047,7 +2051,9 @@ export function Request(config) {
recording_start_ms: '1407234829553.00000',
recording_type: 'conference',
recording_url: 'http://s3.amazonaws.com/recordings_2013/fc2716b0-1c8b-11e4-bwad-842b2b17453e.mp3',
resource_uri: '/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/fc2716b0-1c8b-11e4-bwad-842b2b17453e/'
resource_uri: '/v1/Account/MANWVLYTK4ZWU1YTY4ZT/Recording/fc2716b0-1c8b-11e4-bwad-842b2b17453e/',
from_number: '+919999323467',
to_number: '+919891865130',
}
]
}
Expand Down
10 changes: 9 additions & 1 deletion lib/utils/plivoxml.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ Response.prototype = {
* @param {string} [attributes.role]
* @param {number} [attributes.maxDuration]
* @param {number} [attributes.maxParticipants]
* @param {number} [attributes.recordMinMemberCount]
* @param {string} [attributes.waitMusicMethod]
* @param {string} [attributes.agentHoldMusicMethod]
* @param {string} [attributes.customerHoldMusicMethod]
Expand Down Expand Up @@ -506,6 +507,13 @@ Response.prototype = {
attributes.maxParticipants = 10
}

if(attributes.recordMinMemberCount && (attributes.recordMinMemberCount<1 || attributes.recordMinMemberCount>2)){
throw new PlivoXMLError('Invalid attribute value ' + attributes.recordMinMemberCount + ' for recordMinMemberCount')
}
else if(!attributes.recordMinMemberCount){
attributes.recordMinMemberCount = 1
}

if(attributes.waitMusicMethod && VALID_METHOD_VALUES.indexOf(attributes.waitMusicMethod.toUpperCase())===-1){
throw new PlivoXMLError('Invalid attribute value ' + attributes.waitMusicMethod + ' for waitMusicMethod')
}
Expand Down Expand Up @@ -1004,7 +1012,7 @@ util.inherits(DTMF, Response);
function MultiPartyCall(Response){
this.element = 'MultiPartyCall';
this.nestables = [];
this.valid_attributes = ['role', 'maxDuration', 'maxParticipants', 'waitMusicUrl',
this.valid_attributes = ['role', 'maxDuration', 'maxParticipants', 'recordMinMemberCount', 'waitMusicUrl',
'waitMusicMethod', 'agentHoldMusicUrl', 'agentHoldMusicMethod',
'customerHoldMusicUrl', 'customerHoldMusicMethod', 'record',
'recordFileFormat', 'recordingCallbackUrl', 'recordingCallbackMethod',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plivo",
"version": "4.31.0",
"version": "4.32.0",
"description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML",
"homepage": "https://github.com/plivo/plivo-node",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion test/xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('PlivoXML', function () {
maxDuration: 1000,
statusCallbackEvents: 'participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes'
});
assert.equal('<Response><MultiPartyCall role="Agent" maxDuration="1000" statusCallbackEvents="participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes" maxParticipants="10" waitMusicMethod="GET" agentHoldMusicMethod="GET" customerHoldMusicMethod="GET" record="false" recordFileFormat="mp3" recordingCallbackMethod="GET" statusCallbackMethod="POST" stayAlone="false" coachMode="true" mute="false" hold="false" startMpcOnEnter="true" endMpcOnExit="false" enterSound="beep:1" enterSoundMethod="GET" exitSound="beep:2" exitSoundMethod="GET" onExitActionMethod="POST" relayDTMFInputs="false" startRecordingAudioMethod="GET" stopRecordingAudioMethod="GET">Nairobi</MultiPartyCall></Response>',mpcResponse.toXML());
assert.equal('<Response><MultiPartyCall role="Agent" maxDuration="1000" statusCallbackEvents="participant-speak-events, participant-digit-input-events, add-participant-api-events, participant-state-changes, mpc-state-changes" maxParticipants="10" recordMinMemberCount="1" waitMusicMethod="GET" agentHoldMusicMethod="GET" customerHoldMusicMethod="GET" record="false" recordFileFormat="mp3" recordingCallbackMethod="GET" statusCallbackMethod="POST" stayAlone="false" coachMode="true" mute="false" hold="false" startMpcOnEnter="true" endMpcOnExit="false" enterSound="beep:1" enterSoundMethod="GET" exitSound="beep:2" exitSoundMethod="GET" onExitActionMethod="POST" relayDTMFInputs="false" startRecordingAudioMethod="GET" stopRecordingAudioMethod="GET">Nairobi</MultiPartyCall></Response>',mpcResponse.toXML());
done();
});
});
7 changes: 7 additions & 0 deletions types/resources/recordings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export class RetrieveRecordingResponse {
recordingType: string;
recordingUrl: string;
resourceUri: string;
fromNumber: string;
toNumber: string;
}
export class ListRecordingResponse {
constructor(params: object);
Expand All @@ -27,6 +29,11 @@ export class ListRecordingResponse {
recordingType: string;
recordingUrl: string;
resourceUri: string;
fromNumber: string;
toNumber: string;
conferenceUuid: string;
mpcName: string;
mpcUuid: string;
}
/**
* Represents a Recording
Expand Down

0 comments on commit ea55779

Please sign in to comment.