Manager API

I have configure the manager.conf when I want to use this function it seems something wrong.

lsfks15:/etc/asterisk # telnet 132.xx.xxx 5038
Trying 132.xxx.xx.xx...
Connected to 132.xxx.x.xx.
Escape character is '^]'.
Asterisk Call Manager/1.0
action:login
username:haiyin
secret:john
events:off

Response: Error
Message: Missing action in request

No matter what I type in, it always shows this error message;
Response: Error
Message: Missing action in request

I also using the java program HelloEvents from http://asterisk-java.org/latest/tutorial.html

but it show up the message “connection refuse”. I want to know whether I have already establish the manager API channel or not.

here is my manager.conf

[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0

[haiyin]
secret = john
;deny=0.0.0.0/0.0.0.0
permit=0.0.0.0/0.0.0.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user

You must send CRLF, and you seem to be sending just LF.

So, How should I do this? I just press enter right after each command line.

But I think at least the java program won’t get the “connect refuse” message.

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.

=Stefan

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 :cry:

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.

=Stefan

It seems when i use java it can connect the asterisk manager API, but still can’t process any furthur action.

I want to try some action in the manager API under shell first. Can someone give me some hits?