• Stars
    star
    191
  • Rank 202,877 (Top 4 %)
  • Language
    PHP
  • License
    Apache License 2.0
  • Created almost 14 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PHP AGI ( Asterisk Gateway Interface ) facade, with CDR ( Call Detail Record ), Call spool and schedule auto dial, Send and Receive Fax, Channel Variables, and Caller ID management

License Latest Stable Version Documentation Status

Build Status Coverage Status Code Climate Issue Count

![Click here to lend your support to: PAGI and make a donation at pledgie.com !](https://pledgie.com/campaigns/30945.png?skin_name=chrome' border='0')

Introduction

This framework is intended to simply making ivr applications using Asterisk's AGI, providing a nice level of abstraction over what an IVR should look like from a developers' perspective.

Documentation

Installing

Add this library to your Composer configuration. In composer.json:

  "require": {
    "marcelog/pagi": "2.*"
  }

Using it

First, make sure you include the autoloader shipped with composer:

require __DIR__ . '/vendor/autoload.php';

Quickstart

You can start by doc/examples/quickstart for a very basic example. You'll need something like this in your dialplan:

[default]
exten => 1,1,AGI(/path/to/PAGI/doc/examples/quickstart/run.sh,a,b,c,d)
exten => 1,n,Hangup

Testing IVR applications

A mocked pagi client is included to easily test your ivr applications. See doc/examples/mock to see an example of how to use it.

Features

Nodes

For a tutorial about nodes, see this article

Simple Call Flow Nodes are available (see doc/examples/node/example.php). Using nodes will let you simplify how you build and test your ivr applications. Nodes are an abstraction layer above the pagi client, and support:

  • Prompts mixing sound files, playing numbers/digits/datetime's.
  • Cancel and End Of Input digits.
  • Validator callbacks for inputs, can optionally specify 1 or more sound files to play when the validation fails.
  • Callbacks for invalid and valid inputs.
  • Optional sound when no input.
  • Maximum valid input attempts.
  • Optional sound when maximum attempts has been reached.
  • Expecting at least/at most/exactly N digits per input.
  • Timeout between digits in more-than-1 digit inputs.
  • Timeout per input attempt.
  • Retry Attempts for valid inputs.
  • And much more!

The NodeController will let you control the call flow of your application, by registering nodes and actions based on node results. Thus, you can jump from one node to the other on cancel or complete inputs, hangup the call, execute a callback, etc. For an example, see doc/examples/nodecontroller/example.php

An article about the node controller is available here

AutoDial

CallFiles are supported. You can also schedule a call in the future.

Fax

Sending and receiving faxes is supported using spandsp (applications SendFax and ReceiveFax).

Available Facades

  • PAGI\Client\CDR: Provided to access cdr variables.
  • PAGI\Client\ChannelVariables: Provided to access channel variables and asterisk environment variables.
  • PAGI\Client\CallerID: Provided to access caller id variables.
  • PAGI\Client\Result: Provided to wrap up the result for agi commands.
  • PAGI\CallSpool\CallFile: Call file facade.
  • PAGI\CallSpool\CallSpool: Call spool facade.
  • PAGI\Logger\Asterisk: Provides access to asterisk logger (see logger.conf in your asterisk installation).

Results

For every operation, a Result is provided. Some operations decorate this Result to add functionality, like PlayResult, ReadResult, etc. For example, a stream file will return a PlayResult, which decorates a ReadResult which in turn, decorated a Result.

  • PAGI\Client\DialResult
  • PAGI\Client\ExecResult
  • PAGI\Client\ReadResult
  • PAGI\Client\PlayResult
  • PAGI\Client\FaxResult

Debugging, logging

You can optionally set a PSR-3 compatible logger:

$pagi->setLogger($logger);

By default, the client will use the NullLogger.

Developers

This project uses phing. Current tasks include:

Running a phing task

To run a task, just do:

vendor/bin/phing build

Contributing

To contribute:

  • Make sure you open a concise and short pull request.
  • Throw in any needed unit tests to accomodate the new code or the changes involved.
  • Run phing and make sure everything is ok before submitting the pull request (make phpmd and CodeSniffer happy, also make sure that phpDocumentor does not throw any warnings, since all our documentation is automatically generated).
  • Your code must comply with PSR-2, CodeSniffer should take care of that.

LICENSE

Copyright 2011 Marcelo Gornstein [email protected]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

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
PHP
401
star
2

Ding

DI ( Dependency Injection: Setter, Constructor, Method), AOP ( Aspect Oriented Programming ), Events support, xml, yaml, and annotations (including some JSR 250 and JSR 330, like @Configuration and @Bean ala java configuration) , lightweight, simple, and quick MVC ( Model View Controller ), syslog, tcp client and server, with non blocking sockets, custom error, signal, and exception handling through events. Needs PHP 5.3, very similar to seasar, spring ( java ) . Can be deployed as a PHAR file.
PHP
121
star
3

Nami

Asterisk manager interface (ami) client for nodejs
JavaScript
99
star
4

logger_logstash_backend

Logstash backend for the Elixir Logger
Elixir
73
star
5

ex_abnf

Parser for ABNF Grammars
Elixir
61
star
6

Ci-Php-Phing-Example

PHP Continuous Integration example using Phing, generates phar files, pear package, documentation, pmd, cpd, and other statistics and artifacts ready for publication
PHP
59
star
7

erws

Erlang Websockets example using Cowboy
Erlang
46
star
8

AsterTrace

Capture everything happening in your asterisk server and log it to mysql. Calls, DTMF's, generic events, etc
PHP
43
star
9

SimplePcap

A mini libpcap adapter in C++, with a php module using SWIG
C++
29
star
10

elixir_mod_event

Elixir client for the FreeSWITCH mod_event_socket
Elixir
24
star
11

oauthex

Wrapper for elixir to use erlang-oauth
Elixir
19
star
12

simple_cache

Small erlang simple cache using ETS to wrap your methods with
Erlang
18
star
13

aws-lambda-start-stop-instances

Sample code for a serverless Lambda useful to Start and Stop EC2 instances
JavaScript
16
star
14

elixir_ami

An Elixir AMI client
Elixir
13
star
15

erlci

A CI server written in Erlang. NSWIDY (Not Sure What I'm Doing, Yet)
Erlang
12
star
16

Freebsd-Cross-GCC

A tool to generate a freebsd cross compiler (gcc) in linux
Shell
12
star
17

erlami

An Asterisk Manager Interface written in Erlang
Erlang
12
star
18

erlagi

An AGI (asterisk gateway interface) client implementation for erlang
Erlang
11
star
19

Pagi-App-And-Test-Example

An example of a PAGI IVR application, including unit tests
PHP
11
star
20

erl_fastcgi

A small and simple FastCGI client written in Erlang
Erlang
11
star
21

epers

A very simple persistance layer for Erlang applications for different DB's
Erlang
11
star
22

aws-sqs-lambda-audio-transcoding

Sample code for a serverless transcoding of audio files using SOX, AWS SQS and Lambda
JavaScript
11
star
23

ex_rfc3986

RFC3986 URI parser
Elixir
10
star
24

elixir_authorizenet

Unofficial Elixir Client for the Authorize.NET API
Elixir
10
star
25

Bami

bash asterisk manager interface client
Shell
8
star
26

jsonex

An elixir module to wrap jsonerl
Elixir
7
star
27

cowboy_fastcgi

Example calling PHP from a Cowboy application via FastCGI using php-fpm
Erlang
7
star
28

minionpool

Worker pool for nodejs
JavaScript
7
star
29

FastPAGI

A FastAGI server to be used with PAGI applications
PHP
6
star
30

elixir_agi

An Elixir AGI client
Elixir
6
star
31

jenkins_erlang_rebar_example

An erlang app template, uses rebar, ready for jenkins integration
Shell
5
star
32

MDM

Marcelog Device Manager is a set of libraries and a multithreaded daemon written in plain ansi C that runs under linux and freebsd, and allows clients to control devices like DSLAM Alcatel, ZTE, and HUAWEI. it supports ssh2, telnet, raw, and serial connections. Uses libssh2 1.2.5+ and libtelnet
C
5
star
33

ecal

Erlang library application with many useful calendar functions
Erlang
5
star
34

Portable-PHP-Application

Source code that demonstrates how to create a php application that can be more deployed more easy with its own isolated environment
Shell
4
star
35

AsterTrace-Node

Port of AsterTrace for the node
JavaScript
3
star
36

ehttp

Library Application for Erlang/OTP to handle HTTP requests and responses, supports header and cookie manipulation
Erlang
3
star
37

excalit

Stress testing tool for web servers, written in elixir
Elixir
3
star
38

AnoForPHP

An experimental patch to PHP/ZendEngine to bring native annotations to PHP
PHP
3
star
39

Doctrine2-Ding-Example

A sample application using Doctrine2 as ORM and Ding as DI and AOP Container
PHP
3
star
40

safe_bunny

RabbitMQ delivery with local queuing
Erlang
3
star
41

rebar-spec-proc-tpl

A special process template for rebar
Erlang
3
star
42

rabbitmq_minionpool

minionpool that uses rabbitmq to inject tasks
JavaScript
2
star
43

emonito

Monit/daemontools alike otp application
Erlang
2
star
44

marcelog.github.com

marcelog.github.com
HTML
2
star
45

TTT

A tic-tac-toe in plain ansi c using a minimax implementation. This is really the *best* tic-tac-toe player by brute forcing ;) Compiles with gcc and visual studio 6
C
2
star
46

erlastica

Erlang library to use ElasticSearch
Erlang
2
star
47

erl_vcron

Erlang Vixie Cron-like expression interpreter
Erlang
2
star
48

ex_abnf_example

Sample application that demonstrates the use of ex_abnf to implement grammar parsers in Elixir
Elixir
2
star
49

simple_utf8

Simple utf8 to binary and viceversa translation routines for Erlang
Erlang
2
star
50

egetter

Wrapper around ibrowse, simple api to use random proxies and user agents and easily create clients for HTTP apis
Erlang
2
star
51

daemontools-tools

A set of tools to extend daemontools services
Shell
1
star
52

x6502

A 6502 simulator
Elixir
1
star
53

erl_lzw

LZW in Erlang, Not optimized in any way, written just for fun.
Erlang
1
star
54

rdtsc-example

A small example for using the rdtsc from c and assembly, need a 32 bits linux/freebsd
C
1
star
55

Pakman

A Package manager written in plain ansi C for FreeBSD systems that uses berkeley db
C
1
star
56

rebar-eunit-test-tpl

A simple eunit unit test template for rebar
Erlang
1
star
57

ebunny_pool

A rabbitmq worker pool
Erlang
1
star
58

Ding-Aop-Example

An example using Aspect Oriented Programming in PHP with the Ding container
PHP
1
star
59

minesweeper-API

Go
1
star
60

ex_rfc3966

Elixir Tel URI parser compatible with RFC3966
Elixir
1
star
61

servito

HTTP magic with cowboy and elixir metaprogramming
Elixir
1
star