API menu

Apidaze Voice Documentation

Introduction

With this API you can create or add voice features to your apps while still using your favorite programming language. No knowledge of complex telephone systems is required. You just need a web server and follow simple steps to make it work.

API specification

Test the API on SwaggerHub

Base URL

https://api-prd.kpn.com/communication/apidaze/cpaas

Conceptual model

Apidaze Voice Conceptual model

Definitions

Callback (WebHook)

A Callback or WebHook is a HTTP POST callback implemented by you, that can be called by another system when an event is triggered on that system to notify you. You will need to make the address of your webhook/callback known on the other system to make it work.

Virtual number

A virtual number is a telephone number without a directly associated telephone line. Usually these numbers are programmed to forward incoming calls to one of the pre-set telephone numbers, chosen by the client: fixed, mobile or VoIP.

SIP

The Session Initiation Protocol (SIP) is used for signaling and controlling multimedia communication sessions in applications of Internet telephony for voice and video calls, in private IP telephone systems, in instant messaging over Internet Protocol (IP) networks as well as mobile phone calling over LTE (VoLTE).

API workflow

Apidaze Voice API workflow

Features and constraints

Features

  • Event based system that will be triggered during the call flow.
  • Use your own scripting to take action on events in the call flow.
  • Support for sample playing in .wav format.
  • Text to speech support.

Constraints

  • Works with a SIP account.
  • For text to speech currently supported languages are: en-US, fr-FR, it-IT and es-ES.

Getting started

Make sure you've read What's in it for you for more info on how to register and start testing APIs.

Authentication

The API follows the KPN Store API Authentication Standard to secure the API. It includes the use of OAuth 2.0 client_id and client_secret to receive an access token.

Go to the Authentication tab on top of this page to find out how to:

  • Authenticate to an API using cURL.
  • Authenticate to an API on Swaggerhub.
  • Import Open API Specifications (OAS), also called Swagger files into Postman.

Setting up management APIs

You have an API for XML scripting and a VoIP SIP API. These REST management APIs expose actions that help your apps to interact with APIdaze’s Telco platform in multiple ways. Voice traffic never flows through these APIs.

XML scripting API

You can set the URL from where Apidaze fetches XML instructions to run on the Apidaze platform. You can write your various scripts there using the Script Reference and then test them.

VoIP SIP API

You can manage your phone numbers, connect directly with other SIP carriers (inbound and outbound), manage your SIP accounts, voicemail boxes and messages, and provision your hardphones.

To start you need to follow the below steps.

Set the URL for your External Script

Your ExternalScript is the core element of your application. It must be accessible by Apidaze at a public HTTP URL. Any PaaS (Platform as a Service) like Heroku can be used here, and you may of course use your own web infrastructure. You can set the URL of your ExternalScript using 'External Script Create' resource of XML Scripting API.

Set up your code

You can set up your code using the below sources:

Script Reference: the XML instructions set to handle your calls

API Reference: the REST based management APIs

Set up your SIP account

Create your SIP account using 'SIP Account Create' resource of VoIP SIP API.

Set up your SIP client

In order to setup your SIP client your need fetch below details using REST APIs. We will use Zoiper as an example SIP Client.

a) Domain/Host: You can get this info using 'SIP Account Status' resource of VoIP SIP API. Ask our support for the key.

b) Username: You can get this info using 'SIP Account List' resource of VoIP SIP API.

c) Password: You can get this info using 'SIP Account List' resource of VoIP SIP API.

d) 'Optional SIP credentials' > 'Use outbound proxy' should be filled with 46.101.153.96:4060. This is a fixed value and you cannot configure it.

e) Account Name: You will see this in your app once your registration is successful.

Your configuration should look like this:

Apidaze Voice SIP config

High level picture:

Apidaze Voice API workflow SIP

How to...

Manage VOIP SIP API requests

List SIP accounts

Get a list of SIP accounts currently set up.

SwaggerHub:

  1. Select GET /sipaccounts.
  2. Click Try it out.
  3. Click Execute.
  4. Check the response code and message.

Postman:

  1. Select (GET) SIP Account List.
  2. Click Send.
  3. Check the response code and message.
Response example
[ { "id": "string", "name": "string", "sip": { "username": "string", "password": "string" }, "callerid": { "internal_name": "string", "internal_number": "string", "external_name": "string", "external_number": "string" }, "voicemail": { "mwi_account": "string" }, "created_at": "string", "updated_at": "string" } ]

Create a new SIP account

SwaggerHub:

  1. Select POST /sipaccounts.
  2. Click Try it out.
  3. Edit the parameters by filling out username which will be the username to identify this SIP account. Other optional values are internal_caller_id_number, external_caller_id_number, name and mwi_account.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (POST) SIP Account Create.
  2. Click on the Body section and enter a value for the username variable, which will be the username to identify this SIP account. Other optional values are internal_caller_id_number, external_caller_id_number, name and mwi_account.
  3. Click Send.
  4. Check the response code and message.

Get a specific SIP account

Get the detail of a specific SIP account determined by its ID.

SwaggerHub:

  1. Select GET /sipaccounts/{id}.
  2. Click Try it out.
  3. Edit the parameters by filling out id which will be the id to identify this SIP account.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (GET) SIP Account Read.
  2. Provide the id of the account to read in the parameter id of the URL.
  3. Click Send.
  4. Check the response code and message.

Update a SIP account

Update the values of a single SIP account determined by its ID.

SwaggerHub:

  1. Select PUT /sipaccounts/{id}.
  2. Click Try it out.
  3. Edit the parameters by filling out id which will be the id to identify this SIP account. Other optional values are internal_caller_id_number, external_caller_id_number, name and mwi_account.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (PUT) SIP Account Update.
  2. Click on the Body section and enter a value for the id variable, which will be the id to identify this SIP account. Other optional values are internal_caller_id_number, external_caller_id_number, name and mwi_account.
  3. Click Send.
  4. Check the response code and message.

Delete a SIP account

Deletes a single SIP account determined by its ID.

SwaggerHub:

  1. Select DELETE /sipaccounts/{id}.
  2. Click Try it out.
  3. Edit the parameters by filling out id which will be the id to identify this SIP account.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (DEL) SIP Account Delete.
  2. Provide the id of the account to read in the parameter id of the URL.
  3. Click Send.
  4. Check the response code and message.

Get the status a SIP account

Gets the status of a single SIP account determined by its ID.

SwaggerHub:

  1. Select GET /sipaccounts/{id}/status.
  2. Click Try it out.
  3. Edit the parameters by filling out id which will be the id to identify this SIP account.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (GET) SIP Account Status.
  2. Provide the id of the account to read in the parameter id of the URL.
  3. Click Send.
  4. Check the response code and message.

Manage XML scripting API requests

Get a list of external scripts as currently set up.

SwaggerHub:

  1. Select GET /externalscripts.
  2. Click Try it out.
  3. Click Execute.
  4. Check the response code and message.

Postman:

  1. Select (GET) External Script List.
  2. Click Send.
  3. Check the response code and message.
Response example
[ { "id": "string", "name": "string", "url": "string", "created_at": "string", "updated_at": "string" } ]

Create new external script

SwaggerHub:

  1. Select POST /externalscripts.
  2. Click Try it out.
  3. Edit the parameters by filling out url which points to the URL where your script is hosted. Other optional values are name.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (POST) External Script Create.
  2. Click on the Body section and enter a value for the url variable, which points to the URL where your script is hosted. Other optional values are name.
  3. Click Send.
  4. Check the response code and message.

Get a specific external script

Get the detail of a specific external script determined by its ID.

SwaggerHub:

  1. Select GET /externalscripts/{id}.
  2. Click Try it out.
  3. Edit the parameters by filling out id which will be the id to identify this external script.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (GET) External Script Read.
  2. Provide the id of the external script to read in the parameter id of the URL.
  3. Click Send.
  4. Check the response code and message.

Update an external script

Update the values of a single external script determined by its ID.

SwaggerHub:

  1. Select PUT /externalscripts/{id}.
  2. Click Try it out.
  3. Edit the parameters by filling out id which will be the id to identify this external script and url, which points to the URL where your script is hosted. Other optional values are name.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (PUT) External Script Update.
  2. Click on the Body section and enter a value for the id variable, which will be the id to identify this external script, as well as url, which points to the URL where your script is hosted. Other optional values are name.
  3. Click Send.
  4. Check the response code and message.

Delete an external script

Deletes a single external script determined by its ID.

SwaggerHub:

  1. Select DELETE /externalscripts/{id}.
  2. Click Try it out.
  3. Edit the parameters by filling out id which will be the id to identify this external script.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (DEL) External Script Delete.
  2. Provide the id which will be the id to identify this external script.
  3. Click Send.
  4. Check the response code and message.

Test an external script

Trigger a single external script determined by its ID.

SwaggerHub:

  1. Select GET externalscripts/test.
  2. Click Try it out.
  3. Edit the parameters by filling out url, which points to the URL where your script is hosted.
  4. Click Execute.
  5. Check the response code and message.

Postman:

  1. Select (GET) External Script Test.
  2. Provide the id which will be the id to identify this external script.
  3. Click Send.
  4. Check the response code and message.