I need to use AMI (or maybe should be using ARI) to place outbound call and connect it to agent stations. It works, but I have 2 issues:
- The agent hears nothing until the call is answered, then asterisk blind transfers it to extension. I would like agent to hear dialing, ringing, etc.
- It does not seem that macro-dialout-trunk-predial-hook is being called so my AGI is not running.
Here’s the originate PHP code:
$call=array(); $call['Channel']="SIP/switch-out/0777$did'; $call['Exten']=$exten; $call['Context']='from-internal'; $call['Priority']='1'; $call['ChannelId']=$uid; $call['callerid']=$callerid; $res=$astman->Originate($call);
Here’s my exensions_custom.conf entry:
[macro-dialout-trunk-predial-hook] exten => s,1,NoOp(CUSTOM: Outbound ${EXTEN} ${CALLERID(num)}) exten => s,n,AGI(cid-did.php) exten => s,n,MacroExit()
I also tried the same in from-internal-custom and the AGI does not run. It runs fine on inbound with
[from-pstn-custom] exten => _.,1,NoOp(Getting DID-CID) exten => _.,n,AGI(cid-did.php)
So, how to get the AGI to run with an AMI originated call?
And, is there anyway to immediately connect the outbound call to the agent instead of waiting for connect?