Example Test Environment Setup

This document outlines a sample test environment and configuration that you can use as a reference when setting up your own integration.

Would you like to start using the Calling API but aren’t sure where to begin? Already familiar with the requirements but looking for guidance on the setup? A good way to start is by setting up a test environment!

Initial setup

We’ll use the SIP method to integrate with the Calling API. For this setup, you can either create your own virtual private server (VPS) or use an existing test environment.

In our example, we chose a VPS from Hostinger, which provides a server with FreePBX pre-installed. FreePBX is an essential tool for managing SIP connections and simplifies the configuration and management of VoIP services.

Below are the tools you will need:

Configuring the server

Now that you already have everything to start, let’s configure the environment:

1

Create a SIP extension

In FreePBX, an extension represents a user or device within the system.

For this setup, the extension will represent the user who will connect through a softphone application — in our case, MicroSIP.

When creating the extension:

2

Creating a SIP Trunk

A SIP Trunk in FreePBX is a virtual connection that links your FreePBX system to external networks, such as a telephone service provider or another PBX system.

In this integration, the trunk will connect your FreePBX server directly to Meta, enabling the Calling API to route calls between WhatsApp and your test environment.

To properly handle call flows, you need to create two separate trunks:

This separation ensures that each call direction can be configured and monitored independently, providing better control and easier troubleshooting.

When naming your trunks, use clear and descriptive labels such as Meta-Inbound and Meta-Outbound.

This will make it easier to identify them later when setting up routes or checking logs.

When creating the trunks:

3

Checking Asterisk SIP Settings

Asterisk is the core software engine that FreePBX uses to handle all the actual call processing. FreePBX is essentially a user-friendly interface that sits on top of Asterisk, making it much easier to configure and manage.

Important notes:

  • You don’t need to change anything in the General SIP Settings.

  • Make sure that you’re using the correct certificate in the SSL settings and select TLSv1.2 in the SSL Method.

  • Confirm that the TLS transport is enabled and listening on port 5061. It must match the port configured in the calling settings.

4

Inbound/Outbound Routes

We’re approaching the end of our implementation: now, we just need to configure the routes, and then you’re ready to start testing the Calling API.

5

Testing the Calls

Now you´re able to go to the MicroSIP softphone software and add the Extensions using the name and the secret (password) generated in step 1.

Account name
Calling Inbound

SIP Server

VPS public IPv4 address

Username

Extension username

Password

Extension secret

Domain

VPS hostname/IPv4 address

Media Encryption

Mandatory SRTP (RTP/SAVP)

Transport

TLS

Allow IP Rewrite

True

After that, you can make a user-initiated call and/or get the permissions and start a business-initiated call.

Troubleshooting

It’s important to test calls directly through the terminal to verify that the configuration is working as expected.

By monitoring the logs in real time, you can:

  • Confirm that the calls are correctly established between FreePBX and Meta.

  • Identify errors or warnings that may indicate misconfigurations or connection issues.

  • Gather detailed information about SIP messages and call flow for troubleshooting.

Tip:

Use the Asterisk CLI command below to start monitoring logs:

asterisk -rvvv

During a test call, look for any failed registrations, authentication errors, or SIP negotiation problems. This information will help you determine the root cause of any issue and make the necessary adjustments before moving forward.

Last updated

Was this helpful?