Hey ,I am using PHPAGI to dial any number .Below is the code that i am using to dial any number.
While initiating call i am using M option with dial application.But when customer answer the call ,macro-context is being called from agi file .I dont want to go to dialplan to perform any action during answer.I want to call api when agent answer the call in agi file only.
Is there any way to deal with this ?Below is the line i am using to dial number and i have attached code file also.
In this case i advise you to use AMI protocol. Your PHP script connects to the Asterisk using AMI protocol and waits for Event: Bridge or Event: Link event, which means called party has allready picked up the phone. But keep in mind that you need to determine a call is yours or not. Because your script will receive such event of all calls on Asterisk.
Why do you not want to use dialplan (as this can be achieved easily from there)? You are calling this agi from dialplan itself so adding one more context for macro wouldn’t hurt.
Personally I would use option U (for subroutine) instead of M as Macros are deprecated now
Thanks satish for your reply. I am new to php and whatever i am learning ,trying to implement it .I will go for Macro and call other agi file.I thought may be something is there in AGI feature which will indicate that call is answered that i don’t know ,that’s why i have asked this question in Asterisk community so that you guys can solve or suggest something to resolve my concern.
AGI is not a substitute of the dialplan, and unexpected results canbe found, when trying to replace the dial plan at all using AGI, this is the beauty and the real power of AGI when combining Asterisk commands and functions with external AGI programming.
Also as @satish4asterisk says at the end you are using the dial plan at least to call your AGI, take the advise and replace Macro by Sub