Build your apps using voice communication

Program it in your preferred language


Quick start

Make sure you’ve read Getting Started.

About

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.

Set up your voice app

Before you start the setup you should take a look at the API in REST based management APIs section.

To start you need to follow 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. I 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 for the key to our support 

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:

 

High level picture

 

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 doc, 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.

 

How it works

To get started and test the API from your local workstation you can use Postman or our API Reference (powered by SwaggerHub) or cURL as an HTTP client. If you use the Postman collection or API Reference, make sure you update the environment settings with your credentials in order to authenticate.

 

 

If you use cURL scroll down to see the examples.

 

Connect to the API

To start testing the API you need to get authorization credentials. Log in to your account and create a developer app on the My Apps page. The steps to create a developer app are briefly discussed under 'Support' 🡆 'Frequently Asked Questions'.

Get access token

Copy your app's credentials and replace APP_CONSUMER_KEY and APP_CONSUMER_SECRET with the copied values, then execute the below cURL command to receive an access token.

You can use same token to make multiple 'API' calls, provided the token is active. If the token expires then you can repeat this step.


curl -X POST \
 'https://api-prd.kpn.com/oauth/client_credential/accesstoken?grant_type=client_credentials' \
 -H 'content-type: application/x-www-form-urlencoded' \
 -d 'client_id=APP_CONSUMER_KEY&client_secret=APP_CONSUMER_SECRET'

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

{
    "refresh_token_expires_in": "0",
    "api_product_list": "[Voice - Apidaze]",
    "api_product_list_json": [
        "Voice - Apidaze"
    ],
    "organization_name": "kpn",
    "developer.email": "demo123@kpn.com",
    "token_type": "BearerToken",
    "issued_at": "1521039195424",
    "client_id": "2Xvp2YLhEeT8w4cXQWvKuOpMoHQQ9zGx",
    "access_token": "haf2SDl07E9N7RluNQ4kJ1TkGgso",
    "application_name": "6e38ed2d-48b1-4362-97d6-04254065d79c",
    "scope": "",
    "expires_in": "3599",
    "refresh_count": "0",
    "status": "approved"
}

Access APIs

To access the API copy the access_token from the last step to the HTTP header in the request.


Authorization: Bearer access_token