## AmiLib

Description

Located in /AmiLib.php (line 67)

Variable Summary
string $_authtype
boolean $_debug
array $_event_handlers
boolean $_log
string $_logfile
string $_password
integer $_port
string $_server
object $_socket
string $_username
Method Summary
AmiLib __construct ([array $config = array()])
boolean addLog (string $level, string $message)
array commandExecute (string $command, [string $actionid = NULL])
boolean connect ([ $events = 'off'])
boolean debug (string $info, $message)
none disconnect ()
string getAuthtype ()
bool getDebug ()
array getEventHandlers ( $event)
bool getLog ()
string getLogFile ()
string getPassword ()
integer getPort ()
array getResponse (none 0)
string getServer ()
object getSocket ()
string getUsername ()
bool is_connected ()
bool logoff ()
array sendRequest (string $action, [array $parameters = array()])
void setAuthtype (string $authtype)
void setDebug (bool $debug)
void setEventHandlers (array $eventhandler, $callback)
void setLog (bool $log)
void setLogFile (string $logfile)
void setPassword (string $password)
void setPort (integer $port)
void setServer (string $server)
object setSocket ( $socket)
void setUsername (string $username)
Variables
string $_authtype (line 115)

Manager authentication type plaintext or md5

- access: private

boolean $_debug (line 125)

Enable or disable debug commands

Default: Disabled

- access: private

array $_event_handlers (line 153)

Event Handlers

- access: private

boolean $_log (line 135)

Enable or disable log commands

Default: Disabled

- access: private

string $_logfile = './ami.log' (line 145)

Log filename

Default: './ami.log'

- access: private

string $_password (line 106)

Asterisk manager secret

- access: private

integer $_port (line 90)

Asterisk manager server port

- access: private

string $_server (line 82)

Asterisk manager server address

- access: private

object $_socket = NULL (line 74)

Socket stream

- access: private

string $_username (line 98)

Asterisk manager user

- access: private

Methods
Constructor __construct (line 419)

AmiLib::__construct()

Default constructor of AmiLib class

- access: public

AmiLib __construct ([array $config = array()])

- array $config:

  Array of the parameters used to connect to the server

  1. array(
  2. 'server' => '127.0.0.1' // The server to connect to
  3. 'port' => '5038', // Port of manager API
  4. 'username' => 'admin', // Asterisk manager username
  5. 'password' => 'password', // Asterisk manager password
  6. 'authtype' => 'plaintext' // Valid plaintext or md5
  7. 'debug' => 'true or false' // Enable or not debug
  8. 'log' => 'true or false' // Enable or nor logging
  9. 'logfile' => 'filename' // Log filename
  10. );

addLog (line 537)

AmiLib::addLog()

Log file

boolean addLog (string $level, string $message)

- string $level: DEBUG|INFO|WARN|ERROR|FATAL - Default is INFO
- string $message: Information message

commandExecute (line 860)

AmiLib::commandExecute()

Execute Asterisk CLI Command

- return: data
- access: public

array commandExecute (string $command, [string $actionid = NULL])

- string $command
- string $actionid: message matching variable

connect (line 734)

AmiLib::connect()

Connect to Asterisk Manager

- return: true on success
- access: public

boolean connect ([ $events = 'off'])

- $events

debug (line 512)

AmiLib::debug()

Debug info

boolean debug (string $info, $message)

- string $info: or array message
- $message

disconnect (line 816)

AmiLib::disconnect()

Close the socket connection

- access: public

none disconnect ()
getAuthtype (line 284)

AmiLib::getAuthtype()

Return current authentication type

- access: public

string getAuthtype ()
getDebug (line 308)

AmiLib::getDebug()

Return current debug value

- access: public

bool getDebug ()
getEventHandlers (line 379)

AmiLib::getEventHandlers() Return event handlers

- access: public

array getEventHandlers ( $event)

- $event

getLog (line 332)

AmiLib::getLog()

Return current log value

- access: public

bool getLog ()
getLogFile (line 356)

AmiLib::getLogFile()

Return current log filename value

- access: public

string getLogFile ()
getPassword (line 260)

AmiLib::getPassword()

Return current password manager

- access: public

string getPassword ()
getPort (line 212)

AmiLib::getPort()

Return current port connection

- access: public

integer getPort ()
getResponse (line 605)

AmiLib::getResponse()

Wait for command response

Wwill return the response

- return: of parameters, empty on timeout
- access: private

array getResponse (none 0)

- none 0

getServer (line 188)

AmiLib::getServer()

Return server address connection (Asterisk Server)

- access: public

string getServer ()
getSocket (line 164)

AmiLib::getSocket()

Return current socket or NULL value

- access: public

object getSocket ()
getUsername (line 236)

AmiLib::getUsername()

Return current username manager

- access: public

string getUsername ()
is_connected (line 846)

AmiLib::is_connected()

Check if the socket is connected

- access: public

bool is_connected ()
logoff (line 834)

AmiLib::logoff()

Logout of the current manager session attached to $this->_socket

- access: private

bool logoff ()
sendRequest (line 707)

AmiLib::sendRequest()

Send a request to manager

- return: of parameters
- access: public

array sendRequest (string $action, [array $parameters = array()])

- string $action: Manager Action
- array $parameters: AMI Commands

setAuthtype (line 296)

AmiLib::setAuthtype()

Define authentication type

- access: private

void setAuthtype (string $authtype)

- string $authtype

setDebug (line 320)

AmiLib::setDebug()

Define debug value

- access: private

void setDebug (bool $debug)

- bool $debug

setEventHandlers (line 392)

AmiLib::setEventHandlers()

Define event handlers value

- access: private

void setEventHandlers (array $eventhandler, $callback)

- array $eventhandler
- $callback

setLog (line 344)

AmiLib::setLog()

Define log value

- access: private

void setLog (bool $log)

- bool $log

setLogFile (line 368)

AmiLib::setLogFile()

Define log filename value

- access: private

void setLogFile (string $logfile)

- string $logfile

setPassword (line 272)

AmiLib::setPassword

Define password manager

- access: private

void setPassword (string $password)

- string $password

setPort (line 224)

AmiLib::setPort()

Define port connection

- access: private

void setPort (integer $port)

- integer $port

setServer (line 200)

AmiLib::setServer()

Define server address connection (Asterisk Server)

- access: private

void setServer (string $server)

- string $server

setSocket (line 176)

AmiLib::setSocket()

Define the socket stream

- access: private

object setSocket ( $socket)

- $socket

setUsername (line 248)

AmiLib::setUsername()

Define username manager

- access: private

void setUsername (string $username)

- string $username

Documentation generated on Thu, 22 Apr 2010 13:56:00 -0300 by phpDocumentor 1.4.3