diff --git a/lib/rest/request-test.js b/lib/rest/request-test.js index 3f0abe0..fc1df28 100644 --- a/lib/rest/request-test.js +++ b/lib/rest/request-test.js @@ -883,6 +883,60 @@ export function Request(config) { }); } + else if (method === 'POST' && action === 'MultiPartyCall/name_TestMPC/Participant/10/Record/'){ + resolve({ + response: {}, + body: { + "api_id": "036c80f3-3721-11ec-a678-0242ac110002", + "message": "MPC: TestMPC participant record started", + "recording_id": "24670db8-c723-4ba2-8521-f10ec41ddf8b", + "recording_url": "https://media-qa.voice.plivodev.com/v1/Account/MAXXXXXXXXXXXX/Recording/XXXXX-XXXX-XXXX-XXXXX.mp3" + } + }); + } + + else if (method === 'DELETE' && action === 'MultiPartyCall/name_TestMPC/Participant/10/Record/'){ + resolve({ + response: {}, + body: {} + }); + } + + else if (method === 'POST' && action === 'MultiPartyCall/name_TestMPC/Participant/10/Record/Pause/'){ + resolve({ + response: {}, + body: {} + }); + } + + else if (method === 'POST' && action === 'MultiPartyCall/name_TestMPC/Participant/10/Record/Resume/'){ + resolve({ + response: {}, + body: {} + }); + } + + else if (method === 'POST' && action === 'MultiPartyCall/name_TestMPC/Member/10/Play/'){ + resolve({ + response: {}, + body: { + "api_id": "c07db813-3721-11ec-8bcd-0242ac110008", + "message": "play queued into MPC", + "mpcMemberId": [ + "1003" + ], + "mpcName": "TestMPC" + } + }); + } + + else if (method === 'DELETE' && action === 'MultiPartyCall/name_TestMPC/Member/10/Play/'){ + resolve({ + response: {}, + body: {} + }); + } + // ============= Numbers =================== else if (method == 'GET' && action == 'Number/+919999999990/') { resolve({ diff --git a/test/multiPartyCalls.js b/test/multiPartyCalls.js index 0e848ec..73cfe30 100644 --- a/test/multiPartyCalls.js +++ b/test/multiPartyCalls.js @@ -92,4 +92,41 @@ describe('multiPartyCalls', function (){ assert.equal(response.resourceUri, '/v1/Account/MAMDJMMTEZOWY0ZMQWM2/MultiPartyCall/uuid_7503f05f-2d6e-4ab3-b9e6-3b0d81ae9087/Participant/2132/') }) }); + + it('should start MPC Participant Recording', function (){ + return client.multiPartyCalls.startParticipantRecording(10, {friendlyName: 'TestMPC'}).then(function (response){ + assert(response.message, "MPC: TestMPC participant record started") + }) + }); + + it('should stop MPC Participant Recording', function (){ + return client.multiPartyCalls.stopParticipantRecording(10,{friendlyName: 'TestMPC'}).then(function (response){ + assert(response instanceof PlivoGenericResponse) + }) + }); + + it('should pause MPC Participant Recording', function (){ + return client.multiPartyCalls.pauseParticipantRecording(10,{friendlyName: 'TestMPC'}).then(function (response){ + assert(response instanceof PlivoGenericResponse) + }) + }); + + it('should resume MPC Participant Recording', function (){ + return client.multiPartyCalls.resumeParticipantRecording(10,{friendlyName: 'TestMPC'}).then(function (response){ + assert(response instanceof PlivoGenericResponse) + }) + }); + + it('should start MPC Play Audio Member', function (){ + return client.multiPartyCalls.startPlayAudio(10,'https://s3.amazonaws.com/XXX/XXX.mp3', + {friendlyName: 'TestMPC'}).then(function (response){ + assert(response.message, "play queued into MPC") + }) + }); + + it('should stop MPC Play Audio Member', function (){ + return client.multiPartyCalls.stopPlayAudio(10,{friendlyName: 'TestMPC'}).then(function (response){ + assert(response instanceof PlivoGenericResponse) + }) + }); }) diff --git a/test/xml.js b/test/xml.js index 061ac5e..cfc587e 100644 --- a/test/xml.js +++ b/test/xml.js @@ -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('Nairobi',mpcResponse.toXML()); + assert.equal('Nairobi',mpcResponse.toXML()); done(); }); });