Skip to content

Commit

Permalink
Merge pull request #221 from plivo/buynumber-fix
Browse files Browse the repository at this point in the history
Buy number API & Live call Interface
  • Loading branch information
huzaif-plivo authored Oct 13, 2021
2 parents 5eb7ec6 + 4b12121 commit dbafd89
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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/).
Expand Down
14 changes: 7 additions & 7 deletions lib/resources/call.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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 => {
Expand Down Expand Up @@ -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));
Expand All @@ -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 = [];
Expand Down
4 changes: 2 additions & 2 deletions lib/resources/numbers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/rest/request-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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: {
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.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": [
Expand Down

0 comments on commit dbafd89

Please sign in to comment.