Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voice API callTo Parameter Only Initiates Call to Last Number in Array #111

Closed
oxenprogrammer opened this issue Sep 7, 2023 · 6 comments

Comments

@oxenprogrammer
Copy link

Issue Description

The Voice API currently specifies the CallTo parameter as an array of phone numbers in comma-separated string format, which can be passed to the options object as shown below:

 const options = {
      callFrom: "+256******", // Set your Africa's Talking phone number in international format
      callTo: ["+2567*******", "+256*******"], // Set the numbers you want to call to in a comma-separated list
    };

However, when initiating a call, it appears that the API is only dialing the last number in the array, rather than calling all the numbers as expected.

Expected Behavior

The expected behavior is for the callTo parameter to facilitate calling all the numbers listed in the array, ensuring that each number in the list receives a call.

@oxenprogrammer oxenprogrammer changed the title Title: "Voice API callTo Parameter Only Initiates Call to Last Number in Array" Voice API callTo Parameter Only Initiates Call to Last Number in Array Sep 7, 2023
@SamuelMwangiW
Copy link

SamuelMwangiW commented Sep 8, 2023

Hi @oxenprogrammer

As indicated in the README, the callTo parameter should be a string and not an Array.

- `voice.call({ callFrom, callTo })`: Initiate a phone call
- `callFrom`: Your Africa's Talking issued virtual phone number. `REQUIRED`
- `callTo`: Comma-separated string of phone numbers to call. `REQUIRED`
- `clientRequestId`: Additional information that can be used to tag the call in your callback URL.

I have tested and confirmed with the following sample code

import {username, apikey, callFrom} from './config.js'
import AT from 'africastalking'

const credentials = {
    apiKey: apikey,
    username: username
};
const callTo = '+2547XXXXXXXX,+2547YYYYYYYY';

const voice = AT(credentials).VOICE

voice
    .call({callFrom, callTo})
    .then((res) => res)

EDIT: My bad. I have confirmed and a comma separated array should also work as per the code

if(typeof callTo === 'string'){
callTo = callTo.split(',');
};
if(!Array.isArray(callTo)){
reject('"callTo" can only be an array of phoneNumbers, or a string of comma-separated phoneNumbers');
};

@oxenprogrammer
Copy link
Author

@SamuelMwangiW I could push a fix but I also created an issue here on community Contribution Guidelines as a I couldn't get one.

@SamuelMwangiW
Copy link

@SamuelMwangiW I could push a fix but I also created an issue here on community Contribution Guidelines as a I couldn't get one.

@DaggieBlanqx kindly advise

@oxenprogrammer
Copy link
Author

@DaggieBlanqx is anything going to get done here?
Actually this whole thing doesn't work in version 0.6.2, it works on 0.5.5.
Is there a problem with the call API?

@DaggieBlanqx
Copy link
Member

Hello @oxenprogrammer, we are fixing this. Thank you for your patience.

@DaggieBlanqx
Copy link
Member

Hello @oxenprogrammer ,
This bug has now been fixed on 0.6.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants