All Projects → staskobzar → amiws

staskobzar / amiws

Licence: GPL-3.0 license
Asterisk Management Interface (AMI) to Web-socket proxy

Programming Languages

c
50402 projects - #5 most used programming language
shell
77523 projects
javascript
184084 projects - #8 most used programming language
Vue
7211 projects
C++
36643 projects - #6 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to amiws

ya-node-asterisk
node.js client library for Asterisk Manager Interface
Stars: ✭ 18 (-70%)
Mutual labels:  ami, asterisk
Astive
Media controller for Asterisk PBX (FastAGI Server)
Stars: ✭ 37 (-38.33%)
Mutual labels:  ami, asterisk
ami
integration asterisk manager interface (AMI) in laravel
Stars: ✭ 25 (-58.33%)
Mutual labels:  ami, asterisk
Python Ami
Python AMI Client
Stars: ✭ 70 (+16.67%)
Mutual labels:  ami, asterisk
Websockify
Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service.
Stars: ✭ 2,942 (+4803.33%)
Mutual labels:  ssl, websocket-proxy
goami
Asterisk Manager Interface (AMI) client in Go
Stars: ✭ 36 (-40%)
Mutual labels:  ami, asterisk
Pami
PHP Asterisk Manager Interface ( AMI ) supports synchronous command ( action )/ responses and asynchronous events using the pattern observer-listener. Supports commands with responses with multiple events. Very suitable for development of operator consoles and / or asterisk / channels / peers monitoring through SOA, etc
Stars: ✭ 351 (+485%)
Mutual labels:  ami, asterisk
Starpy
Mirror of Python twisted library for AMI and FastAGI: No pull requests here please. Use Gerrit: https://gerrit.asterisk.org
Stars: ✭ 77 (+28.33%)
Mutual labels:  ami, asterisk
Nami
Asterisk manager interface (ami) client for nodejs
Stars: ✭ 94 (+56.67%)
Mutual labels:  ami, asterisk
amiws queue
Asterisk Queues Dashboard with amiws
Stars: ✭ 40 (-33.33%)
Mutual labels:  ami, asterisk
callme
No description or website provided.
Stars: ✭ 45 (-25%)
Mutual labels:  ami, asterisk
hapi-moon
Hassle-free and production ready hapi.js Server boilerplate
Stars: ✭ 23 (-61.67%)
Mutual labels:  mongoose
fast-relay-pagination
Improve relay pagination performance with find and limit
Stars: ✭ 18 (-70%)
Mutual labels:  mongoose
storage
Mongoose-like schema validation, collections and documents on browser (client-side)
Stars: ✭ 17 (-71.67%)
Mutual labels:  mongoose
sack.vfs
Node addon which adds a virtual file system interface; websockets; json(6) parsing; sql support(sqlite,odbc); javascript sched_yield; ssl certificate generation; more...
Stars: ✭ 29 (-51.67%)
Mutual labels:  ssl
NodeRestApi
Node.js, Express.js and MongoDB REST API App
Stars: ✭ 38 (-36.67%)
Mutual labels:  mongoose
openssl-ca
Shell scripts to manage a private Certificate Authority using OpenSSL
Stars: ✭ 38 (-36.67%)
Mutual labels:  ssl
docker-nginx-certbot
Automatically create and renew website certificates for free using the Let's Encrypt certificate authority.
Stars: ✭ 367 (+511.67%)
Mutual labels:  ssl
aircnc
☕ Airbnb like (Air Coffee & Code) to booking spots for developers using ReactJS, React Native, Node.js and more.
Stars: ✭ 37 (-38.33%)
Mutual labels:  mongoose
BEW-1.3-Server-Side-Architectures-and-Frameworks
🔐 Build on knowledge of Resourceful and RESTful patterns and dive deep into the Node and Express ecosystem.
Stars: ✭ 19 (-68.33%)
Mutual labels:  mongoose

amiws - Asterisk Manager Iterface (AMI) to web-socket proxy

Build Status codecov verion-2.2.1

Introduction

amiws is simple proxy from AMI to WEB. It can connect to one or more Asterisk PBXs via AMI (Asterisk Manager Interface), read messages from AMI stream and send actions/commands to it. Received messages are parsed and converted to JSON. amiws also provides HTTP/WebSocket interface and sends JSON messages to all connected users via HTTP.

Here is simple workflow scheme: amiws workflow

amiws proxy can help to build interctive, realtime dashboards for Asterisk PBX single or multiple servers. The example of a simple dashboard can be found in directory "web_root". Here is how it would look like when connecting two Asterisk PBXs: web interface

Features

  • AMI protocol implementation
  • Plain TCP or SSL/TLS connection to AMI
  • Logging with syslog
  • HTTP and WebSocket server
  • SSL/TLS encypted connection for HTTP and WebSocket
  • WWW Digest authenticatation with username/password for HTTP(s)
  • YAML configuration file

Command line arguments

Usage: amiws [OPTIONS]

Options:

-h, --help              Printf this help message.
-f, --file FILENAME     Configuration file. By default '/etc/amiws.yaml'
-d, --daemon            Daemonize process.
-p, --pidfile FILENAME  PID file when run as daemon. By default '/tmp/amiws.pid'
-D, --wdir PATH         Working directory when run as daemon. By default '/tmp'

Dependences and libraries

  • libyaml - to read YAML configuration files.
  • openssl - TLS/SSL for AMI and HTTP. Only if compiled with ssl support.

amiws relies on several greate projects:

  • mogoose - awesome embedded networking library from Cesanta.
  • fozen - awesome JSON parser and emitter from Cesanta.
  • re2c - awesome lexer generator for AMI protocol implementation.
  • cmocka - awesome unit testing framework for C.
  • lemon - parser generator to process YAML tokens

They do not need to me installed. mongoose and frozen are already included. re2c and cmocka are only needed for developers.

Building and install

autoreconf -if
./configure
make && make install

In case of problems, try to run script ./bootstrap.

To enable SSL support:

./configure --with-ssl
make && make install

To create source documentation:

make doc

To run unit tests (requires cmocka):

make check

This repo also provides init scripts for System V and systemctl in "etc/" directory.

Configuration

Program behaviour is controlled by configuration file. Configuration parameters are described in sample file "amiws.annotated.yaml" in directory "etc" of this repository.

JSON message

Example of amiws JSON message:

{
   "type": 3,
   "server_id": 1,
   "server_name": "asterisk01.local",
   "ssl": false,
   "data": {
      "Event": "Hangup",
      "Privilege": "call,all",
      "Channel": "SIP/sipp-00000a6a",
      "ChannelState": "6",
      "ChannelStateDesc": "Up",
      "CallerIDNum": "16464964806",
      "CallerIDName": "Alice",
      "ConnectedLineNum": "<unknown>",
      "ConnectedLineName": "<unknown>",
      "Language": "en",
      "AccountCode": "",
      "Context": "from-sip",
      "Exten": "55213477583",
      "Priority": "8",
      "Uniqueid": "1495919040.5315",
      "Linkedid": "1495919040.5315",
      "Cause": "0",
      "Cause-txt": "Unknown"
   }
}
  • type - AMI message type (see below)
  • server_id - Asterisk server ID. Sequential number generated by amiws for each AMI connection.
  • server_name - AMI connection server name as in configuration file.
  • ssl - Flag to indicate id AMI connection is SSL encrypted.
  • data - AMI message itself.

AMI message types:

  • 0 - Unknown
  • 1 - Prompt
  • 2 - Action
  • 3 - Event
  • 4 - Response
  • 5 - Respons with command output
  • 6 - Queues list. AMI returns queues list not as AMI packet but as a text (like command: queue show). That's why here is special type.

AMI description in details can be found in Asterisk wiki.

amiws also accepts JSON messages and send them back to all Asterisk servers:

sock.send(JSON.stringify({"Action": "CoreStatus", "ActionID": "12345"}));

Beware that this will send same Action to all AMI servers!

Keep this in mind when you deploy amiws within public Internet and protect access to it.

Special header AMIServerID

To send message to specified AMI server you can use header AMIServerID. The is should correspond to the server_id in requests.

Example:

sock.send(JSON.stringify({"Action": "CoreStatus", "AMIServerID": 1}));

SSL/TLS transport

SSL/TLS transport usage is described in this blog article: http://staskobzar.blogspot.ca/2017/05/amiws-asterisk-manager-iterface-to-web.html

Some more information can be found in annotated configuration file.

Digest Authentication

HTTP content can be protected with username/password. When this option is enabled, then anyone trying access web-page, will have to provide username and password to proceed.

Configuration paramers to set are:

auth_domain   : example.com
auth_file     : /var/www/.htaccess

Parameter auth_file is a path to the file with username, password and domain. This file can be generated with utility "htdigest" which is the part of Apache httpd server package. For example:

$ htdigest -c /var/www/.htaccess example.com admin

Second argument, domain "example.com", must be the same as set in parameter auth_domain.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].