VoIP Innovations

Apidaze Voice - VoIP Innovations

VoIP Innovations

Build voice interactions in your favorite programming language

Low cost and easy to scale up

  • Communication

API reference on SwaggerHub API reference on Postman

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.

Conceptual model

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

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

Setting up your third party accounts

Make sure you have a registered account on the API Store and created an application on the portal, to receive the associated client ID and secret. These are neccessary to request an access token. You will receive these after your app is approved on te API Store.

Authentication

OAuth 2.0

For accessing and/or manipulating the resources, the client application (your application) needs to be granted permission to do so. The OAuth 2.0 standard defines a protocol that allows such third-party authorization through the use of access tokens. Access tokens are central in the protocol: those tokens, in the form of strings, are delivered by an authorization server (our authentication server) and they enable the client application to securely access protected data on behalf of the resource owner (the end-user). We use Client Credentials Grant which means the application makes the request to the authentication service by sending authorization credentials and the service responds with an access token among other useful information.

Get Access Token

Copy your app's credentials (Consumer Key & Consumer Secret) to be used in the Authentication requests below.

Authentication in SwaggerHub:

  1. Upon loading completed within SwaggerHub, look top right for the Authorize button and click it.
  2. In the form, fill in client_id and client_secret fields, using your app's credentials.
  3. Click Authorize.
  4. Now you are authorized to issue the requests provided.

Authentication in Postman:

  1. Select Get Access Token from the collection.
  2. Make sure the right Environment corresponding to the API is selected.
  3. Edit the environment variables client_id and client_secret, using your app's credentials.
  4. Check the response code and message.
  5. Press the Send button to get the access token.
  6. Now you are authorized to issue the other requests in the collection.

The authorization service returns a JSON message that contains the access_token field.

{
    "refresh_token_expires_in": "0",
    "api_product_list": "[xxxxxxx]",
    "api_product_list_json": [
        " xxxxxxx"
    ],
    "organization_name": "kpn",
    "developer_email": "demo123@kpn.com",
    "token_type": "Bearer",
    "issued_at": "1521039195424",
    "client_id": "APP_CONSUMER_KEY",
    "access_token": "haf2SDl07E9N7RluNQ4kJ1TkGgso",
    "application_name": "6e38ed2d-48b1-4362-97d6-04254065d79c",
    "scope": "",
    "expires_in": "3599",
    "refresh_count": "0",
    "status": "approved"
}

REST based management APIs

These REST APIs expose actions that help your apps to interact with APIdaze’s Telco platform in multiple ways. Voice traffic never flows through these REST 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.

Configuration setup

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:

SIP Configuration

High level picture

SIP Sequence Diagram

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.

Result 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.

Result 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.

Return codes

Code   Description
200   Success
201   Created
202   Accepted
302   Found. Link in location header
400   Bad request
401   Unauthorized
403   Forbidden
404   Not found
405   Method not allowed
412   Precondition failed
429   Too many requests
500   Internal server error
502   Bad gateway
503   Service unavailable

API versions

Version   Description
1.0   Initial version