Hi guys hopefully someone can help me
i have been given the task of creating a new asterisk server to replace our currant aging system
i am trying to configure the following PHP script to make a call from several HTTP Post parameters the script is below
<?php
if ($_POST['operator'] != "" && $_POST['callee'] != "" && $_POST['spoof'] != "" && $_POST['uniqueID'] != "")
{
$cli = $_POST['spoof'];
$ddi = $_POST['operator'];
$transfer = $_POST['callee'];
$id = $_POST['uniqueID'];
$context = 'testOutboundCall';
$exten = $cli;
// Bring in the agi utility class
require_once('/var/lib/asterisk/agi-bin/phpagi-asmanager.php');
$asm = new AGI_AsteriskManager();
// Connect to Ast via AGI
if( $asm->connect())
{
// Initiate the call
$call = $asm->send_request('Originate',
array('Channel'=>'SIP/AQL/' . $ddi,
'Context'=>$context,
'Exten'=>$exten,
'Timeout' => '50000',
'Async'=>'1',
'variable' => 'id=' . $id . '|callTo=' . $ddi . '|callFrom=' . $cli . '|transferTo=' . $transfer,
'MaxRetries' => '0',
'RetryTime' => '0',
'Priority'=>'1',
'Callerid'=>$cli));
// Disconnect from Ast
$asm->disconnect();
// All good as far as we know...
echo "ok";
}
else
{
echo "error: Can't open AGI to Asterisk";
}
}
else
{
echo $_POST['operator'];
echo $_GET['test'];
}
?>
from the console i can see
Manager ‘phpagi’ logged on from 127.0.0.1
Manager ‘phpagi’ logged off from 127.0.0.1
so credentials within manager.conf and phpagi-asmanager.php are correct but i do not receive a call as i would expect
asterisk is version 1.8
sorry i cant explain things better but my asterisk knowledge is limited to say the least
cheers
This is AMI, not AGI.
I would wireshark the connection and find out exactly what is sent.
Hi David thanks for the reply
from wireshark i can see the HTTP POST but i do not see the connection to asterisk manager
then within the console i see the log on and log off message
the php script attached above is only trying to make a call through AMI, have there been any changes in 1.8.8.1 that may make our out script incompatible it has been copied from a server running 1.4
are there any logs that may show any errors for example /var/etc/asterisk/messages doesnt really give me anythin
maybe there is a step im missing to run scripts within AMI
manager.conf
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
[phpagi]
secret = phpagi
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
within side the apache logs i am seeing this error but that maybe something else
No event handler for event ‘fullybooted’
any help greatly appreciated
Your HTTP is probably coming in from a system that is not the Asterisk server. With that assumption, and assuming you are running the wireshark on the Asterisk server, then you are capturing traffic on an Ethernet interface, such as eth0. The AMI connection is being made on the 127.0.0.1 meaning it is connecting via the loopback interface of ‘lo’. Make sure to start wire shark on the correct interface.
In 1.8, when you connect via the AMI interface, if you do not specify which events you wish to receive, the AMI will issue a ‘fullybooted’ event. This did not occur in 1.4. It appears that the event is not being handled by your library automatically. In the AMI connect routine, there may be a way to specify which events to monitor. Or you may have to write a handler for that event.
HTTP is local i have managed to get a little further with this issue
i seem to be able to get things working through the manager as expected using the following commands
Action: Originate
Channel: SIP/AQL/07700000
Context: testOutboundCall
variable: id=‘1’,callTo=‘0170000’,callFrom=‘0770000’,transferTo='0770000’
Exten: 0170000
Priority: 1
CallerID: 0170000
it seems there has been a slight change within the manager.conf i had to add the originate permission to the phpagi user
i also managed to find out that
[Jan 26 13:51:46] WARNING[2280]: pbx.c:1417 pbx_exec: The application delimiter is now the comma, not the pipe. Did you forget to convert your dialplan?
so i amended my values/variabels to be comma seperated
now when i call the PHP script i receive an error
– Got SIP response 480 “Temporarily Unavailable” back from 194.333.222.111:5060
> Channel SIP/AQL-00000014 was never answered.
so im just waiting for a responce my my Sip provider to see if this is an issue there end unless anyone else can point me in the right direction
cheers