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?
Asked
Active
Viewed 2,782 times
2 Answers
1
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.

arheops
- 15,544
- 1
- 21
- 27
-
Actually I want to do this scenario for incoming calls so I want to do something for outside caller after inside called party hangs up. as you mentioned here option "F" is for the case of caller hang up. It's different – AmirA Mar 02 '16 at 05:45
-
There are no any issues if CALLED party hangup. Option g and similar options for queues work ok,see example in extensions.conf.sample Probably you just dooing something wrong. – arheops Mar 02 '16 at 06:41
-
I'm working with elastix 2.3. I wrote a really simple code:`[test] exten => 22,1,dial(sip/100) exten => h,1,playback(goodbye)`It should play goodbye sound after 100 hangs up but it doesnt.It is really strange – AmirA Mar 02 '16 at 08:17
-
Where is g option in this example? Common, why you not read what is g option do? Use g option AND exten =>22,2,PLayback(goodbye). – arheops Mar 02 '16 at 08:25
-
1I swear to god I used g option :) the problem is when I use g option internal calls work well. but the problem is for incoming calls coming from trunk. in this case g option doesn't have any effect. do you have any suggestion for incoming calls? – AmirA Mar 02 '16 at 10:06
-
Thoose options work ok for any calls. Please read carefully your dialplan. h-extension will be executed after CALLED party hangup. – arheops Mar 02 '16 at 12:09
1
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.

AmirA
- 133
- 2
- 15