CodeIgniter Forums
Asterisk AGI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Asterisk AGI (/showthread.php?tid=60005)



Asterisk AGI - El Forum - 12-26-2013

[eluser]Unknown[/eluser]
Hey, I've had some trouble trying to use Codeigniter with Asterisk AGI so I'm publishing here how I solved it for whom it may concern.

First edit the main index.php file of CI and add the following :
Code:
#!/usr/bin/php -q
in the top of the file.
To navigate to a function you need to use :

Code:
AGI(/path/to/ci//index.php,controller,function)


I've implemented php-agi as a library by doing :

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once APPPATH."/third_party/Agi/phpagi.php";
class Phpagi extends AGI{

    public function __construct() {
        parent::__construct();
    }

}


?>
And then you use it just like you would in a regular script (once loading the library of course)
Hope this helps anyone.