PHPackages                             voipforall/laravel-asterisk-ari - 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. voipforall/laravel-asterisk-ari

ActiveLibrary

voipforall/laravel-asterisk-ari
===============================

Laravel integration for Asterisk REST Interface (ARI)

v1.0.1(1mo ago)02↑2900%MITPHPPHP ^8.2CI passing

Since Mar 29Pushed 1mo agoCompare

[ Source](https://github.com/voipforall/laravel-asterisk-ari)[ Packagist](https://packagist.org/packages/voipforall/laravel-asterisk-ari)[ RSS](/packages/voipforall-laravel-asterisk-ari/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

[![](https://private-user-images.githubusercontent.com/30990097/285342232-cd0f5703-190d-4ab3-bf7d-21bce29fbf67.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ4NjA3MTcsIm5iZiI6MTc3NDg2MDQxNywicGF0aCI6Ii8zMDk5MDA5Ny8yODUzNDIyMzItY2QwZjU3MDMtMTkwZC00YWIzLWJmN2QtMjFiY2UyOWZiZjY3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzMwVDA4NDY1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU0Y2ExNzNkZGJmMzMxMmQwMTg2YjQ5OTI4NThjZDc3Yzk3ZTg3ZDY4ZTBkNmZjYzg3MmQzZTM5YjJkMDgxYmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.fg5JMEvmtAyYr6Q5n3jIAcx7AfIv_YjRA9YIQv_HeME)](https://private-user-images.githubusercontent.com/30990097/285342232-cd0f5703-190d-4ab3-bf7d-21bce29fbf67.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQ4NjA3MTcsIm5iZiI6MTc3NDg2MDQxNywicGF0aCI6Ii8zMDk5MDA5Ny8yODUzNDIyMzItY2QwZjU3MDMtMTkwZC00YWIzLWJmN2QtMjFiY2UyOWZiZjY3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAzMzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMzMwVDA4NDY1N1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU0Y2ExNzNkZGJmMzMxMmQwMTg2YjQ5OTI4NThjZDc3Yzk3ZTg3ZDY4ZTBkNmZjYzg3MmQzZTM5YjJkMDgxYmYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.fg5JMEvmtAyYr6Q5n3jIAcx7AfIv_YjRA9YIQv_HeME)

Laravel Asterisk ARI
====================

[](#laravel-asterisk-ari)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cbaec197b11272317a1ed474a60bd6c68fcf107edb94831b467eff7b1578ea48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766f6970666f72616c6c2f6c61726176656c2d617374657269736b2d6172692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/voipforall/laravel-asterisk-ari)[![Total Downloads](https://camo.githubusercontent.com/e9e542e9f5abba3d4538cc6d17355982dda36d5fb3eb9d1a74ede2e51a08730b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766f6970666f72616c6c2f6c61726176656c2d617374657269736b2d6172692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/voipforall/laravel-asterisk-ari)[![GitHub Actions](https://github.com/voipforall/laravel-asterisk-ari/actions/workflows/tests.yml/badge.svg)](https://github.com/voipforall/laravel-asterisk-ari/actions/workflows/tests.yml/badge.svg)

An opinionated Laravel package for managing Asterisk PBX through the [Asterisk REST Interface (ARI)](https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/).

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel 11, 12 or 13

Installation
------------

[](#installation)

```
composer require voipforall/laravel-asterisk-ari
```

Publish the configuration file:

```
php artisan vendor:publish --tag=asterisk-config
```

Configuration
-------------

[](#configuration)

Add the following variables to your `.env` file:

```
ASTERISK_ARI_HOST=127.0.0.1
ASTERISK_ARI_PORT=8088
ASTERISK_ARI_USER=asterisk
ASTERISK_ARI_PASSWORD=your-secret
ASTERISK_ARI_APP=laravel
ASTERISK_ARI_SCHEME=http
ASTERISK_ARI_WS_SCHEME=ws
ASTERISK_ARI_TIMEOUT=10
```

VariableDescriptionDefault`ASTERISK_ARI_HOST`Asterisk server IP or hostname`127.0.0.1``ASTERISK_ARI_PORT`ARI HTTP port`8088``ASTERISK_ARI_USER`ARI username`asterisk``ASTERISK_ARI_PASSWORD`ARI password*(required)*`ASTERISK_ARI_APP`Stasis application name`laravel``ASTERISK_ARI_SCHEME`HTTP scheme (`http` or `https`)`http``ASTERISK_ARI_WS_SCHEME`WebSocket scheme (`ws` or `wss`)`ws``ASTERISK_ARI_TIMEOUT`HTTP request timeout in seconds`10`Usage
-----

[](#usage)

You can use the `Ari` facade or inject `AriManager` directly:

```
use VoIPforAll\AsteriskAri\Facades\Ari;

// Via facade
$channels = Ari::channels()->list();

// Via injection
use VoIPforAll\AsteriskAri\AriManager;

public function __construct(private AriManager $ari) {}

public function index()
{
    return $this->ari->channels()->list();
}
```

---

API Reference
-------------

[](#api-reference)

### Channels

[](#channels)

Manage active channels (calls) on Asterisk.

```
use VoIPforAll\AsteriskAri\Facades\Ari;
```

#### List all channels

[](#list-all-channels)

```
Ari::channels()->list();
```

#### Get channel details

[](#get-channel-details)

```
Ari::channels()->get(string $channelId);
```

#### Originate a call

[](#originate-a-call)

```
Ari::channels()->originate(
    endpoint: 'PJSIP/1000',
    extension: '1001',
    context: 'default',
    callerId: '"John" ',
    timeout: 30,
    app: 'laravel',
);
```

ParameterTypeRequiredDescription`endpoint``string`YesTarget endpoint (e.g. `PJSIP/1000`)`extension``?string`NoExtension to dial`context``?string`NoDialplan context`callerId``?string`NoCaller ID string`timeout``?int`NoDial timeout in seconds`app``?string`NoStasis application to place channel into#### Hangup a channel

[](#hangup-a-channel)

```
Ari::channels()->hangup(string $channelId, string $reason = 'normal');
```

#### Answer a channel

[](#answer-a-channel)

```
Ari::channels()->answer(string $channelId);
```

#### Hold / Unhold

[](#hold--unhold)

```
Ari::channels()->hold(string $channelId);
Ari::channels()->unhold(string $channelId);
```

#### Mute / Unmute

[](#mute--unmute)

```
Ari::channels()->mute(string $channelId, string $direction = 'both');
Ari::channels()->unmute(string $channelId, string $direction = 'both');
```

The `$direction` parameter accepts: `both`, `in`, or `out`.

#### Channel Variables

[](#channel-variables)

```
Ari::channels()->getVariable(string $channelId, string $variable);
Ari::channels()->setVariable(string $channelId, string $variable, string $value);
```

#### Send DTMF

[](#send-dtmf)

```
Ari::channels()->sendDtmf(string $channelId, string $dtmf);
```

#### Record a channel

[](#record-a-channel)

```
Ari::channels()->record(string $channelId, string $name, string $format = 'wav');
```

---

### Bridges

[](#bridges)

Manage bridges (conference rooms, call mixing).

#### List all bridges

[](#list-all-bridges)

```
Ari::bridges()->list();
```

#### Get bridge details

[](#get-bridge-details)

```
Ari::bridges()->get(string $bridgeId);
```

#### Create a bridge

[](#create-a-bridge)

```
Ari::bridges()->create(string $type = 'mixing', ?string $name = null);
```

Bridge types: `mixing`, `holding`, `dtmf_events`, `proxy_media`.

#### Destroy a bridge

[](#destroy-a-bridge)

```
Ari::bridges()->destroy(string $bridgeId);
```

#### Add channels to a bridge

[](#add-channels-to-a-bridge)

```
// Single channel
Ari::bridges()->addChannel(bridgeId: '1234', channels: 'channel-id');

// Multiple channels
Ari::bridges()->addChannel(bridgeId: '1234', channels: ['channel-1', 'channel-2']);
```

#### Remove channels from a bridge

[](#remove-channels-from-a-bridge)

```
Ari::bridges()->removeChannel(bridgeId: '1234', channels: 'channel-id');
Ari::bridges()->removeChannel(bridgeId: '1234', channels: ['channel-1', 'channel-2']);
```

---

### Endpoints

[](#endpoints)

Query registered endpoints (SIP/PJSIP peers).

#### List all endpoints

[](#list-all-endpoints)

```
Ari::endpoints()->list();
```

#### List by technology

[](#list-by-technology)

```
Ari::endpoints()->listByTechnology(string $technology);

// Example
Ari::endpoints()->listByTechnology('PJSIP');
```

#### Get a specific endpoint

[](#get-a-specific-endpoint)

```
Ari::endpoints()->get(string $technology, string $resource);

// Example
Ari::endpoints()->get('PJSIP', '1000');
```

---

### Device States

[](#device-states)

Manage custom device states.

#### List all device states

[](#list-all-device-states)

```
Ari::deviceStates()->list();
```

#### Get device state

[](#get-device-state)

```
Ari::deviceStates()->get(string $deviceName);
```

#### Update device state

[](#update-device-state)

```
Ari::deviceStates()->update(string $deviceName, string $state);
```

Valid states: `NOT_INUSE`, `INUSE`, `BUSY`, `INVALID`, `UNAVAILABLE`, `RINGING`, `RINGINUSE`, `ONHOLD`.

#### Delete device state

[](#delete-device-state)

```
Ari::deviceStates()->delete(string $deviceName);
```

---

### Recordings

[](#recordings)

Manage stored and live recordings.

#### Stored Recordings

[](#stored-recordings)

```
Ari::recordings()->listStored();
Ari::recordings()->getStored(string $name);
Ari::recordings()->deleteStored(string $name);
```

#### Live Recordings

[](#live-recordings)

```
Ari::recordings()->getLive(string $name);
Ari::recordings()->stop(string $name);
Ari::recordings()->pause(string $name);
Ari::recordings()->unpause(string $name);
```

---

### Asterisk

[](#asterisk)

Query Asterisk system information.

#### Get system info

[](#get-system-info)

```
// All info
Ari::asterisk()->info();

// Filtered (build, system, config, status)
Ari::asterisk()->info(only: 'system');
```

#### Ping

[](#ping)

```
Ari::asterisk()->ping(); // Returns true if Asterisk is reachable
```

#### Get global variable

[](#get-global-variable)

```
Ari::asterisk()->getVariable(string $variable);
```

---

WebSocket Events
----------------

[](#websocket-events)

Listen to real-time ARI events using the built-in Artisan command:

```
php artisan ari:listen
```

The command connects to Asterisk via WebSocket with automatic reconnection (exponential backoff up to 60s). Use `SIGTERM` or `SIGINT` (Ctrl+C) for graceful shutdown.

### Supported Events

[](#supported-events)

All events are dispatched as standard Laravel events. Register listeners in your `EventServiceProvider` or use the `Event` facade:

ARI EventLaravel Event Class`StasisStart``VoIPforAll\AsteriskAri\Events\StasisStart``StasisEnd``VoIPforAll\AsteriskAri\Events\StasisEnd``ChannelCreated``VoIPforAll\AsteriskAri\Events\ChannelCreated``ChannelDestroyed``VoIPforAll\AsteriskAri\Events\ChannelDestroyed``ChannelStateChange``VoIPforAll\AsteriskAri\Events\ChannelStateChange``ChannelEnteredBridge``VoIPforAll\AsteriskAri\Events\ChannelEnteredBridge``ChannelLeftBridge``VoIPforAll\AsteriskAri\Events\ChannelLeftBridge``BridgeCreated``VoIPforAll\AsteriskAri\Events\BridgeCreated``BridgeDestroyed``VoIPforAll\AsteriskAri\Events\BridgeDestroyed``DeviceStateChanged``VoIPforAll\AsteriskAri\Events\DeviceStateChanged`### Listening to Events

[](#listening-to-events)

```
// In a Listener class
use VoIPforAll\AsteriskAri\Events\StasisStart;

class HandleIncomingCall
{
    public function handle(StasisStart $event): void
    {
        $channel = $event->getChannel();
        $args = $event->getArgs();

        // Handle the incoming call...
    }
}
```

Every event extends `AriEvent` and provides:

```
$event->payload;          // Full raw payload from ARI
$event->getType();        // Event type string
$event->getTimestamp();   // Event timestamp
$event->getApplication(); // Stasis application name
```

### Registering Custom Events

[](#registering-custom-events)

You can register additional ARI event types:

```
use VoIPforAll\AsteriskAri\Events\EventFactory;

EventFactory::register('PlaybackFinished', \App\Events\PlaybackFinished::class);
```

The custom event class must extend `VoIPforAll\AsteriskAri\Events\AriEvent`.

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [VoIPforAll](https://github.com/voipforall)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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 ~0 days

Total

2

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b539535ee6847b1219203f6720f8332f63f1b078e9c204628a11c0dcd5ed054c?d=identicon)[cristiano\_voipforall](/maintainers/cristiano_voipforall)

---

Top Contributors

[![cristianovalenca](https://avatars.githubusercontent.com/u/30990097?v=4)](https://github.com/cristianovalenca "cristianovalenca (8 commits)")

---

Tags

laravelasteriskvoippbxARIpjsip

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/voipforall-laravel-asterisk-ari/health.svg)

```
[![Health](https://phpackages.com/badges/voipforall-laravel-asterisk-ari/health.svg)](https://phpackages.com/packages/voipforall-laravel-asterisk-ari)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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