Remote AGI is not releasing channel

Hi
My scenario is we are using fast agi to communicate asterisk with external agi.

e.g
AGI(agi://1.2.3.4:8000)
issue is when remote server got disconnected due to network disconnection or any other reason channel got struck on agi and do not come to next step.

Any advice how we can overcome on it. Can we do change in dialplan or set any parameter to overcome it.

This should not happen.
AGI should have an internal timeout of 2000ms, defined in res_agi.c:

If this timeout doesn’t work in Your installation You should probably file a bug against Asterisk.

But: If the timeout works, it’s on You within Your dialplan to handle the unsuccessful AGI-call and it’s missing results.

Thanks abw1oim

Actually when call goes to agi on server 1.2.3.4 it is not releasing channel and call does not go on next dialplan .

AGI(agi://1.2.3.4:8000)