Tutorial for PAMI to use PHP for your Asterisk PBX Telephony applications

For an in-depth tutorial, read "Getting Started with the PAMI: PHP Asterisk Manager Interface = Easy Asterisk Monitoring".

Check the slides about writing telephony applications using Asterisk, PHP, and PAGI and PAMI, at the PHP Conference Argentina 2013. You can download the slides, don't forget to see the notes! The complete talk is right there if you missed it :) 

Quickstart: Controlling events from the Asterisk PBX in your PHP Code

Using Predicates to control events flow

A second (optional) argument can be used when registering the event listener: a closure that will be evaluated before calling the callback. The callback will be called only if this predicate returns true:

PHP Examples to interact with the Asterisk PBX

For a very raw quickstart: for all (and full) examples.

Also, for a more elegant example, mixing Ding and PAMI, Please see

Also, you might want to look at this article.