Incorporated retry logic for MPC APIs and validated voice UTs

This commit is contained in:
Koushik-Ayila 2020-10-07 16:40:55 +05:30
parent 9b2831d6f5
commit e57a6bec3b
4 changed files with 18 additions and 16 deletions

View file

@ -327,4 +327,4 @@ export class ApplicationInterface extends PlivoResourceInterface {
id: id
}).delete(params, id);
}
}
}

View file

@ -30,8 +30,9 @@ export class MultiPartyCall extends PlivoResource{
this[clientKey] = client;
}
get(){
return super.executeAction(this.id, 'GET');
get(params = {}){
params.isVoiceRequest = 'true';
return super.executeAction(this.id, 'GET', params);
}
addParticipant(params){
@ -281,16 +282,16 @@ export class MultiPartyCall extends PlivoResource{
else {
params.exitSoundMethod = 'GET'
}
params.isVoiceRequest = 'true';
return super.executeAction(this.id + '/Participant/', 'POST', params)
}
start(){
return super.executeAction(this.id + '/', 'POST', {'status' : 'active'})
return super.executeAction(this.id + '/', 'POST', {'status' : 'active', 'isVoiceRequest' : 'true'})
}
stop(){
return super.delete()
return super.delete({'isVoiceRequest' : 'true'})
}
startRecording(params = {}){
@ -311,27 +312,27 @@ export class MultiPartyCall extends PlivoResource{
else {
params.statusCallbackMethod = 'POST'
}
params.isVoiceRequest = 'true';
return super.executeAction(this.id + '/Record/', 'POST', params)
}
stopRecording(){
return super.executeAction(this.id + '/Record/', 'DELETE')
return super.executeAction(this.id + '/Record/', 'DELETE',{'isVoiceRequest' : 'true'})
}
pauseRecording(){
return super.executeAction(this.id + '/Record/Pause/', 'POST')
return super.executeAction(this.id + '/Record/Pause/', 'POST',{'isVoiceRequest' : 'true'})
}
resumeRecording(){
return super.executeAction(this.id + '/Record/Resume/', 'POST')
return super.executeAction(this.id + '/Record/Resume/', 'POST',{'isVoiceRequest' : 'true'})
}
listParticipants(params = {}){
if(params.callUuid){
validParam('callUuid', params.callUuid, [String], false)
}
params.isVoiceRequest = 'true';
return super.executeAction(this.id + '/Participant/', 'GET', params)
}
}
@ -364,16 +365,16 @@ export class MultiPartyCallParticipant extends PlivoSecondaryResource{
if(params.hold){
validParam('hold', params.hold, [Boolean, String], false)
}
params.isVoiceRequest = 'true';
return super.executeAction(this.id, this.secondaryId, 'POST', params)
}
kickParticipant(){
return super.executeAction(this.id, this.secondaryId, 'DELETE')
return super.executeAction(this.id, this.secondaryId, 'DELETE',{'isVoiceRequest' : 'true'})
}
getParticipant(){
return super.executeAction(this.id, this.secondaryId, 'GET')
return super.executeAction(this.id, this.secondaryId, 'GET',{'isVoiceRequest' : 'true'})
}
}
@ -446,7 +447,7 @@ export class MultiPartyCallInterface extends PlivoResourceInterface{
if(params.offset){
validRange('offset', params.offset, false, 0)
}
params.isVoiceRequest = 'true';
return super.list(params);
}

View file

@ -228,7 +228,7 @@ export function validDateFormat(paramName, paramValue, mandatory = false){
return true;
}
let response = paramValue.match(/^\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}(\.\d{1,6})?$/);
let response = paramValue.match(/^\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}(:\d{2}(\.\d{1,6})?)?$/);
if(response == null){
throw new InvalidRequestError("Invalid Date : Doesn't satisfy the date format")
}

View file

@ -68,6 +68,7 @@ describe('calls', function () {
client.calls.get(1)
.then(function(call){
return call.transfer()
done()
})
.then(function(call) {
assert.equal(call.id, 5)