AmiLib::__construct()
Default constructor of AmiLib class
AmiLib
__construct
([array $config = array()])
-
array
$config:
Array of the parameters used to connect to the server
array(
'server' => '127.0.0.1' // The server to connect to
'port' => '5038', // Port of manager API
'username' => 'admin', // Asterisk manager username
'password' => 'password', // Asterisk manager password
'authtype' => 'plaintext' // Valid plaintext or md5
'debug' => 'true or false' // Enable or not debug
'log' => 'true or false' // Enable or nor logging
'logfile' => 'filename' // Log filename
);
AmiLib::addLog()
Log file
boolean
addLog
(string $level, string $message)
-
string
$level: DEBUG|INFO|WARN|ERROR|FATAL - Default is INFO
-
string
$message: Information message
AmiLib::commandExecute()
Execute Asterisk CLI Command
array
commandExecute
(string $command, [string $actionid = NULL])
-
string
$command
-
string
$actionid: message matching variable
AmiLib::connect()
Connect to Asterisk Manager
boolean
connect
([ $events = 'off'])
AmiLib::debug()
Debug info
boolean
debug
(string $info, $message)
-
string
$info: or array message
-
$message
AmiLib::disconnect()
Close the socket connection
none
disconnect
()
AmiLib::getAuthtype()
Return current authentication type
string
getAuthtype
()
AmiLib::getDebug()
Return current debug value
bool
getDebug
()
AmiLib::getEventHandlers() Return event handlers
array
getEventHandlers
( $event)
AmiLib::getLog()
Return current log value
bool
getLog
()
AmiLib::getLogFile()
Return current log filename value
string
getLogFile
()
AmiLib::getPassword()
Return current password manager
string
getPassword
()
AmiLib::getPort()
Return current port connection
integer
getPort
()
AmiLib::getResponse()
Wait for command response
Wwill return the response
array
getResponse
(none 0)
AmiLib::getServer()
Return server address connection (Asterisk Server)
string
getServer
()
AmiLib::getSocket()
Return current socket or NULL value
object
getSocket
()
AmiLib::getUsername()
Return current username manager
string
getUsername
()
AmiLib::is_connected()
Check if the socket is connected
bool
is_connected
()
AmiLib::logoff()
Logout of the current manager session attached to $this->_socket
bool
logoff
()
AmiLib::sendRequest()
Send a request to manager
array
sendRequest
(string $action, [array $parameters = array()])
-
string
$action: Manager Action
-
array
$parameters: AMI Commands
AmiLib::setAuthtype()
Define authentication type
void
setAuthtype
(string $authtype)
AmiLib::setDebug()
Define debug value
void
setDebug
(bool $debug)
AmiLib::setEventHandlers()
Define event handlers value
void
setEventHandlers
(array $eventhandler, $callback)
-
array
$eventhandler
-
$callback
AmiLib::setLog()
Define log value
void
setLog
(bool $log)
AmiLib::setLogFile()
Define log filename value
void
setLogFile
(string $logfile)
AmiLib::setPassword
Define password manager
void
setPassword
(string $password)
AmiLib::setPort()
Define port connection
void
setPort
(integer $port)
AmiLib::setServer()
Define server address connection (Asterisk Server)
void
setServer
(string $server)
AmiLib::setSocket()
Define the socket stream
object
setSocket
( $socket)
AmiLib::setUsername()
Define username manager
void
setUsername
(string $username)