Sending a number to asterisk through AMI

Hi
I need to send a number to asterisk from php script through AMI. In simple scenario I register to 6001 extension and dial *1 . This task I want to perform from script. Following is my code but it is not hitting to asterisk console. Please view and suggest.


if(!$socket)
{
print "Couldn’t open socket. Error ";
}

fputs($socket, “Action: Login\r\n”);
fputs($socket, “UserName: $ast_mgr_user\r\n”);
fputs($socket, “Secret: $ast_mgr_pass\r\n\r\n”);

fputs($socket, “Action: Originate\r\n\r\n”);
fputs($socket, “Channel: PJSIP/6001\r\n”);
fputs($socket, “Exten: *1\r\n”);
fputs($socket, “Action: Logoff\r\n\r\n”);

fclose($socket);

?>

You have no parameters to Originate and bogus ones for Logiff.

         at least after the extension parameter specify context and priority  

         fputs($socket, "Exten: *1\r\n" );
           fputs($socket, "Context: ivr\r\n" );
           fputs($socket, "Priority: 1\r\n" );
           fputs($socket, "CallerID: $dest\r\n" );     
          fputs($socket, "Async: yes\r\n\r\n" );
          fputs($socket, "Action: Logoff\r\n\r\n");

If you look carefully, Exten was not set as a parameter of Orinate, but of Logoff!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.