### GET /pg_mgr/install/installable Source: https://wazo-platform.org/documentation/api/provisioning Retrieves a list of all installable plugins available on the system. ```APIDOC ## GET /pg_mgr/install/installable ### Description Retrieves a list of all installable plugins available on the system. ### Method GET ### Endpoint `/pg_mgr/install/installable` ### Parameters (No parameters for this endpoint) ### Responses #### Success Response (200) OK - **pkgs** (object) - A map of plugin names to plugin details - **capabilities** (object) - Plugin capabilities - **description** (string) - Plugin description - **dsize** (integer) - Download size of the plugin - **sha1sum** (string) - SHA1 checksum of the plugin - **version** (string) - Plugin version ### Request Example (No request body for this endpoint) ### Response Example ```json { "pkgs": { "property1": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" }, "property2": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" } } } ``` ``` -------------------------------- ### GET /pg_mgr/install/installed Source: https://wazo-platform.org/documentation/api/provisioning Retrieves a list of all installed plugins. ```APIDOC ## GET /pg_mgr/install/installed ### Description Get the installed plugins list. ### Method GET ### Endpoint /pg_mgr/install/installed ### Parameters #### Query Parameters None #### Path Parameters None ### Request Example None ### Response #### Success Response (200) - **pkgs** (object) - An object containing information about installed packages. - **property1** (object) - Details of a specific package (key is package name). - **capabilities** (object) - Capabilities of the package. - **property1** (object) - Details of a capability. - **property1** (string) - **property2** (string) - **property2** (object) - Details of another capability. - **property1** (string) - **property2** (string) - **description** (string) - Description of the package. - **dsize** (integer) - Download size of the package. - **sha1sum** (string) - SHA1 checksum of the package. - **version** (string) - Version of the package. #### Response Example ```json { "pkgs": { "property1": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" }, "property2": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" } } } ``` ``` -------------------------------- ### GET /pg_mgr/plugins Source: https://wazo-platform.org/documentation/api/provisioning Lists all installed plugins and their resources. ```APIDOC ## GET /pg_mgr/plugins ### Description List the installed plugins. ### Method GET ### Endpoint `/pg_mgr/plugins` ### Responses #### Success Response (200) List of all the installed plugins and their resources (Response body structure not detailed in provided text) ``` -------------------------------- ### Get Installation Service Resources (API) Source: https://wazo-platform.org/documentation/api/provisioning Retrieves the installation service resources for the Wazo platform. Requires 'provd.pg_mgr.install.read' ACL and '_wazo_auth_token_' authorization. Returns links to related resources. ```json { "links": [ { "href": "string", "rel": "string" } ] } ``` -------------------------------- ### Get Installed Plugin Information (JSON Response Sample) Source: https://wazo-platform.org/documentation/api/plugins This JSON snippet illustrates the response format for fetching information about an installed plugin. It includes the plugin's name, namespace, and current version. This data is obtained via the `get/plugins/{namespace}/{name}` endpoint and is crucial for verifying installed plugin details. ```json { "name": "string", "namespace": "string", "version": "string" } ``` -------------------------------- ### Setup Integration Tests (Bash) Source: https://wazo-platform.org/documentation/overview/application-dev This snippet outlines the steps to set up and run integration tests, which require Docker. It involves installing dependencies, cloning a repository, setting an environment variable, and executing make commands. ```bash cd integration_tests pip install -r test-requirements.txt git clone https://github.com/wazo-platform/chan-test export CHAN_TEST_DIR=$PWD/chan-test # CHAN_TEST_DIR defaults to ../../chan-test make test-setup make test ``` -------------------------------- ### GET /pg_mgr/plugins/{plugin_id}/install/installable Source: https://wazo-platform.org/documentation/api/provisioning Retrieves a list of installable packages for a given plugin, including details like version, size, and checksum. ```APIDOC ## GET /pg_mgr/plugins/{plugin_id}/install/installable ### Description Retrieves a list of installable packages for a given plugin, including details like version, size, and checksum. ### Method GET ### Endpoint `/pg_mgr/plugins/{plugin_id}/install/installable` ### Parameters #### Path Parameters - **plugin_id** (string) - Required - Plugin ID ### Responses #### Success Response (200) OK - **pkgs** (object) - A map of package names to package details - **capabilities** (object) - Package capabilities - **description** (string) - Package description - **dsize** (integer) - Download size of the package - **sha1sum** (string) - SHA1 checksum of the package - **version** (string) - Package version #### Error Response (404) No such resource. The provided id does not exist. ### Request Example (No request body for this endpoint) ### Response Example ```json { "pkgs": { "property1": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" }, "property2": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" } } } ``` ``` -------------------------------- ### POST /setup Source: https://wazo-platform.org/documentation/api/setup Sets up the Wazo Engine with the provided options. This endpoint requires authentication and specific authorization to modify setup configurations. ```APIDOC ## POST /setup ### Description Sets up the Wazo Engine with the provided options. This endpoint requires authentication and specific authorization to modify setup configurations. ### Method POST ### Endpoint /setup ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **engine_instance_uuid** (string) - Optional - The UUID identifying this instance on Nestbox. Should only be specified if the instance has already been registered. - **engine_internal_address** (string) - Optional - IP address of the engine. - **engine_language** (string) - Required - The interface language for the Wazo Engine (e.g., `en_US`, `fr_FR`). - **engine_license** (boolean) - Required - Whether the GNU GPLv3 license is accepted. - **engine_password** (string) - Required - Password of the first administrator `root` on the engine. - **engine_rtp_icesupport** (boolean) - Optional - Default: `false` - Enable ICE support for WebRTC. Requires `engine_rtp_stunaddr`. - **engine_rtp_stunaddr** (string) - Optional - Default: `null` - The address of the STUN server to use for WebRTC. - **nestbox_engine_host** (string) - Optional - Host used by Nestbox to contact the engine. - **nestbox_engine_port** (integer) - Optional - Default: `443` - Port used by Nestbox to contact the engine. - **nestbox_host** (string) - Optional - Host of the Nestbox where the engine will register. Makes `engine_internal_address` mandatory. - **nestbox_instance_name** (string) - Optional - Name of the engine in Nestbox. - **nestbox_instance_preferred_connection** (string) - Optional - Default: `public` - Enum: `private`, `public` - Preferred connection method to contact the engine. - **nestbox_port** (integer) - Optional - Default: `443` - Port of the Nestbox where the engine will register. - **nestbox_service_id** (string) - Optional - Nestbox username used to register the engine. - **nestbox_service_key** (string) - Optional - Nestbox password used to register the engine. - **nestbox_verify_certificate** (boolean) - Optional - Default: `true` - Should the certificate used for HTTPS be verified? ### Request Example ```json { "engine_instance_uuid": "string", "engine_internal_address": "string", "engine_language": "en_US", "engine_license": true, "engine_password": "your_password", "engine_rtp_icesupport": false, "engine_rtp_stunaddr": "null", "nestbox_engine_host": "string", "nestbox_engine_port": 443, "nestbox_host": "string", "nestbox_instance_name": "string", "nestbox_instance_preferred_connection": "private", "nestbox_port": 443, "nestbox_service_id": "string", "nestbox_service_key": "string", "nestbox_verify_certificate": true } ``` ### Response #### Success Response (201) - **The setup has been completed** (object) - Indicates successful setup. #### Error Responses - **400** - Invalid request. - **500** - A error occurred during the setup. - **503** - Another service is unavailable (e.g. wazo-auth, wazo-confd, Asterisk, ...). #### Response Example (Error) ```json { "details": {}, "error_id": "string", "message": "string", "timestamp": 0 } ``` ``` -------------------------------- ### GET /pg_mgr/install Source: https://wazo-platform.org/documentation/api/provisioning Retrieves the installation service resources for the plugin manager. ```APIDOC ## GET /pg_mgr/install ### Description Get the installation service resources. ### Method GET ### Endpoint /pg_mgr/install ### Parameters #### Query Parameters None #### Path Parameters None ### Request Example None ### Response #### Success Response (200) - **links** (array) - Contains links to related resources. - **href** (string) - The URL of the linked resource. - **rel** (string) - The relationship of the linked resource. #### Response Example ```json { "links": [ { "href": "string", "rel": "string" } ] } ``` ``` -------------------------------- ### Install Plugin Request Body (JSON) Source: https://wazo-platform.org/documentation/api/plugins This JSON snippet represents the request body for installing a plugin. It specifies the installation method (e.g., 'git') and any method-dependent options. This payload is sent to the `post/plugins` endpoint to initiate the plugin installation process on the server. ```json { "method": "git", "options": { } } ``` -------------------------------- ### Setup Wazo Engine Source: https://wazo-platform.org/documentation/api/setup Initializes and sets up the Wazo Engine. This endpoint requires a Wazo authentication token and accepts a JSON payload with various setup options. It returns different status codes based on the outcome of the setup process. ```json { "post/setup": { "description": "Setup the Wazo Engine", "url": "https://openapi.wazo.community/1.0/setup", "authorizations": [ "wazo_auth_token" ], "request_body": { "content": { "application/json": { "schema": { "type": "object", "properties": { "engine_instance_uuid": {"type": "string", "description": "UUID identifying this instance on Nestbox. Only specify if already registered."}, "engine_internal_address": {"type": "string", "description": "IP address of the engine"}, "engine_language": {"type": "string", "description": "Interface language for the Wazo Engine (e.g., 'en_US', 'fr_FR')"}, "engine_license": {"type": "boolean", "description": "Whether the GNU GPLv3 license is accepted"}, "engine_password": {"type": "string", "description": "Password of the first administrator 'root'"}, "engine_rtp_icesupport": {"type": "boolean", "default": false, "description": "Enable ICE support for WebRTC. Requires STUN server in engine_rtp_stunaddr."}, "engine_rtp_stunaddr": {"type": "string", "default": "null", "description": "Address of the STUN server for WebRTC"}, "nestbox_engine_host": {"type": "string"}, "nestbox_engine_port": {"type": "integer", "default": 443}, "nestbox_host": {"type": "string", "description": "Host of the Nestbox for engine registration. Makes nestbox and engine_internal_address mandatory."}, "nestbox_instance_name": {"type": "string", "description": "Name of the engine in Nestbox"}, "nestbox_instance_preferred_connection": {"type": "string", "default": "public", "enum": ["private", "public"]}, "nestbox_port": {"type": "integer", "default": 443}, "nestbox_service_id": {"type": "string", "description": "Nestbox username for engine registration"}, "nestbox_service_key": {"type": "string", "description": "Nestbox password for engine registration"}, "nestbox_verify_certificate": {"type": "boolean", "default": true, "description": "Verify HTTPS certificate during setup"} }, "required": ["engine_language", "engine_license", "engine_password"] } } } }, "responses": { "201": {"description": "The setup has been completed"}, "400": {"description": "Invalid request"}, "500": {"description": "A error occurred during the setup"}, "503": {"description": "Another service is unavailable (e.g. wazo-auth, wazo-confd, Asterisk, ...)"} } } } ``` ```json { "engine_instance_uuid": "string", "engine_internal_address": "string", "engine_language": "string", "engine_license": true, "engine_password": "string", "engine_rtp_icesupport": false, "engine_rtp_stunaddr": "null", "nestbox_engine_host": "string", "nestbox_engine_port": 443, "nestbox_host": "string", "nestbox_instance_name": "string", "nestbox_instance_preferred_connection": "private", "nestbox_port": 443, "nestbox_service_id": "string", "nestbox_service_key": "string", "nestbox_verify_certificate": true } ``` ```json { "details": { }, "error_id": "string", "message": "string", "timestamp": 0 } ``` -------------------------------- ### Bash: Install Wazo Webhook Service Source: https://wazo-platform.org/documentation/overview/webhook-core Installs a Wazo webhook service using Python's `setup.py` script. This command compiles and installs the package, making the defined webhook service available to Wazo. ```bash python ./setup.py install ``` -------------------------------- ### GET /pg_mgr/plugins/{plugin_id}/install Source: https://wazo-platform.org/documentation/api/provisioning Retrieves the installation service resources for a specific plugin. ```APIDOC ## GET /pg_mgr/plugins/{plugin_id}/install ### Description Get the package installation service resources for a specific plugin. ### Method GET ### Endpoint /pg_mgr/plugins/{plugin_id}/install ### Parameters #### Path Parameters - **plugin_id** (string) - Required - The ID of the plugin. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **links** (array) - Contains links to related resources. - **href** (string) - The URL of the linked resource. - **rel** (string) - The relationship of the linked resource. #### Response Example ```json { "links": [ { "href": "string", "rel": "string" } ] } ``` ``` -------------------------------- ### Get Installed Packages List (API) Source: https://wazo-platform.org/documentation/api/provisioning Retrieves a list of installed packages for a specific plugin. Requires 'provd.pg_mgr.plugins.{plugin_id}.install.installed.read' ACL and '_wazo_auth_token_' authorization. Accepts plugin_id as a path parameter. Returns a map of installed packages with their details. ```json { "pkgs": { "property1": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" }, "property2": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" } } } ``` -------------------------------- ### Webhook Service Implementation Source: https://wazo-platform.org/documentation/overview/webhook-core Guides on how to implement custom webhook services, including file structure, setup, and Python plugin details. ```APIDOC ## Webhook Service Implementation ### Description This section details how to create and install a custom webhook service for the Wazo Platform. ### File Structure Custom webhook services should follow a specific directory structure: ``` ./ ├── example_service/ │ └── plugin.py └── setup.py ``` ### `setup.py` This file defines the package metadata and entry points for stevedore to discover the service. #### Parameters - **name** (string) - The name of the Python package. - **version** (string) - The version of the package. - **packages** (list) - List of packages to include. - **entry_points** (dict) - Specifies how the service is exposed. - **wazo_webhookd.services** (list) - Defines the webhook services. - **example** (string) - The name of the service, used when creating subscriptions. - **example_service.plugin:Service** - Path to the service class (`example_service/plugin.py` and the `Service` class within it). ### `example_service/plugin.py` This file contains the implementation of the webhook service. #### Class `Service` - **`load(self, dependencies)`**: This method is called when the service is loaded. It receives a dictionary of dependencies, such as `celery` or `bus_consumer`. - **`celery_app.task`**: Decorator to define a Celery task for handling callbacks. - **`example_callback(subscription, event)`**: A sample callback function that sleeps for a duration specified in the subscription configuration. - **`subscription`**: A dictionary containing subscription details, including `config`. - **`event`**: A dictionary representing the Wazo event that triggered the webhook. - **`name`** (string): The name of the event (e.g., 'user_created'). - **`origin_uuid`** (string): The UUID of the Wazo server sending the event. - **`data`** (object): Payload of the event. - **`callback(self)`**: Returns the registered callback function. ### Installation Install the custom webhook service using setup.py: ```bash python ./setup.py install ``` ### Example: Triggering code on a bus event Modify `example_service/plugin.py` to subscribe to bus events: ```python import logging import uuid logger = logging.getLogger(__name__) class Service: def load(self, dependencies): bus_consumer = dependencies['bus_consumer'] bus_consumer.subscribe_to_event_names( uuid=uuid.uuid4(), event_names=['user_created'], user_uuid=None, wazo_uuid=None, callback=self.on_user_created ) def on_user_created(self, body, event): logger.debug('User %s has been created!', body.get('uuid')) ``` ### Example: Programmatically creating a subscription Use the `SubscriptionService` to create subscriptions programmatically: ```python from wazo_webhookd.plugins.subscription.service import SubscriptionService class Service: def load(self, dependencies): config = dependencies['config'] subscription_service = SubscriptionService(config) subscription = subscription_service.create({ 'name': 'my-subscription', 'service': 'http', 'events': ['call_created'], 'config': { 'method': 'get', 'url': 'https://me.example.com', }, }) logger.info(f"Created subscription: {subscription['id']}") ``` ``` -------------------------------- ### GET /plugins/{namespace}/{name} Source: https://wazo-platform.org/documentation/api/plugins Fetches the metadata for an installed plugin. ```APIDOC ## GET /plugins/{namespace}/{name} ### Description Fetches the information about a plugin that has been installed. ### Method GET ### Endpoint /plugins/{namespace}/{name} ### Parameters #### Path Parameters - **namespace** (string) - Required - The plugin's namespace. - **name** (string) - Required - The plugin's name. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **The plugin's metadata** (object) - Contains the name, namespace, and version of the installed plugin. #### Response Example ```json { "name": "installed-plugin", "namespace": "wazo", "version": "1.2.3" } ``` #### Error Responses - **400**: Invalid request. - **404**: Plugin not found. ``` -------------------------------- ### JSON Response Sample for Listing Installed Plugins Source: https://wazo-platform.org/documentation/api/plugins This JSON structure details the response for listing installed plugins. It includes an array of plugin objects, each with its name, namespace, and version, along with the total count of installed plugins. ```json { "items": [ { "name": "string", "namespace": "string", "version": "string" } ], "total": 0 } ``` -------------------------------- ### GET /pg_mgr/plugins/{plugin_id}/install/install/{operation_id} Source: https://wazo-platform.org/documentation/api/provisioning Retrieves the status of a package installation operation. ```APIDOC ## GET /pg_mgr/plugins/{plugin_id}/install/install/{operation_id} ### Description Get the status of a package installation Operation In Progress. ### Method GET ### Endpoint `/pg_mgr/plugins/{plugin_id}/install/install/{operation_id}` ### Parameters #### Path Parameters - **plugin_id** (string) - Required - Plugin ID - **operation_id** (string) - Required - Operation In Progress ID ### Responses #### Success Response (200) OK - **status** (string) - The status of the operation. #### Error Response (404) No such resource. The provided id does not exist ### Response Example (200) ```json { "status": "string" } ``` ``` -------------------------------- ### GET /pg_mgr/plugins/{plugin_id}/install/installed Source: https://wazo-platform.org/documentation/api/provisioning Retrieves a list of installed packages for a specific plugin. ```APIDOC ## GET /pg_mgr/plugins/{plugin_id}/install/installed ### Description Get the installed packages list for a specific plugin. ### Method GET ### Endpoint /pg_mgr/plugins/{plugin_id}/install/installed ### Parameters #### Path Parameters - **plugin_id** (string) - Required - The ID of the plugin. #### Query Parameters None ### Request Example None ### Response #### Success Response (200) - **pkgs** (object) - An object containing information about installed packages. - **property1** (object) - Details of a specific package (key is package name). - **capabilities** (object) - Capabilities of the package. - **property1** (object) - Details of a capability. - **property1** (string) - **property2** (string) - **property2** (object) - Details of another capability. - **property1** (string) - **property2** (string) - **description** (string) - Description of the package. - **dsize** (integer) - Download size of the package. - **sha1sum** (string) - SHA1 checksum of the package. - **version** (string) - Version of the package. #### Response Example ```json { "pkgs": { "property1": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" }, "property2": { "capabilities": { "property1": { "property1": "string", "property2": "string" }, "property2": { "property1": "string", "property2": "string" } }, "description": "string", "dsize": 0, "sha1sum": "string", "version": "string" } } } ``` ``` -------------------------------- ### Install Apache Bench (ab) for Load Testing Source: https://wazo-platform.org/documentation/overview/authentication-admin Installs the Apache Bench (ab) utility, a dependency for load testing the wazo-auth service. This command updates the package list and installs the apache2-utils package. ```bash apt update && apt install apache2-utils ``` -------------------------------- ### GET /pg_mgr/install/install/{operation_id} Source: https://wazo-platform.org/documentation/api/provisioning Retrieves the status of a plugin installation operation. ```APIDOC ## GET /pg_mgr/install/install/{operation_id} ### Description Get the status of a plugin installation Operation In Progress. ### Method GET ### Endpoint `/pg_mgr/install/install/{operation_id}` ### Parameters #### Path Parameters - **operation_id** (string) - Required - Operation In Progress ID ### Responses #### Success Response (200) OK - **status** (string) - The status of the operation. #### Error Response (404) No such resource. The provided id does not exist ### Response Example (200) ```json { "status": "string" } ``` ``` -------------------------------- ### GET /status Source: https://wazo-platform.org/documentation/api/setup Retrieves information about the internal status of the wazo-setupd service. Requires read access to setupd status. ```APIDOC ## GET /status ### Description Retrieves information about the internal status of the wazo-setupd service. Requires read access to setupd status. ### Method GET ### Endpoint /status ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **The internal infos of wazo-setupd** (object) - Contains status details for master tenant and REST API. #### Response Example ```json { "master_tenant": { "status": "fail" }, "rest_api": { "status": "fail" } } ``` ``` -------------------------------- ### GET /plugins Source: https://wazo-platform.org/documentation/api/plugins Retrieves a list of all installed plugins on the Wazo Platform. Requires 'plugind.plugins.read' ACL. ```APIDOC ## List installed plugins ### Description Allow the administrator to get a list of all installed plugins. ### Method GET ### Endpoint /plugins ### Parameters #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **items** (array) - The list of installed plugins. - **name** (string) - The name of the plugin. - **namespace** (string) - The namespace of the plugin. - **version** (string) - The version of the plugin. - **total** (integer) - The total number of installed plugins. #### Response Example ```json { "items": [ { "name": "string", "namespace": "string", "version": "string" } ], "total": 0 } ``` ``` -------------------------------- ### GET /config Source: https://wazo-platform.org/documentation/api/setup Retrieves the current configuration of the Wazo Engine service. This endpoint requires read access to setupd configuration. ```APIDOC ## GET /config ### Description Retrieves the current configuration of the Wazo Engine service. This endpoint requires read access to setupd configuration. ### Method GET ### Endpoint /config ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **The configuration of the service** (object) - Details of the current service configuration. #### Response Example ```json { "key": "value" } ``` ``` -------------------------------- ### Get Wazo Configuration Source: https://wazo-platform.org/documentation/api/setup Retrieves the current configuration of the Wazo Engine. Requires the 'setupd.config.read' ACL and a valid Wazo authentication token. ```json { "get/config": { "description": "Show the current configuration", "url": "https://openapi.wazo.community/1.0/config", "required_acl": "setupd.config.read", "authorizations": [ "wazo_auth_token" ], "responses": { "200": { "description": "The configuration of the service" } } } } ``` -------------------------------- ### WAZO Trunk Created Headers Example Source: https://wazo-platform.org/documentation/events/configuration This example shows the headers for the 'trunk_created' event, including event name, ACL, origin, timestamp, and tenant UUID. ```json { "name": "trunk_created", "required_acl": "events.config.trunk.created", "origin_uuid": "311e21cd-c040-4b48-bc92-4bc16db9c2a0", "timestamp": "2019-08-24T14:15:22Z", "tenant_uuid": "3467989a-e428-43d0-b560-aedbbec33ae0" } ``` -------------------------------- ### Run Unit Tests with Tox (Python) Source: https://wazo-platform.org/documentation/overview/application-dev This snippet demonstrates how to install tox and run unit tests for Python 3.7 environments. It requires pip to be installed for package management. ```bash pip install tox tox --recreate -e py37 ``` -------------------------------- ### Bootstrap wazo-auth Setup Source: https://wazo-platform.org/documentation/overview/authentication-admin Prepares wazo-auth for bootstrapping by enabling the init plugin and creating a key file. This command must be run before completing the bootstrap process. It requires systemctl to restart the service. ```bash wazo-auth-bootstrap setup && systemctl restart wazo-auth ``` -------------------------------- ### POST /pg_mgr/install/install Source: https://wazo-platform.org/documentation/api/provisioning Installs a plugin. ```APIDOC ## POST /pg_mgr/install/install ### Description Install a plugin. ### Method POST ### Endpoint `/pg_mgr/install/install` ### Parameters #### Request Body - **id** (string) - Required - Package ID ### Request Example ```json { "id": "abcdef1234567890" } ``` ### Responses #### Success Response (201) Operation in progress #### Error Response (400) Invalid JSON document #### Error Response (415) Unsupported media type. This error occurs if you forgot to include the Content-Type header ``` -------------------------------- ### Wazo Setup API Source: https://wazo-platform.org/documentation/console/setup This API allows for the initialization of the Wazo Engine. It includes endpoints for configuration and status checks. ```APIDOC ## GET /1.0/setup ### Description Retrieves the setup status of the Wazo Engine. ### Method GET ### Endpoint /1.0/setup ### Parameters None ### Request Example None ### Response #### Success Response (200) - **status** (string) - The current setup status of the Wazo Engine. #### Response Example { "status": "initialized" } ## GET /1.0/config ### Description Retrieves the current configuration of the Wazo Engine. ### Method GET ### Endpoint /1.0/config ### Parameters None ### Request Example None ### Response #### Success Response (200) - **config** (object) - The configuration details of the Wazo Engine. #### Response Example { "config": { "setting1": "value1", "setting2": "value2" } } ## POST /1.0/initialize ### Description Initializes the Wazo Engine. This is typically done once during the initial system setup. ### Method POST ### Endpoint /1.0/initialize ### Parameters #### Request Body - **settings** (object) - Optional. Initial settings for the Wazo Engine. ### Request Example { "settings": { "hostname": "wazo.example.com" } } ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the engine has been initialized. #### Response Example { "message": "Wazo Engine initialized successfully." } ``` -------------------------------- ### POST /plugins Source: https://wazo-platform.org/documentation/api/plugins Installs a plugin on the Wazo server. ```APIDOC ## POST /plugins ### Description Installs a plugin. ### Method POST ### Endpoint /plugins ### Parameters #### Path Parameters None #### Query Parameters - **reinstall** (boolean) - Optional - With this option the plugin will be reinstalled if it is already installed. #### Request Body - **method** (string) - Required - Value: "git" - The method used to fetch this plugin. - **options** (object) - Required - Method dependant installation options. ### Request Example ```json { "method": "git", "options": { "repository": "https://github.com/wazo-platform/wazo-plugin-example.git", "branch": "main" } } ``` ### Response #### Success Response (200) - **Installation started** (string) - Indicates that the installation process has begun. #### Response Example ```json "Installation started" ``` #### Error Responses - **400**: Invalid request. ``` -------------------------------- ### Complete wazo-auth Bootstrapping Source: https://wazo-platform.org/documentation/overview/authentication-admin Completes the wazo-auth bootstrapping process by creating an initial user with necessary rights. This command uses the setup prepared in the previous step and generates a configuration file for the wazo-auth-cli. ```bash wazo-auth-bootstrap complete ``` -------------------------------- ### POST /pg_mgr/plugins/{plugin_id}/install/install Source: https://wazo-platform.org/documentation/api/provisioning Installs a package for a specific plugin. ```APIDOC ## POST /pg_mgr/plugins/{plugin_id}/install/install ### Description Install a package for a specific plugin. ### Method POST ### Endpoint `/pg_mgr/plugins/{plugin_id}/install/install` ### Parameters #### Path Parameters - **plugin_id** (string) - Required - Plugin ID #### Request Body - **id** (string) - Required - Package ID ### Request Example ```json { "id": "abcdef1234567890" } ``` ### Responses #### Success Response (201) Operation in progress #### Error Response (400) Invalid JSON document #### Error Response (404) No such resource. The provided id does not exist #### Error Response (415) Unsupported media type. This error occurs if you forgot to include the Content-Type header ``` -------------------------------- ### Launch wazo-auth Command Source: https://wazo-platform.org/documentation/overview/authentication-admin Launches the wazo-auth service with various options. Supports debug mode, user specification, and configuration file path. Dependencies include the wazo-auth executable. ```bash wazo_auth [-d] [--user ] --config * -d: Starts wazo-auth in debug mode * --user: Specify the OS user to use * --config: Path to the configuration file ``` -------------------------------- ### Get Wazo Setupd Status Source: https://wazo-platform.org/documentation/api/setup Retrieves internal status information for the wazo-setupd service. This endpoint requires the 'setupd.status.read' ACL and a valid Wazo authentication token. ```json { "get/status": { "description": "Print infos about internal status of wazo-setupd", "url": "https://openapi.wazo.community/1.0/status", "required_acl": "setupd.status.read", "authorizations": [ "wazo_auth_token" ], "responses": { "200": { "description": "The internal infos of wazo-setupd" } } } } ``` ```json { "master_tenant": { "status": "fail" }, "rest_api": { "status": "fail" } } ``` -------------------------------- ### Get Agent Status (JSON Response Example) Source: https://wazo-platform.org/documentation/api/agent Retrieves the status of all agents, including details like ID, logged status, and associated queues. The response is a JSON array of agent objects. ```json { "context": "string", "extension": "string", "id": 0, "logged": true, "number": "string", "origin_uuid": "311e21cd-c040-4b48-bc92-4bc16db9c2a0", "paused": true, "paused_reason": "string", "queues": [ { "display_name": "string", "id": 0, "logged": true, "name": "string", "paused": true, "paused_reason": "string" } ], "state_interface": "string", "tenant_uuid": "3467989a-e428-43d0-b560-aedbbec33ae0" } ``` -------------------------------- ### Python: Setup for Wazo Webhook Service Source: https://wazo-platform.org/documentation/overview/webhook-core Configures a Python package for a Wazo webhook service using `setuptools`. It defines the package name, version, and entry points for discovering the webhook service. ```python from setuptools import setup from setuptools import find_packages setup( name='wazo-webhookd-service-example', version='1.0', packages=find_packages(), entry_points={ 'wazo_webhookd.services': [ 'example = example_service.plugin:Service', ] } ) ``` -------------------------------- ### JSON Response Sample for Installing a Plugin Source: https://wazo-platform.org/documentation/api/plugins This JSON structure represents a successful response when installing a plugin, indicating the plugin's unique identifier. It's typically returned with a 200 OK status code. ```json { "uuid": "string" } ``` -------------------------------- ### List Plugins from Market (JSON Response Sample) Source: https://wazo-platform.org/documentation/api/plugins This snippet provides a sample JSON response when listing plugins available on the configured market. It details the total number of plugins, filtered count, and an array of plugin objects, each with name, namespace, and version information. This structure is returned by the `get/market` endpoint. ```json { "filtered": 0, "items": [ { "name": "string", "namespace": "string", "versions": [ { "max_wazo_version": "string", "min_wazo_version": "string", "upgradable": true, "version": "string" } ] } ], "total": 0 } ``` -------------------------------- ### JavaScript WebSocket Start Command Source: https://wazo-platform.org/documentation/overview/websocket-app This JavaScript code snippet defines a function to send a 'start' command over a WebSocket connection to the Wazo service. It constructs a JSON message with the 'start' operation and sends it via the WebSocket. ```javascript function start() { var msg = { op: "start" }; socket.send(JSON.stringify(msg)); } ``` -------------------------------- ### Event Subscription and Starting Events Source: https://wazo-platform.org/documentation/overview/websocket-app Instructions on how to subscribe to specific event types and initiate the server to send these events. ```APIDOC ## WebSocket Commands ### Description Send JSON commands to the WebSocket server to manage event subscriptions and start receiving events. ### Method (Implicit via WebSocket message) ### Endpoint (Established WebSocket connection) ### Request Body #### Subscribe Command - **op** (string) - Required - The operation, must be `subscribe`. - **data** (object) - Required - Contains subscription details. - **event_name** (string) - Required - The name of the event to subscribe to (e.g., `endpoint_status_update`). #### Subscribe Command Example ```json { "op": "subscribe", "data": { "event_name": "endpoint_status_update" } } ``` #### Start Command - **op** (string) - Required - The operation, must be `start`. #### Start Command Example ```json { "op": "start" } ``` ### Response #### Subscribe Success Response - **op** (string) - Operation type, will be `subscribe`. - **code** (integer) - 0 for success. #### Subscribe Success Response Example ```json { "op": "subscribe", "code": 0 } ``` #### Start Success Response - **op** (string) - Operation type, will be `start`. - **code** (integer) - 0 for success. #### Start Success Response Example ```json { "op": "start", "code": 0 } ``` ### Post-Start Messages After receiving the `start` success response, all subsequent messages from the server will be events originating from the bus, in their original format. ``` -------------------------------- ### Get Plugin Information from Market (JSON Response Sample) Source: https://wazo-platform.org/documentation/api/plugins This snippet shows a sample JSON response for retrieving information about a specific plugin from the market. It includes the plugin's name, namespace, and version details. This is useful for understanding the structure of the data returned by the `get/market/{namespace}/{name}` endpoint. ```json { "name": "string", "namespace": "string", "versions": [ { "max_wazo_version": "string", "min_wazo_version": "string", "upgradable": true, "version": "string" } ] } ``` -------------------------------- ### Start recording a call Source: https://wazo-platform.org/documentation/api/application Starts the recording of a specific call. Requires `calld.calls.{call_id}.record.start.update` ACL. ```APIDOC ## Start recording a call ### Description Initiates the recording of a specific call identified by its Call ID. This operation requires the `calld.calls.{call_id}.record.start.update` ACL. ### Method PUT ### Endpoint `/calls/{call_id}/record/start` ### Parameters #### Path Parameters - **call_id** (string) - Required - Call ID of the call to start recording. #### Authorizations - `_wazo_auth_token_` ### Responses - **204**: Recording started successfully. - **403**: On demand call recording is not enabled. - **404**: No such call. - **503**: Another service is unavailable (e.g. wazo-auth, wazo-confd, Asterisk, ...). ``` -------------------------------- ### GET /api/provd/0.2/ Source: https://wazo-platform.org/documentation/api/provisioning Provides the main entry point to the wazo-provd REST API. Requires 'provd.read' ACL. ```APIDOC ## GET /api/provd/0.2/ ### Description Get the Provd Manager resource. This is the main entry point to the wazo-provd REST API. ### Method GET ### Endpoint /api/provd/0.2/ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **links** (array) - A list of available links. - **href** (string) - The URL of the link. - **rel** (string) - The relationship of the link. #### Response Example ```json { "links": [ { "href": "string", "rel": "string" } ] } ``` ``` -------------------------------- ### Create Device-Specific Template Source: https://wazo-platform.org/documentation/overview/provisioning-admin This example illustrates creating a device-specific template by copying a model template and renaming it to match a specific device's configuration file extension (e.g., `00085D2EECFB.cfg.tpl`). This allows for highly granular customization. ```bash cp templates/6739i.tpl var/templates/00085D2EECFB.cfg.tpl vi var/templates/00085D2EECFB.cfg.tpl ``` -------------------------------- ### WAZO Trunk Created Payload Example Source: https://wazo-platform.org/documentation/events/configuration This example details the JSON payload for a trunk creation event, which includes the 'trunk_id'. ```json { "trunk_id": 0 } ```