Asterisk AGI Not executing Completely

I am trying to execute a php script using Asterisk AGI.However the script works fine.I am trying to connect an external system from the script, which is not working.checked the same code in local server and works fine.How can I debug the same.Please advise.

Thanks!!!

Have you attempted to connect to this external system from outside of the AGI? How do you connect?

If you still can’t outside of the AGI then you need to figure that out.

From outside AGI I can connect to external system successfully.I checked with my Local sever.