I have been trying to get phpagi to do originate and I fail over and over. I have been able to use Action: Command and send command originate which is the CLI originate and that works. But the AMI Originate doesn’t work. Can anyone please guide me to an example of Originate somewhere? I am trying to have my php file (from the browser) to take variables $x, $y, and $z through a form and then process the call as follows:
Please guide me what the Originate part should look like in the php file and what file should go where as for as phpagi files go. I need some detailed documentation on how to use phpagi which unfortunately is missing on phpagi site.
I really appreciate any help on this.
I’m sorry I don’t have any sample about, try post your php script, try a call and post the Asterisk CLI output (set the verbose to a high level and activate agi debug), I’ll try help you debug it.
I was actually looking for the easy way out and used floAPI and phpagi-asmanager which does the dirty work behind the scene but I failed with them and spent way too much time on it looking for an easy way.
I will look at Ian’s and try to learn that method. Seems like that is exactly what I want. I will post back if I need any help.
First, allow me to clear the air for myself. From what I understand Ian doesn’t use any third party AMI handler and he simply relies on php for a opening socket to AMI and passing commands?! I followed his php example and I can’t even establish a connection. Asterisk CLI doesn’t show manager “test” logged from 127.0.0.1 when I submit the form. Below is my complete code and the context.
Thanks for the input. I found out that with Asterisk 1.6 I have to add originate to write list in manager.conf . So, I add that. However now, if I do this:
$oSocket = fsockopen($sys_ip, 5038, $errnum, $errdesc) or die(“Connection to host failed”);
if ($_POST[‘x’]) {
I see an attempt to connect, but I don’t see it if I do this:
if ($_POST[‘x’]) {
$oSocket = fsockopen($sys_ip, 5038, $errnum, $errdesc) or die(“Connection to host failed”);
By the way what is errnum and errdesc? and the or die ("Connection… part? are these set variables and optinos for $sockopen?
I am wondering if anyone can test this on their machine. Would be much appreciated. keeps me itching my head 100 times a day
[quote]Action: Originate
Synopsis: Originate Call
Privilege: originate,all
Description: Generates an outgoing call to a Extension/Context/Priority or
Application/Data
Variables: (Names marked with * are required)
*Channel: Channel name to call
Exten: Extension to use (requires ‘Context’ and ‘Priority’)
Context: Context to use (requires ‘Exten’ and ‘Priority’)
Priority: Priority to use (requires ‘Exten’ and ‘Context’)
Application: Application to use
Data: Data to use (requires ‘Application’)
Timeout: How long to wait for call to be answered (in ms)
CallerID: Caller ID to be set on the outgoing channel
Variable: Channel variable to set, multiple Variable: headers are allowed
Account: Account code
Async: Set to ‘true’ for fast origination
[/quote]
However, when I set CallerID through Telnet it simply doesn’t pass through. Also, using Channel: SIP/testTrunk/14164445555 and then my context: testphp, exte: 14164446666 doesn’t wait for one channel to dial first. I know that it’s not a local extension but but channel should be dialed first, picked up and then go to context. Why does it ring both at the same time? This is SIP and rich of info in terms of answered or not.