[asterisk-users] PhpAgi call generation

Christopher Robinson chris.robinson at sayersmedia.com
Tue Jun 19 08:46:00 CDT 2007


I've done this many times, also used the .call files.  If you don't need 
your application to initiate the call the .call files are the better way 
to go, otherwise it's a bit too much file management overhead.

Here's some working code on our end.  In this case the Channel is 
actually a context which makes the actual call, but I've used it both ways.

<?php
  require('PHPAGI/phpagi-asmanager.php');

  $callid = 'Somebody';

  $asm = new AGI_AsteriskManager();
  if($asm->connect())
  {
    $call = $asm->send_request('Originate',
            array('Channel'=>"LOCAL/17165555555 at voicepulse",
                  'Context'=>'called_party_context',
                  'Exten'=>'899',
                  'Timeout' => '1000',
                  'Async'=>'1',
                  'MaxRetries' => '5',
                  'RetryTime' => '5',
                  'Priority'=>1,
                  'Callerid'=>$callid));
    $asm->disconnect();
  }
?>


nik600 wrote:
> hi
>
> i'd like to write a simply application in php with phpAgi that:
>
> - connect to Asterisk
> - call an external number using a Zap channel
> - play a message
>
> here is some code:
>
> <?php
>
> $asm = new AGI_AsteriskManager();
>
> if ($asm->connect()) {
>
> $asm->Originate("Zap/g1/1","number","default","1");
>
> /*
> play message...
> */
> } else {
>         die("error\n");
> }
>
> ?>
>
> But it doesn't work.
> Is it possible to create a program like this?
> thanks
>
>   




More information about the asterisk-users mailing list