PHPackages                             kstych/php-agi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kstych/php-agi

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kstych/php-agi
==============

Asterisk Gateway Interface (AGI) client for PHP, suitable to make telephony applications using call flow nodes

v1.0.0(4mo ago)05Apache-2.0PHPPHP &gt;=5.3.3

Since Jan 1Pushed 4mo agoCompare

[ Source](https://github.com/kstych/php-agi)[ Packagist](https://packagist.org/packages/kstych/php-agi)[ Docs](http://kstych.com/)[ RSS](/packages/kstych-php-agi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (11)Versions (2)Used By (0)

Introduction
============

[](#introduction)

This framework is intended to simply making ivr applications using Asterisk's AGI, providing a nice level of abstraction over what an IVR should look like from a developers' perspective.

Documentation
=============

[](#documentation)

Installing
==========

[](#installing)

Add this library to your [Composer](https://packagist.org/) configuration. In composer.json:

```
  "require": {
    "kstych/php-agi": "*"
  }
```

Quickstart
==========

[](#quickstart)

You can start by *doc/examples/quickstart* for a very basic example. You'll need something like this in your dialplan:

```
[default]
exten => 1,1,AGI(/path/to/PAGI/doc/examples/quickstart/run.sh,a,b,c,d)
exten => 1,n,Hangup

```

Testing IVR applications
========================

[](#testing-ivr-applications)

A mocked pagi client is included to easily test your ivr applications. See **doc/examples/mock** to see an example of how to use it.

Features
========

[](#features)

Nodes
-----

[](#nodes)

Simple Call Flow Nodes are available (see **doc/examples/node/example.php**). Using nodes will let you simplify how you build and test your ivr applications. Nodes are an abstraction layer above the pagi client, and support:

- Prompts mixing sound files, playing numbers/digits/datetime's.
- Cancel and End Of Input digits.
- Validator callbacks for inputs, can optionally specify 1 or more sound files to play when the validation fails.
- Callbacks for invalid and valid inputs.
- Optional sound when no input.
- Maximum valid input attempts.
- Optional sound when maximum attempts has been reached.
- Expecting at least/at most/exactly N digits per input.
- Timeout between digits in more-than-1 digit inputs.
- Timeout per input attempt.
- Retry Attempts for valid inputs.
- And much more!

The NodeController will let you control the call flow of your application, by registering nodes and actions based on node results. Thus, you can jump from one node to the other on cancel or complete inputs, hangup the call, execute a callback, etc. For an example, see doc/examples/nodecontroller/example.php

AutoDial
--------

[](#autodial)

CallFiles are supported. You can also schedule a call in the future.

Fax
---

[](#fax)

Sending and receiving faxes is supported using spandsp (applications SendFax and ReceiveFax).

Available Facades
-----------------

[](#available-facades)

- PAGI\\Client\\CDR: Provided to access cdr variables.
- PAGI\\Client\\ChannelVariables: Provided to access channel variables and asterisk environment variables.
- PAGI\\Client\\CallerID: Provided to access caller id variables.
- PAGI\\Client\\Result: Provided to wrap up the result for agi commands.
- PAGI\\CallSpool\\CallFile: Call file facade.
- PAGI\\CallSpool\\CallSpool: Call spool facade.
- PAGI\\Logger\\Asterisk: Provides access to asterisk logger (see logger.conf in your asterisk installation).

Results
-------

[](#results)

For every operation, a Result is provided. Some operations decorate this Result to add functionality, like PlayResult, ReadResult, etc. For example, a stream file will return a PlayResult, which decorates a ReadResult which in turn, decorated a Result.

- PAGI\\Client\\DialResult
- PAGI\\Client\\ExecResult
- PAGI\\Client\\ReadResult
- PAGI\\Client\\PlayResult
- PAGI\\Client\\FaxResult

Debugging, logging
------------------

[](#debugging-logging)

You can optionally set a [PSR-3](http://www.php-fig.org/psr/psr-3/) compatible logger:

```
$pagi->setLogger($logger);
```

By default, the client will use the [NullLogger](http://www.php-fig.org/psr/psr-3/#1-4-helper-classes-and-interfaces).

LICENSE
=======

[](#license)

Copyright 2026 Siddharth Upmanyu Copyright 2011 Marcelo Gornstein

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

```
http://www.apache.org/licenses/LICENSE-2.0

```

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance75

Regular maintenance activity

Popularity5

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 95.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

137d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/600f79652d9fa767a0dffc1de7ffef5718a29c45c9de4580eb74308f597684a6?d=identicon)[kstych](/maintainers/kstych)

---

Top Contributors

[![marcelog](https://avatars.githubusercontent.com/u/527356?v=4)](https://github.com/marcelog "marcelog (280 commits)")[![xware42](https://avatars.githubusercontent.com/u/8670002?v=4)](https://github.com/xware42 "xware42 (4 commits)")[![thomasvargiu](https://avatars.githubusercontent.com/u/732012?v=4)](https://github.com/thomasvargiu "thomasvargiu (4 commits)")[![wormling](https://avatars.githubusercontent.com/u/1608160?v=4)](https://github.com/wormling "wormling (2 commits)")[![kstych](https://avatars.githubusercontent.com/u/4062349?v=4)](https://github.com/kstych "kstych (2 commits)")[![rybakit](https://avatars.githubusercontent.com/u/533861?v=4)](https://github.com/rybakit "rybakit (1 commits)")[![agvstin](https://avatars.githubusercontent.com/u/130192?v=4)](https://github.com/agvstin "agvstin (1 commits)")

---

Tags

clientnodeflowasteriskcallivrvoiptelephonyagi

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/kstych-php-agi/health.svg)

```
[![Health](https://phpackages.com/badges/kstych-php-agi/health.svg)](https://phpackages.com/packages/kstych-php-agi)
```

###  Alternatives

[marcelog/pagi

Asterisk Gateway Interface (AGI) client for PHP, suitable to make telephony applications using call flow nodes

192133.7k16](/packages/marcelog-pagi)[marcelog/pami

Asterisk Manager Interface (AMI) client for PHP, event driven, object oriented

415750.6k1](/packages/marcelog-pami)[chan-sccp/pami

Asterisk Manager Interface (AMI) client for PHP, event driven, object oriented (Fork)

2952.3k](/packages/chan-sccp-pami)[wormling/phparia

Asterisk REST Interface (ARI) client for PHP.

419.8k](/packages/wormling-phparia)[mikopbx/core

Free PBX system for SMB based on Asterisk

5271.4k](/packages/mikopbx-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
