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

Filed Under: asteriskPHP

Tags:

About the Author: me : yeay its me arun

RSSComments (2)

Leave a Reply | Trackback URL

  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

Leave a Reply

Videos, Slideshows and Podcasts by Cincopa Wordpress Plugin