PHPackages                             adrian0350/php-ami - 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. adrian0350/php-ami

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

adrian0350/php-ami
==================

PHP Asterisk Management Interface for PHP ^5.1.6 ʕ•ᴥ•ʔ

1.0.8(8y ago)79.3kApache 2.0PHPPHP &gt;=5.1.6

Since Jun 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Adrian0350/PHP-AMI)[ Packagist](https://packagist.org/packages/adrian0350/php-ami)[ Docs](https://github.com/Adrian0350/PHP-AMI)[ RSS](/packages/adrian0350-php-ami/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (10)Used By (0)

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

[](#introduction)

PHP-AMI stands for PHP Asterisk Management Interface. This is a downgraded version of Marcelog's [PAMI](https://github.com/marcelog/PAMI) for **PHP ^5.1.6**. As its name suggests its just a set of PHP classes that will let you issue commands to an AMI and/or receive events, using an observer-listener pattern.

The idea behind this, is to easily implement operator consoles, monitors, etc. either via SOA or ajax.

A port for nodejs is available at: A port for erlang is available at:

Resources
=========

[](#resources)

- [API](http://pami.readthedocs.org/en/latest/ApiIndex/)
- [Complete PAMI talk for the PHP Conference Argentina 2013](http://www.slideshare.net/mgornstein/phpconf-2013). Check the slide notes for the complete text :)

PHP Version
===========

[](#php-version)

Note: PHP-AMI Requires PHP 5.1.6+. PHP versions 5.3.9 and 5.3.10 WILL NOT WORK due to a bug introduced in stream\_get\_line() in 5.3.9. Please use 5.3.11+ or up to 5.3.8 (see README.PHP-5.3.9-and-5.3.10).

Installing
==========

[](#installing)

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

```
  "require": {
    "adrian0350/php-ami": "1.*"
  }
```

QuickStart
==========

[](#quickstart)

For an in-depth tutorial: [http://marcelog.github.com/articles/pami\_introduction\_tutorial\_how\_to\_install.html](http://marcelog.github.com/articles/pami_introduction_tutorial_how_to_install.html)

```
require_once dirname(__FILE__) . '/src/Implementation/AMIListener.php';
require_once dirname(__FILE__) . '/src/Implementation/AMIClient.php';

// Configure as required.
$options = array(
	'host'            => '192.168.1.250',
	'username'        => 'root',
	'password'        => 'toor',
	'port'            => 5038,
	'connect_timeout' => 10,
	'read_timeout'    => 100,
	'scheme'          => 'tcp://'
);

$AMIClient   = new AMIClient($options);
$AMIListener = new AMIListener();

// Registering a closure ** NOT AVAILABLE FOR PHP VERSION 5.1.6 **
$AMIClient->registerEventListener(function($event){});

// Register a specific method of an object for event listening
$AMIClient->registerEventListener(array($AMIListener, 'handle'));

// Register an IEventListener:
$AMIClient->registerEventListener($AMIListener);
```

Using Predicates
================

[](#using-predicates)

A second (optional) argument can be used when registering the event listener: a closure that will be evaluated before calling the callback. The callback will be called only if this predicate returns true:

```
require_once dirname(__FILE__) . '/src/PHPAMI/Message/Event/DialEvent.php';

$AMIClient->registerEventListener(
    array($listener, 'dispatchEvent'),
    function ($event) {
        return $event instanceof DialEvent && $event->getSubEvent() == 'Begin';
    })
);
```

Example
=======

[](#example)

Please see `/index.php` for a very basic example.

Have in mind it uses a higher PHP version
-----------------------------------------

[](#have-in-mind-it-uses-a-higher-php-version)

AsterTrace is a full application: .

Also, you might want to look at this article: [http://marcelog.github.com/articles/php\_asterisk\_listener\_example\_using\_pami\_and\_ding.html](http://marcelog.github.com/articles/php_asterisk_listener_example_using_pami_and_ding.html)

The [march edition](http://sdjournal.org/a-practical-introduction-to-functional-programming-with-php-sdj-issue-released/) of [Software Developer Journal](http://sdjournal.org/) features a complete article about writing telephony applications with [PAMI](https://github.com/MARCELOG/pami) and PAGI.

Currently Supported Events
==========================

[](#currently-supported-events)

More events will be added with time. I can only add the ones I can test for and use, so your contributions may make the difference! ;)

Unknown (not yet implemented) events will be reported as UnknownEvent, so you can still catch them. If you catch one of these, please report it!

- AgentsComplete
- AgentConnect
- Agentlogin
- Agentlogoff
- AGIExec
- Bridge
- CEL
- ChannelUpdate
- ChannelReloadEvent
- ConfbridgeStart
- ConfbridgeEnd
- ConfbridgeJoin
- ConfbridgeLeave
- ConfbridgeMute
- ConfbridgeStart
- ConfbridgeTalking
- ConfbridgeUnmute
- CoreShowChannel
- CoreShowChannelComplete
- DAHDIChannel
- DAHDIShowChannel
- DAHDIShowChannelsComplete
- FullyBooted
- DongleSMSStatus
- DongleUSSDStatus
- DongleNewUSSD
- DongleNewUSSDBase64
- DongleNewCUSD
- DongleStatus
- DongleDeviceEntry
- DongleShowDevicesComplete
- DBGetResponse
- Dial
- DTMF
- Extension
- Hangup
- Hold
- JabberEvent
- Join
- Leave
- Link
- ListDialplan
- Masquerade
- MessageWaiting
- MusicOnHold
- NewAccountCode
- NewCallerid
- Newchannel
- Newexten
- Newstate
- OriginateResponse
- ParkedCall
- ParkedCallsComplete
- PeerEntry
- PeerlistComplete
- PeerStatus
- QueueMember
- QueueMemberAdded
- QueueMemberRemoved
- QueueMemberPause
- QueueMemberStatus
- QueueParams
- QueueStatusComplete
- QueueSummaryComplete
- Reload
- RegistrationsComplete
- Registry
- Rename
- RTCPReceived
- RTCPReceiver
- RTCPSent
- RTPReceiverStat
- RTPSenderStat
- ShowDialPlanComplete
- Success
- Status
- StatusComplete
- Transfer
- Unlink
- UnParkedCall
- UserEvent
- VarSet
- vgsm\_me\_state
- vgsm\_net\_state
- vgsm\_sms\_rx
- VoicemailUserEntry
- VoicemailUserEntryComplete

Currently Supported Actions
===========================

[](#currently-supported-actions)

- AbsoluteTimeout
- AGI
- Agents
- AgentLogoff
- Atxfer (asterisk 1.8?)
- Bridge
- ChangeMonitor
- Command
- ConfbridgeMute
- ConfbridgeUnmute
- CoreSettings
- CoreShowChannels
- CoreStatus
- DAHDIDialOffHookAction
- DAHDIHangup
- DAHDIRestart
- DAHDIShowChannels
- DAHDIDNDOn
- DAHDIDNDOff
- DBGet
- DBPut
- DBDel
- DBDelTree
- DongleSendSMS
- DongleSendUSSD
- DongleSendPDU
- DongleReload
- DongleStop
- DongleStart
- DongleRestart
- DongleReset
- DongleShowDevices
- ExtensionState
- CreateConfig
- GetConfig
- GetConfigJSON
- GetVar
- Hangup
- JabberSend
- LocalOptimizeAway
- Login
- Logoff
- ListCategories
- ListCommands
- MailboxCount
- MailboxStatus
- MeetmeList
- MeetmeMute
- MeetmeUnmute
- MixMonitor
- ModuleCheck
- ModuleLoad (split in ModuleLoad, ModuleUnload, and ModuleReload)
- Monitor
- Originate
- ParkedCalls
- PauseMonitor
- Ping
- PlayDTMF
- Queues
- QueueAdd
- Queue
- QueueLog
- QueuePause
- QueuePenalty
- QueueReload
- QueueRemove
- QueueReset
- QueueRule
- QueueSummary
- QueueStatus
- QueueUnpause
- Redirect
- Reload
- SendText
- SetVar
- ShowDialPlan
- Sipnotify
- Sippeers
- Sipqualifypeer
- Sipshowpeer
- Sipshowregistry
- Status
- StopMixMonitor
- StopMonitor
- UnpauseMonitor
- VGSM\_SMS\_TX
- VoicemailUsersList

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

[](#debugging-logging)

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

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

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

Contributing
------------

[](#contributing)

To contribute:

- Make sure you open a **concise** and **short** pull request.

LICENSE
=======

[](#license)

Copyright 2016 Marcelo Gornstein  (For orignal repo) Copyright 2017 Adrián Zúñiga  (For this repo only)

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

32

—

LowBetter than 69% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~8 days

Total

9

Last Release

3227d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4029295?v=4)[Jaime Zúñiga](/maintainers/adrian0350)[@Adrian0350](https://github.com/Adrian0350)

---

Top Contributors

[![Adrian0350](https://avatars.githubusercontent.com/u/4029295?v=4)](https://github.com/Adrian0350 "Adrian0350 (55 commits)")

---

Tags

asteriskamiElastix

### Embed Badge

![Health badge](/badges/adrian0350-php-ami/health.svg)

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

###  Alternatives

[marcelog/pami

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

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

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

2953.9k](/packages/chan-sccp-pami)[ofbeaton/phpami

Asterisk Manager Interface (AMI) for PHP 5.4+ supporting legacy v1.4 to v13 with no thrills.

1639.5k](/packages/ofbeaton-phpami)[pharaonic/php-dot-array

Access array data quickly/easily using dot-notation and asterisk.

1011.9k4](/packages/pharaonic-php-dot-array)

PHPackages © 2026

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