radiusone/phpagi

PHPAGI is a PHP class for the Asterisk Gateway Interface.

v3.0.1 2024-01-22 22:04 UTC

This package is auto-updated.

Last update: 2024-04-20 16:24:19 UTC


README

Welcome to PhpAgi.

PhpAgi is a set of PHP classes for use in developing applications with the Asterisk Gateway Interface and Asterisk Manager Interface, and is licensed under the GNU Lesser General Public License (see COPYING for terms).

Compatibility

This release (version 3) of the PhpAgi classes is a significant overhaul from the old versions. Classes have been namespaced and renamed. Class properties are now strictly typed, as are method parameters and returns. Many new methods have been added, and old ones may have been renamed or had their signatures and behaviour changed from the previous version.

A possibly-not-exhaustive list of backwards-incompatible changes includes:

AGI::evaluate(string $command, ...$args)
The value of the code element of the return array will now always be an integer; the values of all other elements will always be strings. This is a private method, but its return is used for all AGI command methods.
Not a breaking change, but previously this method only accepted one string parameter. Now, if multiple parameters are provided, the first is treated as a printf() format specification, and remaining ones are passed into the string. When using this mode, any string values are wrapped in double quotes.
AGI::exec(string $application, array $args)
Previously, $args could be a string or an array. Now, only an array can be passed.
AMI::Atxfer(string $Channel, string $Exten, string $Context, string $ActionID = null)
The $Priority parameter is not supported by Asterisk and has been removed.
AMI::Getvar(string $Variable, string $Channel = null, string $ActionID = null)
AMI::Setvar(string $Variable, string $Value, string $Channel = null, string $ActionID = null)
The $Variable and $Channel parameters have swapped places, as the channel is now optional. If ommitted, a global variable will instead be returned or set.
AMI::Originate(string $Channel, string $Exten = null, string $Context = null, string $Priority = null, string $Application = null, string $Data = null, $Timeout = 0, string $Variable = null, string $Account = null, bool $Async = false, string $ActionID = null, bool $EarlyMedia = false, string $Codecs = null, string $ChannelId = null, string $OtherChannelId = null, string $CallerID = null)
AMI::ParkedCalls(string $ParkingLot = null, string $ActionID = null)
AMI::QueueStatus(string $Queue = null, string $Member = null, string $ActionID = null)
AMI::Status(string $Channel = null, string $Variables = null, bool $AllVariables = false, string $ActionID = null)
One ore more additional parameters were added to match updates to the AMI commands. For consistency with other methods, the new parameters were inserted, keeping $ActionID as the last parameter.
AMI::Redirect(string $Channel, string $Exten, string $Context, string $Priority, string $ExtraChannel = null, string $ExtraExten = null, string $ExtraContext = null, string $ExtraPriority = null, string $ActionID = null)
The parameters of this method have been extensively changed to reflect that the $ExtraChannel parameter is optional, and to allow the setting of other optional $Extra* values.

Installation

The preferred way to install this extension is through composer.

composer config repositories.radiusone-phpagi github https://github.com/radiusone/phpagi
composer require radiusone/phpagi dev-master

Files

  • src/AGI.php - The AGI class.

  • src/AMI.php - The Asterisk Manager class.

  • src/fastagi.php - An example of a basic FastAGI server.

  • docs/ - README files for the classes.

  • api-docs/ - API Documentation (html)

Docs

  • README - The main README

  • README.ami - The AMI README

  • README.fastagi - FastAGI README

  • phpagi.example.conf - An example configuration file

  • fastagi.xinetd - xinetd.conf sample configuration for the FastAGI server

SUPPORT

Support for phpagi is available from the project website.