run ngrep -s 4000 port 5038 -T on the computer running your application or on the Asterisk box when you try to access the manager api through your Java program and post the results.
That should help us figure out what’s going on there.
Additionally it might be interesting what version of Asterisk you are connecting to.
I try the command you offered
here is the information
interface: tun0 (10.99.0.1/255.255.255.255)
filter: (ip) and ( port 5038 )
and no more, i need to press crtl+c to stop. I have also runned an openvpn server in the same machine.
Here is another message after I stop the openvpn server
interface: eth1 (132.230.x.0/255.255.255.0)
filter: (ip) and ( port 5038 )
####
T +12.885368 132.230.x.xx:5038 -> 141.xx.xx.xxx:1619 [AP]
Asterisk Call Manager/1.0..
##
T +0.474360 141.xx.xx.xxx:1619 -> 132.230.x.xx:5038 [AP]
action: Challenge..actionid: 8379614_0#..authtype: MD5....
##
T +0.000228 132.230.x.xx:5038-> 141.xx.xxx.xxx:1619 [AP]
Response: Success..ActionID: 8379614_0#..Challenge: 191413186....
##
T +0.415421 141.xx.xxx.xxx:1619 -> 132.230.xx.xxx:5038 [AP]
action: Login..actionid: 8379614_1#..key: 52c73db1766a6cc396ec6d8247182ddc.
.authtype: MD5..username: haiyin.....
##
T +1.003146 132.230.xx.xxx:5038 -> 141.xx.xx.xx:1619 [AP]
Response: Error..
#
T +0.000029 132.230.xx.xxx:5038 -> 141.xx.xx.xx:1619 [AP]
ActionID: 8379614_1#..
#
T +0.000038 132.230.xx.xxx:5038 -> 141.xx.xx.xx:1619 [AFP]
Message: Authentication failed....
####
But I need to run openvpn in somehow. I design to let a softphone user connect to the internet via openvpn then he runs his softphone to connect the asterisk server. so I just run the asterisk and openvpn in the same machine. is it a problem?
But I also try manager API in another machine, which only runs asterisk server. it doesn’t work,still
the asterisk version is 1.2.6, another machine runs version 1.2.9
To me this indicates that your openvpn setup (or routing, firewalll, …) is not correct. You should fix it.
Without the openvpn server your application can connect but authentication fails due to an incorrect username or password.