[Error] Asterisk Manager header not received

I have installed Asterisk module in v-Tiger CRM, and when this module connect to
Asterisk manager created a log with this line: [Tue Oct 18 15:35:20 2011]
[error] [client 10.242.2.10] Tue, 18 Oct 2011 15:35:20 +0700 - Asterisk
Manager header not received., referer: .
Could you give some technique issues or some solutions?
Thanks.

P/S: Sorry for my bad English.

Hello,
It maybe firewall or manager.conf issue.
Try telnet sip.ip 5038 or localhost instead of sip.ip if it’s running locally.
If you can access it from the same machine where CRM is running you should see something like this :
Connected to sip.ip
Escape character is ‘^]’.
Asterisk Call Manager/1.1

also use cli manager show connected to check if there are some connections.

Good luck,
Jox.

i used telnet:
$ telnet 127.0.0.1 5038
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
Asterisk Call Manager/1.0

and after login, response:
Response: Success
ActionID: 1
Message: Authentication accepted

but why it still created log: [error] asterisk manager header not received?

I suppose you should check that CRM is really connecting on localhost but not on interface IP, try to connect with same settings which are set in CRM.
Also you could check with tcpdump if there are really connection from CRM to asterisk, don’t forget to check on all interfaces -i options .

Also you should check which ACL you are using in manager.conf.

Hope it will help.
Jox.

i have a look code in file "phpagi-asmanager.php"
in function connect()

$str = fgets($this->socket);
if ($str == false) {
// a problem.
$this->log(“Asterisk Manager header not received.”);
return false;
} else {
// note: don’t $this->log($str) until someone looks to see why it mangles the logging
}

it’s mean fgets($this->socket) always false and make log.
Could give me some advices?

hi,
that mean you can’t open socket with your manager because of some parameters that are passed to fsockopen are wrong or misplaced.
Could you check which parameters are passed to fsockopen and try to connect with this params.

this function is look like:
$this->socket = @fsockopen($this->server, $this->port, $errno, $errstr);
Check each parameter.
Jox.

i checked parameters as you mentioned:
$this->server -> 127.0.0.1
$this->port -> 5038
$errno -> 0
$errstr -> null

is it something wrong?
how can i debug $this->socket [resource(282) of type (stream)]?

You are getting this error when you can’t read anything from the socket ($str = fgets($this->socket) ) , so you should check which error do you have when you are opening this socket.
just remove @ in front of function fsockopen, and check logs for error.

Also check errno and errstr after fsockopen executes.

[quote] - If provided, holds the system level error number that occurred in the system-level connect() call.
If the value returned in errno is 0 and the function returned FALSE, it is an indication that the error occurred before the connect() call. This is most likely due to a problem initializing the socket.
and
errstr The error message as a string.
[/quote]