Project

General

Profile

API - Inbound Routes Read

Inbound Routes API is used to read the active Inbound routes from the PBX (the incoming numbers and their destination).

API URL

https://[YOUR-PBX-URL]/api/inbound-routes

Data is sent via POST or GET and must be of the form:

Array
(
    [action] => read
    [page] => 1
    [filters] => Array
        (
            [project_id] =>
            [search] => 
        )

    [api_hash] => 07112231a9c89f5b108af08608a97b07
)

The action parameter must have the value read (default). The page parameter defaults to 1 and is incremented up to pagination.max_page (a page greater than max_page still returns the last page). Routes are returned 100 per page, sorted by number.

HTTP Headers:

Content-Type: application/json
Authorization: Bearer <token>

Filters:

  • project_id: project ID in the PBX or an array of IDs; -1 in the list also includes routes without a project
  • search: search by number, comments, destination, description

Any other filter returns the Invalid filter: ... error.

Example of parameters generation:

$params = array(
    'action' => 'read',
    'page' => 1,
    'filters' => array(
        'project_id' => null,
        'search' => null,
    )
);

Example of hash generation:

$params['api_hash'] = md5(json_encode($params) . 'your_api_key'); // make hash

Example of sending data:

$url = 'https://[YOUR-PBX-URL]/api/inbound-routes';
$token = 'your_api_token';
echo curlPost($url, json_encode($params), array("Authorization: Bearer {$token}", "Content-Type: application/json"));

Data sent JSON

{
  "action": "read",
  "page": 1,
  "filters": {
    "project_id": null,
    "search": null
  },
  "api_hash": "de1b56d49bf027503ef3ecee05b9c59d" 
}

Response

If successful:

{

    "has_error": false,
    "messages": [ ],
    "pagination": {
        "row_count": 1,
        "page_size": 100,
        "current_page": 1,
        "max_page": 1,
        "first_displayed_page": 1,
        "last_displayed_page": 1
    },
    "results": [
        {
            "id": 2,
            "type": "queue",
            "destination": "sales",
            "trunk_id": null,
            "outbound_number": "0212345000",
            "description": "Vanzari",
            "project_id": 1,
            "variables": "SKIP_WELCOME=1",
            "comments": null,
            "status": "active",
            "numbers": [
                "0212345000",
                "0212345001" 
            ],
            "project_name": "Test project",
            "project_alias": "test-project",
            "trunk_name": null,
            "schedule_cnt": 7,
            "variables_arr": {
                "SKIP_WELCOME": "1" 
            },
            "destination_id": 3,
            "destination_link": "/pbx/queues?edit=3" 
        }
    ]

}

Or in case of error:

{

    "has_error": true,
    "messages": [
        "Invalid filter: xxx" 
    ],
    "results": [ ]

}

Available in other languages: RO