[fpc-announce] New entry in Free Pascal Contributed units. (Asterisk AGI)

contribs at freepascal.org contribs at freepascal.org
Sat May 20 10:33:57 CEST 2006

The following entry was added to the Free Pascal contributed units:

Name         : Asterisk AGI
Author       : Andy Powell
Email        : fpc-agi at automated.it
Homepage     : http://www.automated.it/asterisk/fpc-agi.html
FTP site     : ftp://
Version      : 1
Date         : 2006-05-20
Category     : Miscellaneous
Supported OS : Linux
Description  :
[Sorry can't remember the password for the other copy, just needed to modify the URL]

Provides an interface for AGI (Asterisk Gateway Interface) applications to be written in FPC for asterisk pbx (a linux based pbx). These are typically for IVR applications or db lookups but can be anything you like. Two simple demos are included:


Says the number 1234 (One thousand two hundred and thirty four)
Plays a message during which you can press the digits 0-9 then prints the result to the console
Gets the value of a variable (TRUNK in this case) and prints the result to the console
Records input from the line and saves it in fpcagi-recording
Says 5 4 3 2 1
Plays back what you recorded above


Demonstrates connecting to a mysql db, in this case it looks for the closest match for a number (from caller id) from the lookup table.. this probably wont work out of the box unless you create your db:

Database: clidb

CREATE TABLE `lookup` (
  `ldesc` text,
  `code` text

ldesc is just the description of 'where' this number is. It could simply be something like "Andy's Phone"
code is the number, but there are one or two extra tricks here. Lets say you have in your db code, ldesc values equal to : 

1, USA
1212, New York - USA
1212456,Downtown Fictionville - New York
1212456790, Andy Powell

Then if you lookup 1212456790 you'll get the ldesc for 1212456790 (Andy Powell), however if you looked up 1212451111 (doesn't exist in the db) the app returns the closest match (in this case 1212456) description (Downtown Fictionville - New York). 

More information about the fpc-announce mailing list