AMI Originate Call recording

Hi team,
I am facing an issue in ami originate command and i am using php ami library support
here the code snippet
$ami = new MyAmi();
$ami = $ami->get_instance(‘IP of the server ‘); // basically connect ami instance
$channelVars = [
‘context’ => ‘test’,
‘priority’ => 1,
‘callerid’ => “833XXXX”,
];
$output = $ami->originate(“9xxxxx@ip”,’’) //
I want if call is dialed on the 9xxxxx and somewhat phone is out of network or switch off
or any other case how can i get the exact response from ami the actual reason of call hangup

plus can i also record the call wile ami dialed the number so that i can listen what is the reason

Generally, if you want to do anything complex with Originate, you originate to a local channel, and handle the complexities in dialplan.

I think that definitely applies to recording, but I’m not sure what you can get in terms of AMI or CEL for the clearing cause.

1 Like

You can try using AMI action Getvar and the asterisk hangup cause variable, but that variable is only available after the call end, so not sure if this method will work for you. I better suggest you, use Local channel with some kind of curl request, where you can fire hangup cause variable to your PHP script

Thank You so much

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