Merge pull request #221 from plivo/buynumber-fix

Buy number API & Live call Interface
This commit is contained in:
Mohammed Huzaif 2021-10-13 12:17:10 +05:30 committed by GitHub
commit dbafd8924e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 13 deletions

View file

@ -1,11 +1,16 @@
# Change Log
## [v4.23.1](https://github.com/plivo/plivo-node/tree/v4.23.1) (2021-10-13)
**Bug Fix**
- LiveCallInterface.
- [Buy Number API](https://www.plivo.com/docs/numbers/api/phone-number#buy-a-phone-number) to support app_id
## [v4.23.0](https://github.com/plivo/plivo-node/tree/v4.23.0) (2021-10-11)
**Features - Messaging**
- This version includes advancements to the Messaging Interface that deals with the [Send SMS/MMS](https://www.plivo.com/docs/sms/api/message#send-a-message) interface, Creating a standard structure for `request/input` arguments to make implementation easier and incorporating support for the older interface.
Example for [send SMS](https://github.com/plivo/plivo-node#send-a-message)
## [v4.22.4](https://github.com/plivo/plivo-node/tree/v4.22.4) (2021-09-27)
**Bug Fix**
- Handle invalid destination number API response for send [SMS API](https://www.plivo.com/docs/sms/api/message/send-a-message/).

View file

@ -920,8 +920,8 @@ class LiveCallInterface extends PlivoResourceInterface {
if (action !== '' && !id) {
reject(new Error(this[idKey] + ' must be set'));
}
client('GET', action + (id ? id + '/?status=live' : '') , {
isVoiceRequest: 'true'
client('GET', action + id, {
isVoiceRequest: 'true', status: 'live'
})
.then(response => {
resolve(new GetLiveCallResponse(response.body, client));
@ -941,7 +941,7 @@ class LiveCallInterface extends PlivoResourceInterface {
params.status = 'live'
params.isVoiceRequest = 'true';
return new Promise((resolve, reject) => {
client('GET', action+'?status=live', params)
client('GET', action, params)
.then(response => {
let calls = [];
response.body.calls.forEach(callUuid => {
@ -997,8 +997,8 @@ class QueuedCallInterface extends PlivoResourceInterface {
reject(new Error(this[idKey] + ' must be set'));
}
client('GET', action + (id ? id + '/?status=queued' : ''), {
isVoiceRequest: 'true'
client('GET', action + id, {
isVoiceRequest: 'true', status: 'queued'
})
.then(response => {
resolve(new GetQueuedCallResponse(response.body, client));
@ -1015,8 +1015,8 @@ class QueuedCallInterface extends PlivoResourceInterface {
let client = this[clientKey];
return new Promise((resolve, reject) => {
client('GET', action+'?status=queued', {
isVoiceRequest: 'true'
client('GET', action, {
isVoiceRequest: 'true', status: 'queued'
})
.then(response => {
let calls = [];

View file

@ -80,10 +80,10 @@ export class PhoneNumber extends PlivoResource {
* @promise {@link PlivoGenericResponse} return PlivoGenericResponse Object if success
* @fail {Error} return Error
*/
buy(appId) {
buy(number,appId) {
return new PhoneNumberInterface(this[clientKey], {
id: this.id
}).buy(appId);
}).buy(number,appId);
}
}

View file

@ -36,7 +36,7 @@ export function Request(config) {
return new Promise((resolve, reject) => {
// LiveCall - needs to be at top
if (method === 'GET' && action === 'Call/6653422-91b6-4716-9fad-9463daaeeec2/?status=live') {
if (method === 'GET' && action === 'Call/6653422-91b6-4716-9fad-9463daaeeec2' && params['status'] === 'live') {
resolve({
response: {},
body: {
@ -52,7 +52,7 @@ export function Request(config) {
});
}
else if (method === 'GET' && action === 'Call/?status=live') {
else if (method === 'GET' && action === 'Call/' && params['status'] === 'live') {
resolve({
response: {},
body: {

View file

@ -1,6 +1,6 @@
{
"name": "plivo",
"version": "4.23.0",
"version": "4.23.1",
"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": [