Hi Just_kgn, and anyone else with this problem. I just found this thread, and a workaround for the problem.
I have an asterisk server on my local network, wrote and tested some AMI code, which works fine here, but when running the same connection across a lower speed/higher latency WAN link, the connection drops repeatedly drops as you describe.
My workaround was to set up a connection proxy using the xinetd superserver ( helped by heronforge.net/redhat/node11.html ) (you could use inetd and nc if you had to, my testing with nc worked OK). The supseserver listens (on a different port), and passes traffic through to asterisk. the superserver i can only assume handles buffering or dropped packets more gracefully.
on the asterisk machine, add the following line to /etc/services
create /etc/xinetd.d/asteriskamifwd containing:
flags = REUSE
socket_type = stream
wait = no
user = root
redirect = localhost 5038
log_on_failure += USERID
only_from = 127.0.0.1/24 10.0.0.1/24
set only_from to appropriate addresses (see the xinetd man pages) or scrub the line if you don’t care about restricting client addresses.
restart the superserver:
now connect to asterisk on port 5039 rather than 5038, and all should be better behaved.
You could instead create a similar config on a machine ‘close to’ the asterisk server (where the connection dropping isn’t a problem), and then connect via that machine.
seems to be working OK for me so far.
[color=#FF0000]WARNING:[/color] This bypasses some of the AMI security. Connections coming via the superserver would appear to asterisk as such. security settings in the ami config must allow connections from the machine running superserver (127.0.0.1 in the above example) method will allow all connections to the superserver through to asterisk, regardless of the remote IP address. Be sure to configure only_from correctly.
Anyone else have workaround, success/problems with this method, or better solutions?