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

contribs at freepascal.org contribs at freepascal.org
Sat Jun 5 13:08:42 CEST 2004


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

Name         : agi
Author       : Andy Powell
Email        : fpc-agi at automated.it
Homepage     : http://www.asteriskhelper.com
FTP site     : 
Version      : 1
Date         : 2004-06-05
Category     : Miscellaneous
Supported OS : Linux
Description  :
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:

simple-demo.pas 

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
Exits.

mysql-demo.pas 

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
) TYPE=MyISAM;

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