Thu May 24 14:31:56 2007

Asterisk developer's documentation


devicestate.h File Reference

Device state management. More...

Go to the source code of this file.

Defines

#define AST_DEVICE_BUSY   3
#define AST_DEVICE_INUSE   2
#define AST_DEVICE_INVALID   4
#define AST_DEVICE_NOT_INUSE   1
#define AST_DEVICE_RINGING   6
#define AST_DEVICE_UNAVAILABLE   5
#define AST_DEVICE_UNKNOWN   0

Typedefs

typedef int(*) ast_devstate_cb_type (const char *dev, int state, void *data)

Functions

int ast_device_state (const char *device)
 Asks a channel for device state.
int ast_device_state_changed (const char *fmt,...) __attribute__((format(printf
 Tells Asterisk the State for Device is changed.
int int ast_device_state_changed_literal (const char *device)
 Tells Asterisk the State for Device is changed.
int ast_device_state_engine_init (void)
int ast_devstate_add (ast_devstate_cb_type callback, void *data)
 Registers a device state change callback.
void ast_devstate_del (ast_devstate_cb_type callback, void *data)
int ast_parse_device_state (const char *device)
 Search the Channels by Name.
const char * devstate2str (int devstate)
 Convert device state to text string for output.


Detailed Description

Device state management.

Definition in file devicestate.h.


Define Documentation

#define AST_DEVICE_BUSY   3

Device is busy

Definition at line 37 of file devicestate.h.

#define AST_DEVICE_INUSE   2

Device is in use

Definition at line 35 of file devicestate.h.

#define AST_DEVICE_INVALID   4

Device is invalid

Definition at line 39 of file devicestate.h.

#define AST_DEVICE_NOT_INUSE   1

Device is not used

Definition at line 33 of file devicestate.h.

#define AST_DEVICE_RINGING   6

Device is ringing

Definition at line 43 of file devicestate.h.

#define AST_DEVICE_UNAVAILABLE   5

Device is unavailable

Definition at line 41 of file devicestate.h.

#define AST_DEVICE_UNKNOWN   0

Device is valid but channel didn't know state

Definition at line 31 of file devicestate.h.


Function Documentation

int ast_device_state ( const char *  device  ) 

Asks a channel for device state.

Parameters:
device like a dialstring Asks a channel for device state, data is normaly a number from dialstring used by the low level module Trys the channel devicestate callback if not supported search in the active channels list for the device. Returns an AST_DEVICE_??? state -1 on failure

int ast_device_state_changed ( const char *  fmt,
  ... 
)

Tells Asterisk the State for Device is changed.

Parameters:
fmt devicename like a dialstring with format parameters Asterisk polls the new extensionstates and calls the registered callbacks for the changed extensions Returns 0 on success, -1 on failure

int int ast_device_state_changed_literal ( const char *  device  ) 

Tells Asterisk the State for Device is changed.

Parameters:
device devicename like a dialstrin Asterisk polls the new extensionstates and calls the registered callbacks for the changed extensions Returns 0 on success, -1 on failure

int ast_devstate_add ( ast_devstate_cb_type  callback,
void *  data 
)

Registers a device state change callback.

Parameters:
callback Callback
data to pass to callback The callback is called if the state for extension is changed Return -1 on failure, ID on success

int ast_parse_device_state ( const char *  device  ) 

Search the Channels by Name.

Parameters:
device like a dialstring Search the Device in active channels by compare the channelname against the devicename. Compared are only the first chars to the first '-' char. Returns an AST_DEVICE_UNKNOWN if no channel found or AST_DEVICE_INUSE if a channel is found

const char* devstate2str ( int  devstate  ) 

Convert device state to text string for output.

Parameters:
devstate Current device state


Generated on Thu May 24 14:31:56 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.1