Sat Mar 24 23:51:51 2007

Asterisk developer's documentation


manager.h File Reference

The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party software. More...

#include <stdarg.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "asterisk/lock.h"

Include dependency graph for manager.h:

Go to the source code of this file.

Data Structures

struct  eventqent
struct  manager_action
struct  mansession
struct  message

Defines

#define ast_manager_register(a, b, c, d)   ast_manager_register2(a, b, c, d, NULL)
#define AST_MAX_MANHEADER_LEN   256
#define AST_MAX_MANHEADERS   80
#define DEFAULT_MANAGER_PORT   5038
#define EVENT_FLAG_AGENT   (1 << 5)
#define EVENT_FLAG_CALL   (1 << 1)
#define EVENT_FLAG_COMMAND   (1 << 4)
#define EVENT_FLAG_LOG   (1 << 2)
#define EVENT_FLAG_SYSTEM   (1 << 0)
#define EVENT_FLAG_USER   (1 << 6)
#define EVENT_FLAG_VERBOSE   (1 << 3)

Functions

int ast_carefulwrite (int fd, char *s, int len, int timeoutms)
int ast_manager_register2 (const char *action, int authority, int(*func)(struct mansession *s, struct message *m), const char *synopsis, const char *description)
int ast_manager_unregister (char *action)
int char * astman_get_header (struct message *m, char *var)
ast_variableastman_get_variables (struct message *m)
void astman_send_ack (struct mansession *s, struct message *m, char *msg)
void astman_send_error (struct mansession *s, struct message *m, char *error)
void astman_send_response (struct mansession *s, struct message *m, char *resp, char *msg)
int init_manager (void)
int manager_event (int category, char *event, char *contents,...) __attribute__((format(printf
int reload_manager (void)


Detailed Description

The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party software.

Manager protocol packages are text fields of the form a: b. There is always exactly one space after the colon.

The first header type is the "Event" header. Other headers vary from event to event. Headers end with standard
termination. The last line of the manager response or event is an empty line. (
)

Please try to re-use existing headers to simplify manager message parsing in clients. Don't re-use an existing header with a new meaning, please. You can find a reference of standard headers in doc/manager.txt

Definition in file manager.h.


Function Documentation

int ast_manager_register2 ( const char *  action,
int  authority,
int(*)(struct mansession *s, struct message *m)  func,
const char *  synopsis,
const char *  description 
)

Parameters:
action Name of the requested Action:
authority Required authority for this command
func Function to call for this command
synopsis Help text (one line, up to 30 chars) for CLI manager show commands
description Help text, several lines

int ast_manager_unregister ( char *  action  ) 

Parameters:
action Name of registred Action:

int char* astman_get_header ( struct message m,
char *  var 
)

Get header from mananger transaction

struct ast_variable* astman_get_variables ( struct message m  ) 

Get a linked list of the Variable: headers

void astman_send_error ( struct mansession s,
struct message m,
char *  error 
)

Send error in manager transaction

int init_manager ( void   ) 

Called by Asterisk initialization

int manager_event ( int  category,
char *  event,
char *  contents,
  ... 
)

Parameters:
category Event category, matches manager authorization
event Event name
contents Contents of event

int reload_manager ( void   ) 

Called by Asterisk initialization


Generated on Sat Mar 24 23:51:52 2007 for Asterisk - the Open Source PBX by  doxygen 1.5.1