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();?>
About

me : yeay its me arun

Tagged with: ,
3 comments on “Asterisk Callme Architecture with PHP AGI
  1. Christian says:

    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. R Arun Raj says:

    Hi Christian,

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

    just try and let me knowv

  3. Miqdad says:

    Hi,

    Can you please help me to catch the output of

    $agi->exec(“Dial Zap/g0/”.$cid, null);

    I just want to handle

    $result = $agi->exec(“Dial Zap/g0/”.$cid, null);
    if($result == "No ANswer"){

    }

    like this…

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.