Skip to content

Releases: CakeDC/fusionpbx-rest-api

Release list

1.0.0

Choose a tag to compare

@flohdez flohdez released this 07 Oct 14:29

FusionPBX REST API v1.0.0

First release of the CakeDC fork of AccelerateNetworks/fusionpbx-rest-api. Targets FusionPBX 5.6.5.

⚠️ Breaking changes

  • API keys are bound to a FusionPBX user. Each request runs as the key's user: it gets the permissions of that user's groups, acts on the user's domain, and records it creates show that user as insert_user. Existing keys stop working until a superadmin edits each one, picks a user and enables it.
  • Actions check FusionPBX permissions instead of granting them. A missing permission returns 403 with missing_permissions. The README lists the permissions each action needs.
  • Requests are limited to the key user's domain. domain_uuid is now optional and defaults to the user's domain. Using another domain needs domain_select.
  • Responses only contain documented columns. extension-create returns the SIP password only when the user has extension_password. Clients that read other columns from extension-create, destination-create, destination-details, ringgroup-create or domain-details must be updated.
  • extension-details takes extension_uuid (was extension).

New

  • extension-user-list: the extensions linked to a FusionPBX user.
  • cdr-search: paginated call history, by default one row per call. Filters: date range, direction, extensions, counterparty number, missed calls.
  • cdr-details: a call with all its legs, starting from any leg's uuid.
  • Keys have a name, an enabled flag and an optional expiry date. Key management needs the new rest_api_key_view/add/edit/delete permissions.
  • App Defaults creates an index on v_xml_cdr.originating_leg_uuid (PostgreSQL) for cdr-search and cdr-details. It is built CONCURRENTLY, so new call records aren't blocked, and a failed build is logged.

Security fixes

  • Fixed the key secret check: password_verify() was called with its arguments swapped.
  • Action and app names are validated before they are used in include paths.
  • Numbers that reach dialplan XML or event socket commands are validated, and ring group names are escaped in the dialplan XML.
  • The admin pages escape their output and use FusionPBX CSRF tokens.
  • Removed githook.php, which ran git pull from the web interface.
  • API requests never read or write the FusionPBX browser session.
  • Every rejected key gets the same 401 {"error": "unauthorized"}; the reason only goes to the server's error log.

Upgrading

  1. Check out the tag in app/rest_api:
    git fetch --tags && git checkout v1.0.0
    
  2. In FusionPBX, go to Advanced → Upgrade, check Schema, App Defaults, Menu Defaults and Permission Defaults, and press Execute. On a large CDR table, App Defaults can take a few minutes.
  3. Log out and back in, so the new permissions are loaded into the session.
  4. Edit each existing key: bind it to a user and enable it.
  5. Give each integration's user the permissions its actions need (see the README).

Known limitations

  • cdr-search and cdr-details link the legs of a call through bridge_uuid and originating_leg_uuid, following direct links only (no transfer chains). This linking hasn't yet been checked against a production CDR export.
  • cdr-list is unchanged (last 100 legs, no filters) and kept as the legacy endpoint.

Development

  • Unit and HTTP test suites run without FusionPBX (composer test), using stand-ins that mimic FusionPBX 5.6.5.
  • A PostgreSQL suite runs in Docker (composer test-pgsql).

Two choices before publishing:

  • Ticket numbers: I left the Redmine numbers (#43936–#43940) out because the repo is public. Add them if the release page is meant for internal use.
  • Secret check wording: the first security bullet says plainly that password_verify() had its arguments swapped, without saying how that could be abused. Say if you'd rather word it more vaguely.