Archive

Posts Tagged ‘callme architecture’

Asterisk Callme Architecture with PHP AGI

May 12th, 2009 R Arun Raj 2 comments

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