Skip to content

Commit 09a063a

Browse files
Merge pull request #358 from plivo/VPT-5202
VPT-5202: Plivo Send Digits Call is Failing
2 parents 5145ba0 + cc55fc6 commit 09a063a

File tree

6 files changed

+17
-8
lines changed

6 files changed

+17
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
## [v4.72.0](https://github.com/plivo/plivo-node/tree/v4.72.0) (2025-06-16)
4+
**Bug Fix - sendDigits validation issue**
5+
- Fixed `isRequired` validator to properly handle falsy values including the number `0`, resolving "Missing mandatory field: digits" error when sending digit "0"
6+
- Updated TypeScript definitions for `sendDigits` method to accept `string` instead of `number` to match API expectations and existing tests
7+
38
## [v4.71.0](https://github.com/plivo/plivo-node/tree/v4.71.0) (2025-06-13)
49
**Bug Fix**
510
- Added HTTP/HTTPS agent configuration with connection pooling to prevent progressive API latency increase.

lib/resources/call.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export class Call extends PlivoResource {
459459
/**
460460
* Send digits on a call
461461
* @method
462-
* @param {number} digits - digits to be send
462+
* @param {string} digits - digits to be send
463463
* @param {object} optionalParams - to send digits for call
464464
* @promise {object} returns PlivoGenericResponse Object
465465
* @fail {Error} returns Error
@@ -981,7 +981,7 @@ export class CallInterface extends PlivoResourceInterface {
981981
* Send digits on a call
982982
* @method
983983
* @param {string} callUUID - call uuid to send digits on a call
984-
* @param {number} digits - digits to be send
984+
* @param {string} digits - digits to be send
985985
* @param {object} optionalParams - optional params to send digits
986986
* @promise {object} returns PlivoGenericResponse Object
987987
* @fail {Error} returns Error

lib/utils/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export let validate = (() => {
3434
// };
3535

3636
Validators.isRequired = field => {
37-
return !field;
37+
return field === null || field === undefined || field === '';
3838
};
3939

4040
Validators.isTemplate = field => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "plivo",
3-
"version": "4.71.0",
3+
"version": "4.72.0",
44
"description": "A Node.js SDK to make voice calls and send SMS using Plivo and to generate Plivo XML",
55
"homepage": "https://github.com/plivo/plivo-node",
66
"files": [

test/calls.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ describe('calls', function () {
152152
it('should send digits', function () {
153153
return client.calls.sendDigits('aaa-deeiei3-dfddd', '123');
154154
});
155+
156+
it('should send digits with zero', function () {
157+
return client.calls.sendDigits('aaa-deeiei3-dfddd', '0');
158+
});
155159
});
156160

157161
describe('Play', function () {

types/resources/call.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,12 @@ export class Call extends PlivoResource {
248248
/**
249249
* Send digits on a call
250250
* @method
251-
* @param {number} digits - digits to be send
251+
* @param {string} digits - digits to be send
252252
* @param {object} optionalParams - to send digits for call
253253
* @promise {object} returns PlivoGenericResponse Object
254254
* @fail {Error} returns Error
255255
*/
256-
sendDigits(digits: number, optionalParams: object): Promise < SendDigitsResponse > ;
256+
sendDigits(digits: string, optionalParams: object): Promise < SendDigitsResponse > ;
257257
/**
258258
* Hangup a Call Request
259259
* @method
@@ -424,12 +424,12 @@ export class CallInterface extends PlivoResourceInterface {
424424
* Send digits on a call
425425
* @method
426426
* @param {string} callUUID - call uuid to send digits on a call
427-
* @param {number} digits - digits to be send
427+
* @param {string} digits - digits to be send
428428
* @param {object} optionalParams - optional params to send digits
429429
* @promise {object} returns PlivoGenericResponse Object
430430
* @fail {Error} returns Error
431431
*/
432-
sendDigits(callUUID: string, digits: number, optionalParams: object): Promise < any > ;
432+
sendDigits(callUUID: string, digits: string, optionalParams: object): Promise < any > ;
433433
/**
434434
* Hangup a call request
435435
* @method

0 commit comments

Comments
 (0)