Skip to content

Repository files navigation

FusionPBX REST API

An HTTP API for FusionPBX.

Install

To install it, clone into fusionpbx's app/ folder. Make sure this repo clones into a folder called rest_api. Then log into the FusionPBX web interface, select Advanced -> Upgrade, check Schema and Menu Defaults, press Execute.

Use

To use the API you must have an API token. superadmins can generate these by opening the REST API app from the FusionPBX application menu. All requests must include a token in the HTTP Authorization header.

Note that when generating a token, the token is shown once and cannot be shown again (you can always generate another one and delete the missed one)

The API endpoint is displayed on the API token page, and is generally in the format https://<your fusionpbx>/app/rest_api/rest.php. All requests to it are HTTP POST requests with a JSON body that must include an action parameter with a value of the action you wish to use (see below). For example, the domain-details action with parameter domain_name=fusionpbx.example.net:

$ curl -s --user "5bc14e83-fc4e-4578-99b8-c7151eb2ec54:jM2GQuYgQTkIGE6nJ2SP" -d '{"action": "domain-details", "domain_name": "fusionpbx.example.net"}' https://fusionpbx.example.net/app/rest_api/rest.php | jq
{
"domain_uuid": "3a644e67-de8f-4798-b07e-6f22c33a656e",
"domain_parent_uuid": null,
"domain_name": "fusionpbx.example.net",
"domain_enabled": true,
"domain_description": "",
"insert_date": null,
"insert_user": null,
"update_date": null,
"update_user": null
}

Actions

All actions are defined in the actions/ directory of this repo. What follows is a best effort attempt to document them.

destination-create

ParameterRequiredDescription
domain_uuidyesDomain to add the destination to
numberyesPhone number to add
extensionyesExtension to transfer calls for this number to

Creates a new destination in FusionPBX.

destination-details

ParameterRequiredDescription
numberyesInbound number to look up

looks up details for a particular destination

domain-details

ParameterRequiredDescription
domain_uuidnoUUID of the domain to look up. Required if domain_name is not specified.
domain_namenoName of the domain to look up. Required if domain_uuid is not specified.

looks up details of a domain. Mostly useful for converting between domain uuid and domain name.

extension-create

ParameterRequiredDescription
domain_uuidyesDomain to add extension to
extensionyesExtension (number) to create
caller_id_namenoCaller ID name to set for outbound calls from the extension
caller_id_numbernoCaller ID number to set for outbound calls from the extension

create an extension

extension-details

ParameterRequiredDescription
domain_uuidyesDomain look up extension on
extension_uuidyesExtension (by UUID) to look up

get all details of an extension

extension-list

ParameterRequiredDescription
domain_uuidyesDomain to list extensions on

List number, UUID and a few other details of all extensions on a given domain.

ringgroup-create

ParameterRequiredDescription
domain_uuidyesdomain to create the ring group on
nameyesname for the ring group
extensionyesExtension to route TO the ring group
destinationsyesJSON array of extensions to send calls from the ring group. Example: [{"number": "100"}, {"number": "101"}, {"number": "102"}]
strategyyesone of: simultaneous, sequence, enterprise, rollover or random

Create a ring group

originate

ParameterRequiredDescription
domain_uuidyesdomain to originate the call from
caller_id_numberyescaller ID number to display for both legs of the call
caller_id_namenoan optional caller ID name to request. typically will be delivered for internal calls and stripped by the upstream provider for external calls
destination_ayesthe number to call first
destination_byesthe number to call second

Call one number (destination_a) and connect the call to another number (destination_b) when it's picked up. The selected domain's internal dialplan is used, so internal extensions may be dialed.

Note that the call is ended when destination_a ends the call, so if one leg isn't expected to hang up, make it destination_b.

Use destination_b=*9664 to indefinitely play hold music to destination_a.

cdr-list

ParameterRequiredDescription
domain_uuidyesdomain to list call detail records from

returns the the last 100 call detail records.

About

No description, website, or topics provided.

Resources

Stars

8 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages