PHP AGI (Asterisk 网关接口) 面板,包括 CDR (呼叫详细记录)、呼叫汇总和自动拨号计划、发送和接收传真、通道变量等。
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.
Add this library to your Composer configuration. In composer.json:
"require": {
"marcelog/pagi": "2.*"
}First, make sure you include the autoloader shipped with composer:
require __DIR__ . '/vendor/autoload.php';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,HangupA mocked pagi client is included to easily test your ivr applications. See doc/examples/mock to see an example of how to use it.
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:
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
CallFiles are supported. You can also schedule a call in the future.
Sending and receiving faxes is supported using spandsp (applications SendFax and ReceiveFax).
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.
You can optionally set a PSR-3 compatible logger:
$pagi->setLogger($logger);By default, the client will use the NullLogger.
This project uses phing. Current tasks include:
To run a task, just do:
vendor/bin/phing buildTo contribute:
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).Copyright 2011 Marcelo Gornstein
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.0Unless 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.
暂无开放 Issues,或尚未同步最近议题。