if ($managerVersion === "1.0") { logLine("\n __READ!!! You have a partially supported AMI version: {$managerVersion} Detected__"); logLine(" __Some features like Ring Groups and Queues probably will not work.__\n\n "); } } } else { logLine(" __WARNING: Unable to detect the manager version. Setting to 1.1 and hoping for the best. But, this is probably an error__"); $managerVersion = "1.1"; } // Perform AMI Login command fputs($amiSocket, "Action: Login\r\n"); fputs($amiSocket, $asteriskUser); fputs($amiSocket, $asteriskSecret); fputs($amiSocket, "Events: call,hud\r\n\r\n"); // to monitor just call data, for Asterisk Manager 1.0 remove hud $result = AMI_ReadResponse($amiSocket, 2000000); logLine(" AMI Login action raw response:\n" . markdown_indent($result)); if (AMI_WasCmdSuccessful($result)) { logLine(" AMI Login was a *success!*"); logLine("Waiting for call events..."); } else { logLine(" __ERROR: AMI Login FAILED__, Depending on your asterisk version helpful info may be above.\n **Check Asterisk Username / Password in config, then verify AMI user has proper permissions in manager.conf**\n\n"); sleep(5); continue; } $event = ''; $stack = 0; $event_started = false; $start = NULL; $timeout = ini_get('default_socket_timeout'); stream_set_timeout($amiSocket, 60);
if (!$managerVersion == "1.1") { logLine(" **ERROR: AMI v{$managerVersion} is not supported by this version of asteriskLogger. Please see issues section on github site. Several people have gotten it working in 1.0 but changes haven't been merged yet."); } else { logLine(" Supported AMI version: {$managerVersion} Detected"); } } else { logLine(" __WARNING: Unable to detect the manager version. Setting to 1.1 and hoping for the best. But, this is probably an error__"); $managerVersion = "1.1"; } // Perform AMI Login command fputs($amiSocket, "Action: Login\r\n"); fputs($amiSocket, $asteriskUser); fputs($amiSocket, $asteriskSecret); fputs($amiSocket, "Events: call,hud\r\n\r\n"); // to monitor just call data, for Asterisk Manager 1.0 remove hud $result = AMI_ReadResponse($amiSocket); logLine(" AMI Login action raw response:\n" . markdown_indent($result)); if (AMI_WasCmdSuccessful($result)) { logLine(" AMI Login was a *success!*"); logLine("Waiting for call events..."); } else { logLine(" __ERROR: AMI Login FAILED__, Depending on your asterisk version helpful info may be above.\n **Check Asterisk Username / Password in config, then verify AMI user has proper permissions in manager.conf**\n\n"); sleep(5); continue; } $event = ''; $stack = 0; $event_started = false; $start = NULL; $timeout = ini_get('default_socket_timeout'); stream_set_timeout($amiSocket, 60);