asterisk - PHPAGI USING CakePHP SHELL -


i needed build asterisk based ivr application built using cakephp.

i wanted use cakes' (fat) models, wouldn't have re-write business logic.

i wanted create cakephp shell called asterisk dialplan.

here's did.

downloaded phpagi vendors/phpagi.

modified phpagi.php from

function agi($config=null, $optconfig=array()) 

to:

function agi($config=null, $optconfig=array(), $stdin, $stdout) 

so can set stdin , stdout. around line 167 changed

  $this->in = defined('stdin') ? stdin : fopen('php://stdin', 'r');   $this->out = defined('stdout') ? stdout : fopen('php://stdout', 'w'); 

to

  $this->in = $stdin;   $this->out = $stdout; 

in shell in vendors/shells added

 app::import('vendor', 'agi', array('phpagi/phpagi.php')); 

i added

    var $agi;     //redirect output through agi conlog     function err($message,$newlines = 1){             $this->agi->conlog($message);     }     function out($message, $newlines =1){             $this->agi->conlog($message);     }     //disable default message     function startup(){      } 

and application code in

    function main(){             $this->agi = new agi(null, array(), $this->dispatch->stdin,$this->dispatch->stdout);             $this->agi->answer();             //do stuff here     } 

and run in dialplan need is

exten => s,n,agi(${full/path/to/cake.php},${shellname},-app,${var/www/html/{appname}/app},-console,var/www/html/{appname}/cake/console/) 

make sure fix permissions on cake dirs.

i wondering if had other ways this?

here class handel work you. maintained freepbx - popular asterisk gui, , used extensively throughout freepbx.


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -