Using the command-line tool to link a Twilio number.
While Fonoster supports multiple SIP providers, Twilio is one of the easiest to set up. This guide will show you how to link a Twilio phone number to your application using the command-line tool.
Request early access
To get started, you need to request early access to Fonoster. You can do this by visiting the GitHub Discussions and following the instructions.
Sign up for a Twilio account
You need a Twilio account to link a Twilio phone number to your Fonoster application. You can sign up for a Twilio account by visiting the Twilio website and following their documentation.
Link your virtual phone number
Follow the next steps to link a virtual phone number to your application:
Install the command-line tool
Fonoster CTL is a command-line tool that allows you to manage your Fonoster resources. You can create, update, and delete Fonoster resources like phone numbers, SIP trunks, etc.
You can install the tool using the following command:
Check that the installation was successful by running the following command:
If the installation was successful, you should see the version number of the command-line tool.
Log in to a Fonoster Workspace
Before using the command-line tool, log in to a Workspace. You can do this by running the following command:
This command will prompt you to enter your AccessKeyId and AccessKeySecret. Once you have entered this information, you will be logged in to your Workspace.
Create a new Application
To create a new Application, you can use the following command:
You will be asked to enter the Application’s name, speech information, and other details. Once you have entered this information, the Application will be created.
Your output should look like this:
Yo can list your existing applications with the following command:
Link a Twilio phone number
To link a Twilio phone number to your application, you can use the following command:
You will be asked to enter an existing virtual phone number, the Twilio SID, and the Twilio Auth Token. Once you have entered this information, the Twilio phone number will be linked to your application.
To confirm that the phone number was linked successfully, you can run the following command:
You can now call the Twilio phone number to access your voice application.
Twilio is used as an example. You can use other SIP providers as well.
Make an outbound call
You can use the command-line tool or the SDK to make an outbound call. To make an outbound call, first, you need the reference of the application you created. You can get the reference by running the following command:
Once you have the reference, you can use the fonoster sipnet:calls:create
command to make an outbound call. Here is an example:
You can also use the SDK to make an outbound call. To do this, you can use the following code:
Replace the example values with the appropriate ones.
Now that you have linked a Twilio phone number to your application, you can start making and receiving calls using the command-line tool or the SDK.
Learn more about the Programmable Voice API and how to build advanced voice applications.
Learn how to use the Node.js and Web SDKs to interact with Fonoster programmatically.