Home > PHP, asterisk > Asterisk Callme Architecture with PHP AGI

Asterisk Callme Architecture with PHP AGI

Asterisk Callme :: The open PBX

Asterisk Callme :: The open PBX

Extensions Configuration

extensions.conf

[callme]
exten => s,1,AGI(callme.php|${CNUM})

CNUM is the variable passed to callme AGI Script

Callme.php Agi Script

#!/usr/bin/php
/**
* Author Arun Raj R
* @package phpAGI_for Call me
* @version 1.0
*/
set_time_limit(30);
require_once(“phpagi/phpagi.php”);
$agi = new AGI();
$agi->answer();
$result=$agi->stream_file(“welcome_to_call_me”);
$cid = $argv[1];
$agi->exec(“Dial Zap/g0/”.$cid, null);

?>

PHP File to run callme service request

<?php
require_once(“/var/lib/

asterisk/agi-bin/worker/phpagi/phpagi-asmanager.php”);
$number1=$_REQUEST['num1'];
$number2 = $_REQUEST[num2'];
$asm = new AGI_AsteriskManager();
$asm->connect(“localhost”, “username”, “password”);
$number = “Zap/g0/”.$number1;
$asm->send_request(‘Originate’, array(‘Channel’ => “$number”, ‘Context’ => “callme”, ‘Priority’ => 1, ‘Async’ => true,’callerid’=>”$number1″,’Variable’=>’cnum=’.$number2,
));
$asm->disconnect();?>
  1. Christian
    January 5th, 2010 at 20:52 | #1

    Hi!
    I have tried your solution into a trixbox 2.8.0.2 but i have ever Permission denied error if i print the result of the send_request method.

    I have not Zap channel but only SIP channel

    and i have a little changed your scripts according to my configuration.

    Can you help me?

    thanks in advance

  2. January 6th, 2010 at 10:52 | #2

    Hi Christian,

    you have to set up 777 permission to files and folders used by our AGI program

    just try and let me knowv

  1. No trackbacks yet.

Videos, Slideshows and Podcasts by Cincopa Wordpress Plugin