Skip to content
N1
Integrations · telephony · Grandstream AMI · WebRTC

An in-house Grandstream PBX in boxed Bitrix24 without a paid SIP connector

Client: Insurance company, NDA Category: Integrations Stack: PHP 8.4, Bitrix24 D7 (core telephony), Asterisk AMI, Grandstream UCM API, JsSIP (WebRTC), Vue, nginx, Docker Timeline: about a week
Problem

The company runs its own Grandstream PBX, but boxed Bitrix24 knew nothing about calls: no client card on an incoming call, conversations did not reach the CRM, and clients had to be dialed from the handset by hand. The stock route is a paid SIP connector with cloud telephony.

Constraints

There was no live PBX during development — no network access to it, no accounts. Calls had to be recorded through the core's stock telephony so that regular cards, reports and call details work, and a lost connection to the PBX must not lose events.

What I did
  • An AMI listener keeps a persistent connection to the PBX, puts events in a queue and assembles a call by Linkedid: incoming, outgoing, pickup, transfer
  • Calls are recorded through the core's stock telephony: the call card for the employee, a "Call" activity, call details, a lead for an unknown number
  • "Call" from the CRM dials from the browser softphone, and if it is closed — via AMI, first to the employee's desk phone, then to the client
  • A WebRTC softphone on JsSIP through the portal's nginx: incoming calls, hold, DTMF, transfer; SIP passwords are stored encrypted in the database
  • Call recordings are streamed from the PBX; anything missed during an outage is backfilled from the PBX call log with retries
  • An admin panel for listener and queue status, a PBX simulator on Asterisk 20 in Docker, and tests on recorded AMI sequences
Architecture
Grandstream UCM (AMI + HTTPS API) → AMI listener → event queue → Call assembly by Linkedid → Core telephony → CRM → WebRTC softphone via nginx
Result

The module (about 5.1k lines) was tested end to end on the PBX simulator — incoming, outgoing, missed calls, recordings, backfill, the "Call" button — and went through several review passes. Connection to the live PBX is set for September 2026.

What can be reused
AMI listener with an event queue and call assembly by Linkedid Connecting an external PBX to boxed Bitrix24 stock telephony without a SIP connector Asterisk PBX simulator in Docker for end-to-end telephony tests