I want to execute an AGI script for calling party after called party hangs up. For example, for doing a survey for customers I am going to run an AGI script after agent hangs up. Unfortunately, when AGI scripts runs the agi debug output says: "511: The command cannot be executed on a dead channel" I use commands like "ANSWER" or "STREAM FILE" in my agi script which need a channel to run on. I know that calling channel hangs up as soon as called party hangs up. I tried DeadAGI instead of AGI and also "g" option in dial command but none of them works. So, I think I have to search for a solution that keep the calling channel up so that I can run my script on that. Any suggestion please?
2 Answers
0
votes
You should not use "g" param for this case, because it is CALLER hangup. You should use "F"
F([[context^]exten^]priority): When the caller hangs up, transfer
the *called* party to the specified destination and *start* execution
at that location.
NOTE: Any channel variables you want the called channel to inherit
from the caller channel must be prefixed with one or two underbars ('_').
F: When the caller hangs up, transfer the *called* party to the next
priority of the current extension and *start* execution at that location.
NOTE: Any channel variables you want the called channel to inherit
from the caller channel must be prefixed with one or two underbars ('_').
NOTE: Using this option from a Macro() or GoSub() might not make
sense as there would be no return points.
g: Proceed with dialplan execution at the next priority in the current
extension if the destination channel hangs up.
0
votes
Finally I found the answer. The problem is that we don't have to execute agi script in h extension otherwise we get an error for some functions like answer or streamfile in agi. we have to redirect the call to some extension before h extension and for that in elastix I had to change extensions.conf.