phpagi SVN
Brought to you by:
masham
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | phpagi: an AGI class written in PHP Matthew Asham <matthew@ochrelabs.com> http://phpagi.sourceforge.net Contributions by: Florian Overkamp <florian@speakup.nl> David Eder <david@eder.us> Roland Hu Others OVERVIEW -------- Include it: require 'phpagi.php'; Construct it: $agi = new AGI(); This creates a new AGI object with all the agi vars read in, you're now ready to rock and roll. Answer the line. $agi->answer(); Play a file. $agi->stream_file('somefile.gsm'); Record a file. $agi->record_file($file, $format, $escape_digits='', $timeout=-1, $beep=false, $silence=NULL) There's more, read the class or refer to the PHPAGI website for more information. This README is seriousley lacking. CONFIGURATION ------------- phpagi supports an ini style configuration file, and run time configuration. By default the class reads in the contents of /etc/asterisk/phpagi.conf into $this->config. The format of the ini file is as follows: [examplesection] foo=bar bar=dew dew=pale ale This is read into $this->config as: $this->config['examplesection']['foo']='bar'; $this->config['examplesection']['bar]='dew'; $this->config['examplesection']['dew']='pale ale'; Run time configuration is also supported. Pass an array of variables and values as the second parameter to the AGI constructor, these fields are stored in $this->config['phpagi']. ie: $myconfig=array( "error_handler"="true" ); $agi=new AGI("/etc/asterisk/phpagi.conf",$myconfig); The following run-time configuration options are used by the phpagi class to change behaviour. They are all contained in the $this->config['phpagi'] array. * error_handler - set to "true" (string) to enable php debugging EXAMPLE APPLICATION ------------------- ping.php is an example phpagi application. it asks for an IP address to be entered, and reads back the results of a "ping" summary. to use it, you'll need festival installed. see http://www.voip-info.org/tiki-index.php?page=Asterisk+festival+installation for all the groovy bits to get festival working with asterisk, then configure phpagi to use it too: in /etc/asterisk/phpagi.conf: [festival] text2wave=/usr/src/festival/bin/text2wave tempdir=/var/lib/asterisk/sounds/tmp/ |