xsme/php-api-adescom

PHP library for communication with Adescom PBX system via SOAP API

v1.1 2025-07-01 08:17 UTC

This package is auto-updated.

Last update: 2025-07-01 08:18:08 UTC


README

PHP library for handling Adescom system API using SOAP protocol.

Installation

composer require xsme/php-api-adescom

Configuration

The library supports three different SOAP endpoints:

  • Frontend - for managing clients and numbers
  • Platform - for platform operations and billing
  • Userpanel - for user panel operations

Initialization

use xsme\Adescom\AdecomApi;

$api = new AdecomApi();

// Frontend configuration
$api->setFrontend($wsdl, $location, $login, $password);

// Platform configuration
$api->setPlatform($wsdl, $location, $login, $password);

// Userpanel configuration
$api->setUserpanel($wsdl, $location, $login, $password);

Available methods

System information

getVersion(): string

Returns the PBX version.

$version = $api->getVersion();

Number management (CLID)

getClids(): stdClass

Returns a list of all numbers.

$clids = $api->getClids();

getClid(string $callerId): stdClass

Returns information about a specific callerID number.

$clid = $api->getClid('123456789');

getClidStatus(string $callerId): stdClass

Returns the status of a callerID number.

$status = $api->getClidStatus('123456789');

getClidsStatus(array $callerIds): stdClass

Returns statuses for multiple callerID numbers.

$statuses = $api->getClidsStatus(['123456789', '987654321']);

deleteClid(string $callerId, ?DateTime $dateTime = null): stdClass

Deletes a callerID number with optional date and time after which the number returns to the free numbers pool.

// Delete with default grace period
$result = $api->deleteClid('123456789');

// Delete with specific grace period
$dateTime = new DateTime('2025-12-31 23:59:59');
$result = $api->deleteClid('123456789', $dateTime);

Number pool management

getPools(): stdClass

Returns a list of available number pools for the reseller.

$pools = $api->getPools();

getNumberPools(): stdClass

Returns a list of number pools.

$numberPools = $api->getNumberPools();

getNumberPool(int $id): stdClass

Returns information about a specific number pool.

$pool = $api->getNumberPool(1);

getFreeNumbersFromPool(int $id): stdClass

Returns a list of free numbers from the pool.

$freeNumbers = $api->getFreeNumbersFromPool(1);

getFirstFreeNumberFromPool(int $id): stdClass

Returns the first free number from the pool.

$firstFree = $api->getFirstFreeNumberFromPool(1);

Phone management

getPhones(): stdClass

Returns a list of phones.

$phones = $api->getPhones();

getPhone(int $id): stdClass

Returns information about a specific phone.

$phone = $api->getPhone(1);

Client management

getClients(): stdClass

Returns a list of all clients.

$clients = $api->getClients();

getClient(int $id): stdClass

Returns information about a specific client.

$client = $api->getClient(1);

getClientByExternalId(string $externalID): stdClass

Returns a client by external ID.

$client = $api->getClientByExternalId('EXT123');

getClidsForClient(int $clientId): stdClass

Returns a list of numbers for a specific client.

$clids = $api->getClidsForClient(1);

getClidsForClientByExternalId(string $externalID): stdClass

Returns a list of numbers for a client by external ID.

$clids = $api->getClidsForClientByExternalId('EXT123');

Billing and reports

getBillingByCallerID(DateTime $fromDate, DateTime $toDate, string $callerId, bool $includeZeroDuration = false, $typeSet = 1, int $directionSet = 1): stdClass

Returns billing records for the specified callerID number in the given time period.

Parameters:

  • $fromDate - start date
  • $toDate - end date
  • $callerId - callerID number
  • $includeZeroDuration - whether to include calls with zero duration
  • $typeSet - set type (default 1)
  • $directionSet - call direction (1 or 2)
$fromDate = new DateTime('2025-01-01 00:00:00');
$toDate = new DateTime('2025-01-31 23:59:59');
$billing = $api->getBillingByCallerID($fromDate, $toDate, '123456789', true, 1, 1);

getBillingSummaryByCallerID(DateTime $fromDate, DateTime $toDate, string $calledId, bool $includeZeroDuration = false, $typeSet = 1, int $directionSet = 1): stdClass

Returns a summary of billing records for the specified callerID number in the given time period.

Parameters identical to getBillingByCallerID

$fromDate = new DateTime('2025-01-01 00:00:00');
$toDate = new DateTime('2025-01-31 23:59:59');
$summary = $api->getBillingSummaryByCallerID($fromDate, $toDate, '123456789', true, 1, 1);

Usage example

<?php

require_once 'vendor/autoload.php';

use xsme\Adescom\AdecomApi;
use DateTime;

$api = new AdecomApi();

// Connection configuration
$api->setFrontend('https://example.com/frontend.wsdl', 'https://example.com/frontend', 'login', 'password');
$api->setPlatform('https://example.com/platform.wsdl', 'https://example.com/platform', 'login', 'password');

// Get system version
$version = $api->getVersion();
echo "System version: " . $version . "\n";

// Get list of numbers
$clids = $api->getClids();
print_r($clids);

// Get billing for a number
$fromDate = new DateTime('2025-01-01');
$toDate = new DateTime('2025-01-31');
$billing = $api->getBillingByCallerID($fromDate, $toDate, '123456789');
print_r($billing);

Requirements

  • PHP 7.4 or higher
  • SOAP extension
  • OpenSSL extension (for HTTPS connections)

License

MIT License