Hi!
I need to do a kind of auto-Dialer. The thing is that calls will be originate from nowhere, so I can’t use AGI for that. I must use AMI for create a connection to Asterisk first.
So, I’m using PHP for this but once I connect to my Asterisk, I don’t know how to execute an AGI for make calls. Google didn’t help me to find an example for this.
Is it possible to call an AGI from AMI? I want to execute a file wich will have the “dial” things.
How I do that?
Should I execute the file from the “commands” line?
function managerLogin()
{
$socket = fsockopen("127.0.0.1","5038", $errno, $errstr);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: test\r\n");
fputs($socket, "Secret: test\r\n\r\n");
fputs($socket, "Events: on\r\n\r\n");
}
while (managerLogin())
{
fputs($socket, "Action: AGI\r\n");
fputs($socket, "Channel: \r\n");
fputs($socket, "Commands: \r\n\r\n");
}
Thanks!