Download the PHP package bitdreamit/laravel-mikopbx without Composer

On this page you can find all versions of the php package bitdreamit/laravel-mikopbx. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-mikopbx

bitdreamit/laravel-mikopbx

The most complete open-source Laravel package for MikoPBX โ€” a full call center CRM platform with a real browser softphone (WebRTC/JsSIP), auto dialer, live agent panel, IVR builder, analytics, recordings, blacklist, callbacks, conference rooms, and system health monitoring.

PHP Laravel MikoPBX


Table of Contents


Features

Feature Description
๐Ÿ“ž Live Call Board Real-time active calls with transfer, mute, hangup via AMI
๐Ÿ“ฑ Web Dialer Real browser softphone โ€” WebRTC calling via JsSIP, no desk phone required
๐Ÿ”” Incoming Call Popup Native Answer/Reject alert with ringtone, driven directly by JsSIP's newRTCSession event
๐Ÿ‘ฅ Agent Management Status grid, click-to-call, sync from MikoPBX, DND/away support
๐Ÿ“ข Auto Dialer Create campaigns, upload number lists, voice broadcast, IVR survey
๐ŸŒฟ IVR Builder Visual node editor โ€” Press 1 for Sales, Press 2 for Support
๐Ÿ“Š Analytics Daily trend, peak hours, ASR %, agent performance, Chart.js
๐ŸŽ™๏ธ Recordings Audio player, proxy stream with Bearer auth, download, search by number/date
๐Ÿšซ Blacklist Block inbound/outbound numbers with expiry
๐Ÿ“… Callbacks Schedule, prioritise, attempt, assign to agent
๐ŸŽ™๏ธ Conference Room list, kick/mute participants
โค๏ธ Health Monitor AMI + SIP + REST API status check with 60-second auto-poll
๐Ÿงช Dialer Debug Page Step-by-step diagnostic tool for WebSocket, mic, and SIP registration issues
๐Ÿงช MikoPBXFake Full test double โ€” assertOriginated, assertTransferred etc.

Requirements

Requirement Version Notes
PHP 8.2+ Required for enums
Laravel 11 or 12 Tested on both
Livewire 3.x For real-time components
MikoPBX 2024.2+ REST API v3 and WebRTC must be enabled
A modern browser any Chrome/Firefox/Edge โ€” WebRTC requires HTTPS in production
MySQL / PostgreSQL / SQLite any For local CDR storage

Installation

Step 1 โ€” Install the package

Step 2 โ€” Run the installer

This command:

If installing manually instead of via the command:

Step 3 โ€” Add to .env

Copy .env.mikopbx.example and add the values to your .env file. See Environment Variables below.

Step 4 โ€” Set up MikoPBX admin panel

See MikoPBX Setup below.

Step 5 โ€” Assign extensions to your users

The web dialer needs to know which MikoPBX extension belongs to each logged-in user. This is stored directly on your users table:

Add the trait to your User model for convenience helpers (callNumber(), callLogs(), pendingCallbacks()):

Step 6 โ€” Start the AMI listener

See Start AMI Listener below.

Step 7 โ€” Sync extensions and open the dashboard

Visit https://yourapp.com/pbx in your browser.


MikoPBX Setup

1. Enable AMI User

Go to: MikoPBX Admin Panel โ†’ System โ†’ AMI Users โ†’ Add

Field Value
Username laravelapp
Secret your-strong-ami-secret
Allowed IP Your Laravel server IP
Permissions all (or: call, originate, reporting, system)

Save and Apply Config.

2. Get REST API Key

Go to: MikoPBX Admin Panel โ†’ Settings โ†’ API Keys โ†’ Generate

Copy the JWT token and set it as MIKOPBX_API_KEY in your .env.

The REST API v3 uses Bearer token authentication in the Authorization header. The old X-Auth-Token header is not used in v3.

3. Enable WebRTC for the Web Dialer

This is required for the browser softphone to work at all:

MikoPBX registers WebRTC endpoints with a -WS suffix internally (e.g. extension 121 becomes 121-WS for WebRTC registrations). The package handles this automatically โ€” you only ever store the plain number (121) in users.pbx_extension.

4. Optional โ€” Create ARI User

Go to: MikoPBX Admin Panel โ†’ System โ†’ ARI Users โ†’ Add

Needed only if you use the ARIService for WebSocket channel control beyond what the web dialer needs.


Environment Variables

All config values are documented in config/mikopbx.php.


Web Dialer Setup (WebRTC / JsSIP)

The package includes a full browser-based softphone built on JsSIP โ€” no desk phone or separate SIP client required. It is self-hosted (no CDN dependency) and lives at public/vendor/mikopbx/jssip.min.js.

How it works

Required per-user setup

Each user who will use the web dialer needs both fields set:

Important: the SIP password is not the user's login password โ€” it is the extension's SIP secret, found in MikoPBX Admin โ†’ Extensions โ†’ edit โ†’ SIP password.

Critical JsSIP configuration detail

The JsSIP.UA must be created with authorization_user set to the plain extension number (not the -WS suffixed one), and must not manually override the contact option:

This is already handled correctly by the package's shipped layouts/app.blade.php โ€” documented here so you don't reintroduce the bug if you customize the dialer.

Diagnosing dialer issues โ€” /pbx/dialer/debug

Visit https://yourapp.com/pbx/dialer/debug for a step-by-step diagnostic tool that checks, in order:

  1. Config API โ€” confirms your user has pbx_extension set and the backend returns valid SIP config
  2. WebSocket connection โ€” tests raw connectivity to wss://.../asterisk/ws (catches firewall/port issues)
  3. JsSIP library loaded โ€” confirms public/vendor/mikopbx/jssip.min.js is reachable
  4. Microphone permission โ€” WebRTC requires HTTPS (except on localhost) or mic access is silently blocked
  5. SIP registration โ€” attempts a real REGISTER and shows the raw SIP response
  6. Test call โ€” places a real WebRTC call to a number you specify, so you can confirm two-way audio end-to-end

Console diagnostics on the live dashboard

From any page under /pbx, open DevTools and run:

This inspects the actual production JsSIP.UA instance (not a separate test one) and prints its live registration state โ€” useful for confirming the softphone is still registered at the exact moment a call comes in.


Start AMI Listener (Supervisor)

The AMI listener is the daemon that connects to MikoPBX port 5038, receives real-time events (incoming calls, hangups, agent status changes), and dispatches Laravel events for the UI.

The supervisor config runs:

This command connects to AMI, subscribes to all events, and loops forever. It auto-restarts on crash.


Pages & Routes

All routes are under the configurable prefix (default /pbx).

URL Route Name Description
/pbx mikopbx.dashboard Dashboard โ€” live calls, task manager, campaigns, follow-up list
/pbx/calls mikopbx.calls.index CDR table with real-time filters (Livewire)
/pbx/calls/{id} mikopbx.calls.show Single call detail + recording player + actions
/pbx/campaigns mikopbx.campaigns.index Campaign cards grid
/pbx/campaigns/create mikopbx.campaigns.create Create campaign with number upload
/pbx/campaigns/{id} mikopbx.campaigns.show Live campaign detail with number list
/pbx/agents mikopbx.agents.index Agent table with status change and click-to-call
/pbx/analytics mikopbx.analytics.index Chart.js analytics dashboard
/pbx/recordings mikopbx.recordings.index Recordings with sticky audio player
/pbx/blacklist mikopbx.blacklist.index Blacklist manager
/pbx/callbacks mikopbx.callbacks.index Callback scheduler
/pbx/conference mikopbx.conference.index Conference rooms
/pbx/ivr/builder mikopbx.ivr.builder Visual IVR builder
/pbx/health mikopbx.health.index System health monitor
/pbx/dialer/debug mikopbx.dialer.debug Web dialer diagnostic tool

Internal API / AJAX routes (used by the frontend)

Method URL Description
GET /pbx/calls/active/json Active calls list, polled by the dashboard header
POST /pbx/calls/originate AMI fallback originate (used when WebRTC isn't registered)
POST /pbx/calls/transfer Transfer call (AMI)
POST /pbx/calls/hangup Hangup call (AMI)
POST /pbx/calls/mute Mute/unmute (AMI)
GET /pbx/agents/statuses Agent status list, polled by the header
POST /pbx/agents/status Manual status change (from the Agents page dropdown)
POST /pbx/agents/web-dialer-status Reports browser softphone online/busy/offline โ€” see Live Agent Online Status
POST /pbx/agents/sync Pull extensions from MikoPBX
GET /pbx/dialer/config SIP/JsSIP config for the current user's browser softphone

Webhook route (no auth)

URL Description
POST /mikopbx-webhook/call Receive call events pushed from MikoPBX (closures, secured by header secret)

Facade Usage


Livewire Components

All components can be used standalone in any Blade view:

Note on incoming calls: the Answer/Reject popup is not a Livewire component. It's handled natively by Alpine.js directly in layouts/app.blade.php, driven by JsSIP's own newRTCSession event โ€” this avoids the latency of a server round-trip for something as time-sensitive as a ringing call. If you're looking for IncomingCallPopup.php, it exists in src/Livewire/ but is unused by the default layout; it's kept for anyone who prefers a server-driven popup instead.


Artisan Commands

Command Description
php artisan mikopbx:install Full setup wizard (publish config, run migrations, publish JsSIP, write Supervisor config)
php artisan mikopbx:listen AMI daemon โ€” run via Supervisor in production
php artisan mikopbx:cdr-sync --days=1 Pull CDR from MikoPBX REST API v3 and store locally
php artisan mikopbx:sync-extensions Pull extensions from MikoPBX and upsert local DB
php artisan mikopbx:campaign-run Start campaigns that are scheduled and due
php artisan mikopbx:campaign-run --sync Sync progress of all running campaigns
php artisan mikopbx:health Run health check (exit code 1 on critical)

Scheduler (optional)

Add to your routes/console.php or App\Console\Kernel:


REST API v3 Endpoints Reference

Authentication: All requests need Authorization: Bearer {API_KEY} header.

Response envelope (every endpoint):

CDR โ€” Call Records

Method Endpoint Description
GET /pbxcore/api/v3/cdr List CDR with filters
GET /pbxcore/api/v3/cdr/{id} Single CDR record
DELETE /pbxcore/api/v3/cdr/{id} Delete CDR record
GET /pbxcore/api/v3/cdr:playback Stream recording audio (token-based URL)
GET /pbxcore/api/v3/cdr:download Download recording file (token-based URL)
GET /pbxcore/api/v3/cdr:getMetadata CDR column metadata
GET /pbxcore/api/v3/cdr:getStatsByProvider Stats by SIP provider

GET /pbxcore/api/v3/cdr query parameters:

Parameter Required Description
limit No Max records (default 20, max 100)
offset No Skip N records for pagination
dateFrom No Start date: 2026-06-01 00:00:00
dateTo No End date: 2026-06-30 23:59:59
src_num No Filter by caller number
dst_num No Filter by called number

PBX Status

Method Endpoint Description
GET /pbxcore/api/v3/pbx-status:getActiveCalls Active calls right now (grouped display data, no channel names โ€” see below)
GET /pbxcore/api/v3/pbx-status:getActiveChannels Active Asterisk channels (has real channel names, needed for AMI hangup/transfer)

getActiveCalls() alone does not return a usable channel name field for AMI actions. The package's LiveCallBoard component cross-references it against getActiveChannels() to resolve the real channel string (e.g. PJSIP/121-00000010) before allowing Transfer/Hangup.

Extensions & Employees

Method Endpoint Description
GET /pbxcore/api/v3/extensions:getForSelect Extensions as {value, text}
GET /pbxcore/api/v3/extensions Full extension list
GET /pbxcore/api/v3/extensions/{id} Single extension
GET /pbxcore/api/v3/employees All employees
POST /pbxcore/api/v3/employees Create employee
PUT /pbxcore/api/v3/employees/{id} Update employee

MikoPBX sometimes embeds HTML (Semantic UI icon tags) inside the text field of getForSelect responses โ€” the package strips these with strip_tags() before storing display names.

SIP Peer Status

Method Endpoint Description
GET /pbxcore/api/v3/sip:getPeersStatuses All SIP peers with state
GET /pbxcore/api/v3/sip:getRegistry SIP registration status
GET /pbxcore/api/v3/sip/{id}:getStatus Single peer status
GET /pbxcore/api/v3/sip/{id}:getStats Peer call statistics

SIP peer state values: OK | REGISTERED | UNREACHABLE | LAGGED | UNKNOWN | OFF

SIP Providers (trunks)

Method Endpoint Description
GET /pbxcore/api/v3/sip-providers:getStatuses All trunk registration states
GET /pbxcore/api/v3/sip-providers Full trunk list
GET /pbxcore/api/v3/sip-providers/{id}:getStatus Single trunk status
POST /pbxcore/api/v3/sip-providers/{id}:forceCheck Force re-registration

IVR Menu

Method Endpoint Description
GET /pbxcore/api/v3/ivr-menu All IVR menus
POST /pbxcore/api/v3/ivr-menu Create IVR menu
PUT /pbxcore/api/v3/ivr-menu/{id} Update IVR menu
DELETE /pbxcore/api/v3/ivr-menu/{id} Delete IVR menu

Conference Rooms

Method Endpoint Description
GET /pbxcore/api/v3/conference-rooms All conference rooms
POST /pbxcore/api/v3/conference-rooms Create room

Sound Files

Method Endpoint Description
GET /pbxcore/api/v3/sound-files:getForSelect As {value, text} list
POST /pbxcore/api/v3/sound-files:uploadFile Upload audio (multipart)

System

Method Endpoint Description
GET /pbxcore/api/v3/sysinfo:getInfo System info, disk, CPU, version
GET /pbxcore/api/v3/system:ping Health ping (no auth needed)
GET /pbxcore/api/v3/system:checkAuth Verify API key is valid

How Call Control Works (AMI, not REST)

Critical: MikoPBX REST API v3 has no originate, transfer, hangup, or mute endpoints. All call control goes through AMI (Asterisk Manager Interface) on TCP port 5038.

The web dialer (browser softphone) is a third path entirely โ€” it doesn't go through Laravel at all for call setup. JsSIP talks directly to MikoPBX over the WebRTC WebSocket, and Laravel is only used to hand out SIP credentials (/pbx/dialer/config) and to report status changes (/pbx/agents/web-dialer-status).

AMI Event โ†’ Laravel Event

The mikopbx:listen daemon receives these AMI events and fires Laravel Events:

AMI Event Trigger Laravel Event Echo Channel
Newchannel Phone rings IncomingCallEvent mikopbx.calls .incoming
Bridge Call answered CallAnsweredEvent mikopbx.calls .answered
Hangup Call ended CallEndedEvent mikopbx.calls .ended
PeerStatus Agent login/out AgentStatusChangedEvent mikopbx.agents .status

CDR Field Names & Nested Structure

Important: MikoPBX REST API v3's CDR response is nested by call, not a flat list โ€” this trips up most first attempts at integration.

Real response shape from GET /pbxcore/api/v3/cdr:

Each top-level item in data.records[] is one call (grouped by linkedid); the actual per-channel-leg detail โ€” including UNIQUEID, playback_url, and recordingfile โ€” is nested one level deeper inside that item's own records[] array. php artisan mikopbx:cdr-sync flattens this correctly and merges group-level fields (src_num, dst_num) into each inner record before saving.

Our DB Column MikoPBX v3 Field Notes
caller src_num Caller phone number
callee dst_num Called phone number
uniqueid UNIQUEID Capital letters, and one level deeper than the group
channel src_chan e.g. PJSIP/121-00000004
started_at start Has microseconds (20:37:18.896) โ€” stripped before saving to MySQL
answered_at answer Empty string if not answered
ended_at endtime Call end time
status disposition ANSWERED / NOANSWER (no space) / BUSY / FAILED
duration duration Total seconds (inner record) or totalDuration (group level)
billsec billsec Answered seconds (inner record) or totalBillsec (group level)
recording_file recordingfile Full server path โ€” package stores just the basename
recording_url playback_url Relative, token-based URL โ€” proxied through Laravel with Bearer auth so the browser never needs the API key

Pagination uses data.pagination.hasMore (not a simple record-count comparison) to know when to fetch the next page.


Live Agent Online Status

The Live Call Board and CDR sync (server-side, via REST API) and the web dialer's own registration state (client-side, via JsSIP in the browser) are two entirely separate systems. A browser can be fully registered and able to make/receive WebRTC calls while MikoPBX's own sip:getPeersStatuses endpoint doesn't cleanly reflect that -WS registration โ€” which would otherwise make agents appear offline in the Agent Status Grid even while actively on a call.

To fix this, the web dialer actively reports its own state to the server:

AgentService::all() trusts a browser-reported status for 90 seconds before letting the next AMI/REST poll overwrite it โ€” this prevents the status flickering between "online" and "offline" on every 10-second poll cycle just because MikoPBX's peer-status endpoint doesn't recognize the WebRTC contact the same way it does a desk phone.


Testing with MikoPBXFake

MikoPBXFake replaces the MikoPBX service container binding. No real API or AMI calls during tests.

Available assertions

Method Description
assertOriginated($from, $to) Assert a call was originated
assertNotOriginated($from, $to) Assert call was NOT made
assertOriginateCount($n) Assert exactly N originate calls
assertNothingOriginated() Assert zero calls were originated
assertTransferred($channel, $to) Assert a transfer was performed
assertHungUp($channel) Assert a channel was hung up
assertCampaignStarted() Assert a campaign was started
failOnNextCall() Make next originate throw exception
reset() Clear all recorded calls between tests

Database Tables

All tables use the prefix mikopbx_ (configurable in config/mikopbx.php), plus two new columns added directly to your existing users table.

Table / Column Description
mikopbx_extensions Agents / SIP extensions synced from MikoPBX
mikopbx_call_logs CDR โ€” local copy of call records
mikopbx_campaigns Auto dialer campaigns
mikopbx_campaign_numbers Numbers in each campaign with per-number status
mikopbx_blacklist Blocked numbers with direction and expiry
mikopbx_callbacks Scheduled callback tasks
mikopbx_ivr_trees IVR node definitions
mikopbx_conference_rooms Conference room config
mikopbx_agent_status_log Agent status change history
mikopbx_health_logs Health check results over time
users.pbx_extension The MikoPBX extension number for this user's web dialer
users.pbx_sip_password The SIP password for that extension (hidden from JSON output)

Real-time Events (Laravel Echo)

Set up Laravel Echo in your resources/js/bootstrap.js:

If Echo is not configured, you will see Laravel Echo cannot be found logged by Livewire in the browser console โ€” this is harmless. Livewire.on() listeners (used for the ringtone and toast events) work over Livewire's own local event bus and do not require Echo/broadcasting to function.

Channel Event Trigger
mikopbx.calls .incoming Incoming call detected via AMI (server-side CDR/board updates)
mikopbx.calls .answered Call was answered
mikopbx.calls .ended Call ended/missed
mikopbx.agents .status Agent went online/offline/busy

Note: the browser's own incoming-call popup does not depend on these Echo events โ€” it's driven directly by JsSIP's newRTCSession event for near-instant response. Echo/AMI events update the server-side dashboard widgets (Live Call Board, Agent Status Grid) in parallel.


Package Structure


Anyone installs it


Troubleshooting

Outbound call connects but has NO audio on either side

This is the single most common WebRTC failure mode and almost always points to one cause: missing or unreachable TURN server.

Symptom: you click Call, the other side picks up, the call timer is counting, but neither party can hear the other. The SIP signaling completed (the call is "connected" because the INVITE/200 OK/ACK handshake travels through the WebSocket), but the RTP media path was never established because ICE could not traverse NAT using STUN alone.

Diagnostics (in this order):

  1. Open browser DevTools โ†’ Console. Look for [ICE] iceConnectionState: lines.
    • connected or completed = good.
    • failed = ICE failed โ†’ TURN issue.
    • If you never see this log line at all, the layout is stale โ€” republish views (php artisan vendor:publish --tag=mikopbx-views --force).
  2. Look for [ICE] โš  No TURN server configured warning. If present, no TURN env vars are set.
  3. Look at [MikoPBX] ICE servers in use: โ€” confirm it includes a turn: entry.

Fix:

Also confirm:

Other causes (less common):

Incoming calls don't ring or show a popup, but outbound calls work fine

Step 1 โ€” Confirm JsSIP actually received the INVITE.

Open DevTools โ†’ Console on a /pbx page (any page that uses the softphone layout). Place a real inbound call to the user's extension. You should see:

Step 2 โ€” Confirm authorization_user is the plain extension.

The JsSIP.UA config must use the plain extension number (e.g. "121") for authorization_user, and the SIP URI uses the -WS suffix (sip:[email protected]). The shipped layout does this correctly โ€” do not override contact: manually, or every incoming INVITE will be silently rejected.

Step 3 โ€” Confirm ringtone is not autoplay-blocked.

If the popup appears but you hear no ringtone, the browser's autoplay policy blocked audio.play() because the user hasn't interacted with the page yet. Click anywhere on the page (or just the Answer button) โ€” the ringtone will start, and the call will be answered in one motion.

Web dialer shows "Softphone Offline" and never registers

Open /pbx/dialer/debug and run all checks in order. The most common causes, in order of likelihood:

  1. No pbx_extension set for the logged-in user โ€” Step 1 (Config API) will show extension: null. Fix: $user->update(['pbx_extension' => '121', 'pbx_sip_password' => '...'])
  2. WebSocket port blocked by firewall โ€” Step 2 will time out or error; open port 8089 (or 8088 for non-SSL)
  3. Site is served over plain HTTP โ€” Step 4 (Microphone) will fail; WebRTC requires HTTPS except on localhost
  4. Wrong SIP password โ€” Step 5 will show a 401/403 in the raw SIP response
  5. Multiple UAs registered to the same extension โ€” if you have the dashboard open in two browser tabs, or you've previously visited /pbx/dialer/debug and started a test UA, MikoPBX may be forking the INVITE to the wrong contact. Close all tabs, refresh, and re-test.

AMI connection failed

Checks:

API key 401 Unauthorized

SSL certificate error

Set MIKOPBX_VERIFY_SSL=false โ€” MikoPBX uses a self-signed certificate by default.

CDR sync inserting only 1 row, or wrong field names

MikoPBX v3's CDR response is nested (data.records[].records[]) โ€” see CDR Field Names & Nested Structure above. If you're on an older copy of this package that expected a flat array, update CdrSyncCommand.php to the current version, then re-run:

Live Call Board shows calls but Transfer/Hangup do nothing

getActiveCalls() alone does not include a channel name field, so Transfer/Hangup have nothing to act on unless the channel is resolved via getActiveChannels() first. Confirm you're on the current LiveCallBoard.php, which cross-references both endpoints automatically.

Extensions not syncing


License

MIT โ€” free for commercial use.

Built by BitDream IT, Bangladesh.

GitHub: github.com/bitdreamit/laravel-mikopbx


All versions of laravel-mikopbx with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bitdreamit/laravel-mikopbx contains the following files

Loading the files please wait ...