Building determined and fully controlled PBX with nodejs and asterisk

By Vasilii Rogin

Elevator Pitch

I want to describe our method of building QTel PBX system. We are not using asterisk’s dialplan at all (almost), every incoming call is passed into FastAGI, and every outgoing leg is created via AMI Originate. Simple calls, queues, IVR - everything is controlled by our nodejs application.

Description

Why?

  • Asterisk build-in attendant transfer does not provide enough control and flexibility
  • Asterisk build-in app_queue have some limitations
  • Want to have typed and testable code # How? Every incoming call is handled by nodejs via FastAGI. Nodejs knows what this call for, and knows what to do. Nodejs can start to ring outgoing leg (or legs) via AMI Originate and bridge channels on success. Whole state is hold inside nodejs memory structures, so that’s why it is able to provide PBX state data into webUI via http or websocket. Same reason all specific call rules can be created, for example if attendant transfer became “blond” transfer, then nodejs can transparently convert it into blind transfer.

Notes

I want to describe some technical part of our system, to talk about how do we build such system (not regarding, was it right or wrong decision). Also I want to show how to write such code, how to think in asynchronous way, how to make hard thinks to be easy.