Asterisk Gateway Interface 1.4 and 1.6 Programming


Asterisk Gateway Interface 1.4 and 1.6 Programming
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
$20.39
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
$39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Reviews
Support
Sample Chapters
  • Develop voice-enabled applications utilizing the collective power of Asterisk, PHP, and the PHPAGI class library
  • Learn basic elements of a FastAGI server utilizing PHP and PHPAGI
  • Develop new Voice 2.0 mash ups using the Asterisk Manager
  • Add Asterisk application development skills to your development arsenal, enriching your market offering and experience
  • Up to date for Asterisk version 1.6 and covers all previous versions

Book Details

Language : English
Paperback : 220 pages [ 235mm x 191mm ]
Release Date : February 2009
ISBN : 184719446X
ISBN 13 : 9781847194466
Author(s) : Nir Simionovich
Topics and Technologies : All Books, Networking and Servers, Linux Servers, Networking & Telephony, Open Source


Table of Contents

Preface
Chapter 1: Installing a 'Vanilla' Asterisk
Chapter 2: Basic IVR Development: Using the Asterisk DialPlan
Chapter 3: More IVR Development: Input, Recordings, and Call Control
Chapter 4: A Primer to AGI: Asterisk Gateway Interface
Chapter 5: AGI Scripting with PHP
Chapter 6: PHPAGI: An AGI Class Library in PHP
Chapter 7: FastAGI: AGI as a TCP Server
Chapter 8: AMI: The Asterisk Manager Interface
Chapter 9: Final Programming Project
Chapter 10: Scaling Asterisk Applications
Index
  • Chapter 1: Installing a 'Vanilla' Asterisk
    • Downloading Asterisk
    • Zaptel—Zapata Telephony Driver
    • DAHDI—Digium Asterisk Hardware Device Interface
    • Libpri—ISDN PRI Library
    • Asterisk—the open source PBX
    • Asterisk-addons—the open source PBX
    • Asterisk—SVN source packages
      • Obtaining the source code packages from SVN
      • Compilation dependencies
    • Compiling the source code
      • Compiling and installing Zaptel
        • Step 1: Configure
        • Step 2: Define the options you would like to compile
        • Step 3: Compiling and installing
      • Compiling and installing DAHDI
        • Step 1: Compile the kernel module
        • Step 2: Install the dahdi kernel module
        • Step 3: Compile the dahdi-tools package
        • Step 4: Configure the dahdi-tools to be installed
        • Step 5: Compile and install dahdi-tools
      • Differences between Zaptel and DAHDI
      • Compiling and installing libpri
      • Compiling and installing Asterisk
        • Step 1: Configure
        • Step 2: Define the options you would like to compile
        • Step 3: Compiling the code
    • Summary
  • Chapter 2: Basic IVR Development: Using the Asterisk DialPlan
    • The dialplan is a set of "finite state machines"
    • The dialplan syntax
      • The extension
        • Inclusion of contexts
        • The [general] and [global] contexts
        • Extension pattern matching
        • Special extensions
      • Dialplan Switches
      • Variables, applications, and functions
        • Variables—built-in and custom
      • Applications and functions
        • Your first IVR application
    • Summary
  • Chapter 3: More IVR Development: Input, Recordings, and Call Control
    • Grabbing and processing user input
      • The Read application
      • Branching—Goto, GotoIf, Gosub, and GosubIf
        • Goto and GotoIf
        • Writing expressions
        • Regular expressions
        • Gosub and GosubIf
        • Exec, ExecIf, and TryExec
      • Macros—Macro and MacroExclusive
        • Additional Asterisk applications
      • Self exploration
    • Summary
  • Chapter 4: A Primer to AGI: Asterisk Gateway Interface
    • How does AGI work?
      • EAGI, DeadAGI and FastAGI
        • EAGI—Enhanced Asterisk Gateway Interface
        • DeadAGI—execution on hangup
        • FastAGI—AGI execution via a TCP socket
        • AGI scripting frameworks
      • The AGI application
      • The AGI execution flow
      • The AGI methods API
    • The ten rules of AGI development
      • Rule #1: An AGI script should terminate as fast as possible
      • Rule #2: Blocking applications have no place in AGI
      • Rule #3: Asterisk channels are stateful—use them
      • Rule #4: AGI scripts should manipulate data—no more
      • Rule #5: VM based languages are bad for AGI scripting
      • Rule #6: Binary-compiled AGI is not always the answer
      • Rule #7: Balance your scripts with dialplan logic
      • Rule #8: Balance your scripts with web services
      • Rule #9: Syslog is your friend—use it
      • Rule #10: The Internet is for Asterisk
    • A preface to what's coming ahead
    • Summary
  • Chapter 5: AGI Scripting with PHP
    • PHP-CLI vs. PHP-CGI
    • The php.ini configuration file
    • AGI script permissions
    • The structure of a PHP based AGI script
    • Communication between Asterisk and AGI
    • The AGI Hello-World program
    • AGI debugging
    • Summary
  • Chapter 6: PHPAGI: An AGI Class Library in PHP
    • Obtaining PHPAGI
    • The file structure of PHPAGI
    • A very simple PHPAGI example
    • The AGI/Dialplan high-wire act
      • Introducing Atomic-AGI
      • Atomic-AGI—a dialplan example
      • SetSessionID.agi—meet your state maintainer
      • agiWrapper.agi—an all purpose AGI execution wrapper
    • A slightly more complex PHPAGI example
      • db_validate_target.inc.php
      • db_register_cdr.inc.php
    • AGI Scripts in popular Asterisk applications
      • FreePBX™—the most popular Asterisk management GUI
      • A2Billing™—a pre-paid calling card system
    • Summary
  • Chapter 7: FastAGI: AGI as a TCP Server
    • FastAGI argument handling
      • Asterisk 1.2.X and 1.4.X
      • Asterisk 1.6.X
    • FastAGI error handling
      • Asterisk 1.2.X
      • Asterisk 1.4.X and 1.6.X
    • FastAGI with PHPAGI and xinetd
      • Introducing xintetd—the Internet services daemon
      • Configuring xinetd for FastAGI and PHPAGI
      • Configuring PHPAGI for FastAGI
      • The fastagiWrapper.php bootstrap
      • Performance consideration
    • FastAGI with PHPAGI and Google
    • FastAGI with other tool kits
      • Asterisk::FastAGI—a PERL module for FastAGI handling
      • Asterisk-JAVA—a Java package for Asterisk
    • Summary
  • Chapter 8: AMI: The Asterisk Manager Interface
    • AMI—the history
      • How does AMI work?
      • AMI with Asterisk 1.0 and 1.2
      • AMI with Asterisk 1.4 and 1.6
    • AMI–understanding basics
      • Events and Actions
      • Logging in to the Manager Interface
      • Sending actions to the Manager Interface
      • Logging off from the Manager Interface
    • PHPAGI and the AMI Interface
      • Direct AMI interface invocation
      • AMI interface invocation via the PHPAGI class
      • Interacting with the AMI interface
        • Sending actions to the AMI inteface
        • Event callbacks from AMI interface
      • PHPAGI AMI originate quirk
    • Click-2-Call and Web-Callback
      • Demystifying the Asterisk Originate manager action
      • Welcome to Jabka—the world's favourite Click-2-Call
      • AMI proxy servers
      • AJAM—AJAX Enabled Manager
    • Summary
  • Chapter 9: Final Programming Project
    • ACRG—Asterisk Call Recording Gateway
      • Requirements
      • Network connectivity—PSTN
    • Project implementation guide
      • Step 1: Analysis of the requirements
      • Step 2: Understanding operational constraints
      • Step 3: Detailed call flow charts
      • Step 4: The Asterisk dialplan context
      • Step 5: Develop your human interfaces
      • Step 6: Test, test, and test again
    • Additional programming projects
      • Click-2-Call
        • Jajah.Com
      • Stateful call masking
      • Punk'ed call
      • Date rescue call
      • Conference bridge
    • Summary
  • Chapter 10: Scaling Asterisk Applications
    • Scaling Asterisk platforms
      • Database query caching
        • Starting up
        • Using it in a script
      • Utilization of web services
        • Introduction to XML-RPC
      • Apache versus Lighttpd
        • Virtualization and cloud computing
    • Summary

Nir Simionovich

Nir Simionovich has been involved with the Open Source community in Israel since 1997. His involvement with the Open Source community started back in 1997, when he was a student in the Technion—Israel’s Technology Institute—in Haifa. Nir quickly became involved in organizing Open Source venues and events, promoting the usage of Linux and Open Source technologies in Israel.

In 1998, Nir started working for an IT consulting company (artNET experts Ltd), where he began to introduce Linux-based solutions for enterprises and banks. By the year 2000, Nir had become a SAIR/GNU certified Linux trainer and administrator, slowly educating the future generations of Linux admins.

In 2001, Nir moved to the cellular content market, working for a mobile content delivery company (m-Wise Inc.—OTC.BB: MWIS.OB). During his commission at m-Wise, Nir successfully migrated a company that was built purely on Windows 2000 and ColdFusion to open source technologies, such as Mandrake Linux (today Mandriva), Apache Tomcat, and Kannel (open source SMS/WAP gateway).

 

Coming to 2006, Nir had co-founded Atelis (Atelis PLC—AIM: ATEL). Atelis is a Digium distributor and integrator. During the course of 2006, Nir developed an Asterisk-based international operator services platform for Bezeq International, which replaced a Nortel DMS-300 switch. This platform is currently in use by Bezeq International in Israel, serving over 4000 customer a day.

 

In mid 2007, Nir left Atelis to become a freelance Asterisk promoter and consultant. Nir is currently providing Asterisk consulting and development services for various companies, ranging from early-stage start-up companies, through VoIP service providers and VoIP equipment vendors. In his spare time, Nir is the founder of the Israeli Asterisk users group, the website maintainer of the group, and an Asterisk developer, dealing mainly with the localization aspects of Asterisk to Israel.

Coming to 2008, Nir's company (Greenfield Technologies Ltd) won the Digium Innovation award at AstriCon 2008, in the pioneer division—for its implementation of a phone-based prayer system, allowing people from around the world to pray at the western wall in Jerusalem.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 1 submitted: last submission 10 Sep 2012

Errata type: Typo | Page number: 69

In the note section at the bottom of the page, a piece of text reads: (be it TDM of VoIP) This should be: (be it TDM or VoIP).

 

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Asterisk Gateway Interface 1.4 and 1.6 Programming +    PHP Web 2.0 Mashup Projects: Practical PHP Mashups with Google Maps, Flickr, Amazon, YouTube, MSN Search, Yahoo! =
50% Off
the second eBook
Price for both: €25.65

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Create AGI applications with Asterisk easily using PHPAGI, a PHP class library
  • Avoid going through the normal pitfalls of novice developers when developing Asterisk-based applications and services for the first time
  • Develop AGI scripts and FastAGI servers using Asterisk-PERL modules
  • Configure your AMI login information in the phpagi.conf file in order to utilize the AMI interface with PHPAGI
  • Understand the Asterisk Manager Interface and its utilization in Asterisk applications
  • Develop full web-based call-back platforms and highly interactive IVR applications using PHP and PHPAGI
  • Learn proper development paradigms to easily scale your services and applications
  • Get ideas for various Asterisk-based services and applications that you can create

In Detail

Asterisk is the world's leading open-source PBX, telephony engine, and telephony applications toolkit with immense flexibility.

This book will give you a firm understanding of Asterisk Gateway Interface (AGI) development and proper AGI development practices. You will learn how to formulate Atomic AGI-enabled scripts, enabling rapid development within a well-defined Asterisk execution and runtime environment.

This book builds from the simplest form of an Asterisk application, the dialplan-based application, gradually building a full understanding of AGI scripting. The book also introduces a new concept of AGI development named "Atomic AGI" or "Particle Programming". It will introduce you to various techniques of interacting with the user, where user interaction isn't limited to keypad-based input, but also includes recording messages from the user, sending output to the user, and controlling the call flow.

The book takes a pragmatic approach with clear and complete examples, and a service development project — allowing you to understand the project cycle of developing an Asterisk-based service or application.

Get started with AGI development and use the dynamic features of Asterisk AGI to build your own VoIP-based telephony system

Approach

This friendly, clear tutorial takes a pragmatic approach to developing Asterisk applications, helping you to find the best solutions for your needs. Unlike most books, which simply show you how to do or what to do, this book tries to show you: "why to do?"—thus explaining the logic behind certain Asterisk development paradigms.

Who this book is for

This book is intended for developers wishing to utilize Asterisk, system administrators wishing to gain better control over their Asterisk installation, and telephony service providers wishing to deploy Asterisk-based solutions to their infrastructure. You are expected to have some experience with Asterisk and a basic understanding of programming. No knowledge of Asterisk programming is required.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software