PHPackages                             d4rkstar/pagi - 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. [API Development](/categories/api)
4. /
5. d4rkstar/pagi

ActiveLibrary[API Development](/categories/api)

d4rkstar/pagi
=============

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

1.11.0(13y ago)116Apache2PHPPHP &gt;=5.3.3

Since Aug 30Pushed 12y ago1 watchersCompare

[ Source](https://github.com/d4rkstar/PAGI)[ Packagist](https://packagist.org/packages/d4rkstar/pagi)[ Docs](http://marcelog.github.com/PAGI)[ RSS](/packages/d4rkstar-pagi/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)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.

Resources:

- [Main Site](http://marcelog.github.com/PAGI)
- [In-depth tutorial](http://marcelog.github.com/articles/pagi_tutorial_create_voip_telephony_application_for_asterisk_with_agi_and_php.html)
- [An example IVR application that includes unit tests is available here](https://github.com/marcelog/Pagi-App-And-Test-Example)
- [API](http://ci.marcelog.name:8080/job/PAGI/javadoc/)
- \[CI (Jenkins)\]( provides API, metrics, and distributables).
- [Packagist Home](http://packagist.org/packages/marcelog/pagi)

Contact me
----------

[](#contact-me)

If you have any questions, issues, feature requests, or just want to report your "success story", or maybe even say hi, please send an email to

Included Example
----------------

[](#included-example)

Please see **docs/examples** for all the included examples.

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

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

```

Available via Composer
----------------------

[](#available-via-composer)

Just add the package "marcelog/pagi":

```
{
    "require": {
        "marcelog/pagi": "dev-master"
    },
    "repositories": [
    {
      "type": "pear",
      "url": "http://pear.apache.org/log4php/"
    }]
}

```

Packagist URL: ()

Available via PEAR
------------------

[](#available-via-pear)

You can now easily install PAGI by issuing:

```
pear channel-discover pear.marcelog.name
pear install marcelog/PAGI

```

or

```
pear install marcelog/PAGI-X.Y.Z

```

just replace X.Y.Z by the release version you'd like to install :)

See the [pear channel](http://pear.marcelog.name/)

Available as PHAR
-----------------

[](#available-as-phar)

Just go to the [Jenkins server](http://ci.marcelog.name) and grab the latest phar distribution from the PAGI job.

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

[](#testing-ivr-applications)

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

Nodes
=====

[](#nodes)

For a tutorial about nodes, see [this article](http://marcelog.github.com/articles/pagi_node_call_flow_easy_telephony_application_for_asterisk_php.html)

Simple Call Flow Nodes are available (see **docs/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 docs/examples/nodecontroller/example.php

An article about the node controller is available [here](http://marcelog.github.com/articles/making_your_ivr_nodes_call_flow_with_pagi_and_php_asterisk.html)

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 need [log4php](http://logging.apache.org/log4php/). Just make sure you copy it to the include\_path and PAGI will pick it up from there (the directory *src/main/php* is the one that needs to be in the include\_path).

Developers
==========

[](#developers)

- build.xml is a phing build file, not ant.
- It's very possible that you may need to edit build.properties.
- Available main targets: all, build, test, report.
- Tools run: phpdoc, phploc, phpcs, phpmd, phpcpd, phpdepend, phpunit.
- Setup your installation by editing pear and php paths in build.properties
- Run phing install-dependencies this will install pear and everything needed to run phing tests and metrics.
- Copy resources/php.ini.example to resources/php.ini and edit it.
- Run phing all

LICENSE
=======

[](#license)

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

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 98.8% 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

Every ~9 days

Total

3

Last Release

4982d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0621d4cadad42f999d6e1579c6de56833cde5cdb9a4387261e3392835d96d471?d=identicon)[d4rkstar](/maintainers/d4rkstar)

---

Top Contributors

[![marcelog](https://avatars.githubusercontent.com/u/527356?v=4)](https://github.com/marcelog "marcelog (245 commits)")[![d4rkstar](https://avatars.githubusercontent.com/u/4957015?v=4)](https://github.com/d4rkstar "d4rkstar (2 commits)")[![agvstin](https://avatars.githubusercontent.com/u/130192?v=4)](https://github.com/agvstin "agvstin (1 commits)")

---

Tags

clientnodeflowasteriskcallivrvoiptelephonyagi

### Embed Badge

![Health badge](/badges/d4rkstar-pagi/health.svg)

```
[![Health](https://phpackages.com/badges/d4rkstar-pagi/health.svg)](https://phpackages.com/packages/d4rkstar-pagi)
```

###  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)[wormling/phparia

Asterisk REST Interface (ARI) client for PHP.

419.8k](/packages/wormling-phparia)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35636.1k2](/packages/telnyx-telnyx-php)[chan-sccp/pami

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

2952.3k](/packages/chan-sccp-pami)[signalwire-community/signalwire

Client library for connecting to SignalWire.

23126.2k](/packages/signalwire-community-signalwire)

PHPackages © 2026

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