Skip to main content

Making a Basic Call

First you've completed the initial setup, the most important step is to But a PIOPIY number. Once the number is configured and the server is started,the call will be received for the customer’s number. When the customer answers the call, it will be connected to the agent’s number.

1.Prerequisites

Before you start, ensure you have the following:

2.Clone the repository

Use the git clone command to clone the PIOPIY node from our TeleCMI github repository.

git clone https://github.com/telecmi/piopiy_node_example.git

First, clone this repository to your local machine:

cd piopiy_node_example

3.Install the piopiy npm package

Once inside the project directory, install the required npm packages:

npm install

4.Code

const { Piopiy } = require("piopiy");
const piopiy = new Piopiy("your_app_id", "your_app_secret");

const customer_number = "Your customer number"; // Your customer phone number with country code.
const piopiy_number = "Your piopiy number"; // Your piopiy number provided by the Piopiy TeleCMI platform.
const agent_number = "Your agent phone number"; // Your agent phone number with country code.
const options = { duration: 10, timeout: 20, loop: 1, record: true };

const basic_call = async () => {
const res = await piopiy.voice.call( customer_number, piopiy_number, agent_number, options )
}

basic_call()

5.Configure the call parameters

Replace the value in the Basic Call code with your actual values for

6.Run the code

Execute the code using Node.js:

node sdk_example/outbound_call/basic.js

7. Make an Outgoing Call

Once everything is set up, server is started,the call will be received for the customer’s number. When the customer answers the call, it will be connected to the agent’s number.