I am using phpagi-asmanager to originate a call , with ActionID parameter also. As an application, I am calling an AGI script to present an IVR to the callee. All works fine, except that I want to know in case the originate to the callee failed , together with the reason (eg busy, no answer etc). Please help me with a snippet of sample code on how to capture the originateresponse from Asterisk manager.
Regards
devafree
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello
I am using phpagi-asmanager to originate a call , with ActionID parameter also. As an application, I am calling an AGI script to present an IVR to the callee. All works fine, except that I want to know in case the originate to the callee failed , together with the reason (eg busy, no answer etc). Please help me with a snippet of sample code on how to capture the originateresponse from Asterisk manager.
Regards
devafree
I have as follows:
$asm->add_event_handler('originateresponse','dump_event') ;
$make_call1 = $asm->send_request('Originate',
array('Channel'=>'SIP/1002',
'Context'=>'outbound_txt2s',
'Priority'=>'1',
'Application'=>'AGI',
Data'=>"agi_call.php|$VAR_id|$VAR_phone_number|$filename",
'Timeout'=>'20000',
'CallerID'=>$VAR_caller_id,
'Variable'=>"msg_id=$VAR_msg_id|filename=$file_wav",
'Account'=>$VAR_msg_id,
'Async'=>'true',
'ActionID'=>$VAR_msg_id));
#$asm->add_event_handler('originateresponse','dump_event') ;
echo $make_call1['Response'] ;
================
This always gives SUCCESS, even when there is no route to the SIP phone. How to grab the actual 'originateresponse' is my query.
Please excuse the basic nature, as I am asterisk + php newbie.
Regards