Connecting to Multiple Numbers
The call()
method in the PiopiyAction
class allows you to initiate a call from one number to multiple recipients. The call will attempt to connect to each number in sequence, with customizable options such as call duration, timeouts, retries, and recording.
call(from, to, options)
parameter | Type | Description |
---|---|---|
from | number | The caller's phone number |
to | number / array | A single receiver's phone number or an array of phone numbers. |
options | Object | An object containing optional parameters (duration,timeout,loop and record) |
duration | number | Maximum call duration in seconds |
timeout | number | Time in seconds to wait for input |
loop | number | Number of retry attempts for each number |
record | boolean | Whether to record the call |
Example Implementation
- The following example demonstrates how to connect a call from one number to multiple recipients, retrying each number twice, with a 10-second call duration and a 20-second timeout for each attempt. The call will also be recorded for set record true.
- Node.js
- Python
const { PiopiyAction } = require("piopiy");
const action = new PiopiyAction();
action.call([9198xxxxxx, 9194xxxxx] ,9180xxxx, { duration: 10, timeout: 20, loop: 2, record: true })
from piopiy import Action
# Create an instance of the Action class
action = Action()
action.call([9198xxxxxx, 9194xxxxx] ,9180xxxx, { "duration": 10, "timeout": 20, "loop": 2, "record": True })