Asterisk hangup randomly?

My setup :

Linux RedHat 9
Asterisk 1.0.9
Voicetronix Openswitch 12

Asterisk connect to server in JAVA (using AGI to communicate with the server).

My extensions.conf :

exten => s,1,Agi(agi://

The server in JAVA receives hangup notification but the user don’t hangup line. This happens in an unpredictable way.

When i execute :

#asterisk -vvvvr
#Unable to connect to remote asterisk

I set rights on directory : /var/log/asterisk and /var/run
But i’m still unable to get the consol running.

Any idea will be appriciated.