Version 0.1.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@10 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
0c71a026a7
commit
ea71582100
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Asterisk -- A telephony toolkit for Linux.
|
||||
*
|
||||
* Private channel definitions for channel implementations only.
|
||||
*
|
||||
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
|
||||
*
|
||||
* Mark Spencer <markster@linux-support.net>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_CHANNEL_PVT_H
|
||||
#define _ASTERISK_CHANNEL_PVT_H
|
||||
|
||||
#include <asterisk/channel.h>
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
struct ast_channel_pvt {
|
||||
/* Private data used by channel backend */
|
||||
void *pvt;
|
||||
/* Send a literal DTMF digit */
|
||||
int (*send_digit)(struct ast_channel *chan, char digit);
|
||||
/* Call a given phone number (address, etc), but don't
|
||||
take longer than timeout seconds to do so. */
|
||||
int (*call)(struct ast_channel *chan, char *addr, int timeout);
|
||||
/* Hangup (and possibly destroy) the channel */
|
||||
int (*hangup)(struct ast_channel *chan);
|
||||
/* Answer the line */
|
||||
int (*answer)(struct ast_channel *chan);
|
||||
/* Read a frame, in standard format */
|
||||
struct ast_frame * (*read)(struct ast_channel *chan);
|
||||
/* Write a frame, in standard format */
|
||||
int (*write)(struct ast_channel *chan, struct ast_frame *frame);
|
||||
};
|
||||
|
||||
/* Create a channel structure */
|
||||
struct ast_channel *ast_channel_alloc();
|
||||
#define ast_channel_free(a) free(a)
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Asterisk -- A telephony toolkit for Linux.
|
||||
*
|
||||
* Configuration File Parser
|
||||
*
|
||||
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
|
||||
*
|
||||
* Mark Spencer <markster@linux-support.net>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_CONFIG_H
|
||||
#define _ASTERISK_CONFIG_H
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ast_config;
|
||||
|
||||
struct ast_variable {
|
||||
char *name;
|
||||
char *value;
|
||||
struct ast_variable *next;
|
||||
};
|
||||
|
||||
/* Create a config structure from a given configuration file */
|
||||
struct ast_config *ast_load(char *configfile);
|
||||
/* Free memory associated with a given config */
|
||||
void ast_destroy(struct ast_config *config);
|
||||
/* List categories of config file */
|
||||
char *ast_category_browse(struct ast_config *config, char *prev);
|
||||
/* List variables of config file */
|
||||
struct ast_variable *ast_variable_browse(struct ast_config *config, char *category);
|
||||
/* Retrieve a specific variable */
|
||||
char *ast_variable_retrieve(struct ast_config *config, char *category, char *value);
|
||||
/* Determine affermativeness of a boolean value */
|
||||
int ast_true(char *val);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Asterisk
|
||||
*
|
||||
* Mark Spencer <markster@marko.net>
|
||||
*
|
||||
* Copyright(C) 1999, Adtran, Inc.
|
||||
*
|
||||
* Distributed under the terms of the GNU General Public License (GPL) Version 2
|
||||
*
|
||||
* I/O Managment (derived from Cheops-NG)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IO_H
|
||||
#define _IO_H
|
||||
|
||||
#include <sys/poll.h> /* For POLL* constants */
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AST_IO_IN POLLIN /* Input ready */
|
||||
#define AST_IO_OUT POLLOUT /* Output ready */
|
||||
#define AST_IO_PRI POLLPRI /* Priority input ready */
|
||||
|
||||
/* Implicitly polled for */
|
||||
#define AST_IO_ERR POLLERR /* Error condition (errno or getsockopt) */
|
||||
#define AST_IO_HUP POLLHUP /* Hangup */
|
||||
#define AST_IO_NVAL POLLNVAL /* Invalid fd */
|
||||
|
||||
/*
|
||||
* An Asterisk IO callback takes its id, a file descriptor, list of events, and
|
||||
* callback data as arguments and returns 0 if it should not be
|
||||
* run again, or non-zero if it should be run again.
|
||||
*/
|
||||
|
||||
struct io_context;
|
||||
|
||||
/* Create a context for I/O operations */
|
||||
struct io_context *io_context_create();
|
||||
|
||||
/* Destroy a context for I/O operations */
|
||||
void io_context_destroy(struct io_context *ioc);
|
||||
|
||||
typedef int (*ast_io_cb)(int *id, int fd, short events, void *cbdata);
|
||||
#define AST_IO_CB(a) ((ast_io_cb)(a))
|
||||
|
||||
/*
|
||||
* Watch for any of revents activites on fd, calling callback with data as
|
||||
* callback data. Returns a pointer to ID of the IO event, or NULL on failure.
|
||||
*/
|
||||
extern int *ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events, void *data);
|
||||
|
||||
/*
|
||||
* Change an i/o handler, updating fd if > -1, callback if non-null, and revents
|
||||
* if >-1, and data if non-null. Returns a pointero to the ID of the IO event,
|
||||
* or NULL on failure.
|
||||
*/
|
||||
extern int *ast_io_change(struct io_context *ioc, int *id, int fd, ast_io_cb callback, short events, void *data);
|
||||
|
||||
/*
|
||||
* Remove an I/O id from consideration Returns 0 on success or -1 on failure.
|
||||
*/
|
||||
extern int ast_io_remove(struct io_context *ioc, int *id);
|
||||
|
||||
/*
|
||||
* Wait for I/O to happen, returning after
|
||||
* howlong milliseconds, and after processing
|
||||
* any necessary I/O. Returns the number of
|
||||
* I/O events which took place.
|
||||
*/
|
||||
extern int ast_io_wait(struct io_context *ioc, int howlong);
|
||||
|
||||
/*
|
||||
* Debugging: Dump everything in the I/O array
|
||||
*/
|
||||
extern void ast_io_dump(struct io_context *ioc);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Cheops Next Generation
|
||||
*
|
||||
* Mark Spencer <markster@marko.net>
|
||||
*
|
||||
* Copyright(C) 1999, Adtran, Inc.
|
||||
*
|
||||
* Distributed under the terms of the GNU General Public License (GPL) Version
|
||||
*
|
||||
* Logging routines
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LOGGER_H
|
||||
#define _LOGGER_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define EVENTLOG "event_log"
|
||||
|
||||
#define DEBUG_M(a) { \
|
||||
a; \
|
||||
}
|
||||
|
||||
extern void ast_log(int level, char *file, int line, char *function, char *fmt, ...);
|
||||
extern void ast_verbose(char *fmt, ...);
|
||||
|
||||
extern int ast_register_verbose(void (*verboser)(char *string, int opos, int replacelast, int complete));
|
||||
extern int ast_unregister_verbose(void (*verboser)(char *string, int opos, int replacelast, int complete));
|
||||
|
||||
#define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__
|
||||
|
||||
#define LOG_DEBUG 0, _A_
|
||||
#define LOG_EVENT 1, _A_
|
||||
#define LOG_NOTICE 2, _A_
|
||||
#define LOG_WARNING 3, _A_
|
||||
#define LOG_ERROR 4, _A_
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Asterisk -- A telephony toolkit for Linux.
|
||||
*
|
||||
* Options provided by main asterisk program
|
||||
*
|
||||
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
|
||||
*
|
||||
* Mark Spencer <markster@linux-support.net>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_OPTIONS_H
|
||||
#define _ASTERISK_OPTIONS_H
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int option_verbose;
|
||||
extern int option_debug;
|
||||
extern int option_nofork;
|
||||
extern int option_quiet;
|
||||
|
||||
#define VERBOSE_PREFIX_1 " "
|
||||
#define VERBOSE_PREFIX_2 " == "
|
||||
#define VERBOSE_PREFIX_3 " -- "
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* Asterisk -- A telephony toolkit for Linux.
|
||||
*
|
||||
* Core PBX routines and definitions.
|
||||
*
|
||||
* Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
|
||||
*
|
||||
* Mark Spencer <markster@linux-support.net>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License
|
||||
*/
|
||||
#ifndef _ASTERISK_PBX_H
|
||||
#define _ASTERISK_PBX_H
|
||||
|
||||
#include <asterisk/sched.h>
|
||||
#include <asterisk/channel.h>
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define AST_PBX_KEEP 0
|
||||
#define AST_PBX_REPLACE 1
|
||||
|
||||
/* Max length of an application */
|
||||
#define AST_MAX_APP 32
|
||||
|
||||
struct ast_context;
|
||||
|
||||
/* Register a new context */
|
||||
struct ast_context *ast_context_create(char *name);
|
||||
|
||||
/* Destroy a context */
|
||||
void ast_context_destroy(struct ast_context *);
|
||||
|
||||
/* Find a context */
|
||||
struct ast_context *ast_context_find(char *name);
|
||||
|
||||
/* Create a new thread and start the PBX (or whatever) */
|
||||
int ast_pbx_start(struct ast_channel *c);
|
||||
|
||||
|
||||
|
||||
/* Add an extension to an extension context, this time with an ast_context * */
|
||||
int ast_add_extension2(struct ast_context *con,
|
||||
int replace, char *extension, int priority,
|
||||
char *application, void *data, void (*datad)(void *));
|
||||
|
||||
/* Add an application. The function 'execute' should return non-zero if the line needs to be hung up. */
|
||||
int ast_register_application(char *app, int (*execute)(struct ast_channel *, void *));
|
||||
|
||||
/* Remove an application */
|
||||
int ast_unregister_application(char *app);
|
||||
|
||||
/* If an extension exists, return non-zero */
|
||||
int ast_exists_extension(struct ast_channel *c, char *context, char *exten, int priority);
|
||||
|
||||
/* Launch a new extension (i.e. new stack) */
|
||||
int ast_spawn_extension(struct ast_channel *c, char *context, char *exten, int priority);
|
||||
|
||||
/* Execute an extension. If it's not available, do whatever you should do for
|
||||
default extensions and halt the thread if necessary. This function does not
|
||||
return, except on error. */
|
||||
int ast_exec_extension(struct ast_channel *c, char *context, char *exten, int priority);
|
||||
/* Longest extension */
|
||||
int ast_pbx_longest_extension(char *context);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Asterisk
|
||||
*
|
||||
* Mark Spencer <markster@marko.net>
|
||||
*
|
||||
* Copyright(C) 1999, Adtran, Inc.
|
||||
*
|
||||
* Distributed under the terms of the GNU General Public License (GPL) Version 2
|
||||
*
|
||||
* Scheduler Routines (derived from cheops)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_SCHED_H
|
||||
#define _ASTERISK_SCHED_H
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The max number of schedule structs to keep around
|
||||
* for use. Undefine to disable schedule structure
|
||||
* caching. (Only disable this on very low memory
|
||||
* machines)
|
||||
*/
|
||||
|
||||
#define SCHED_MAX_CACHE 128
|
||||
|
||||
struct sched_context;
|
||||
|
||||
/* Create a scheduling context */
|
||||
extern struct sched_context *sched_context_create(void);
|
||||
|
||||
void sched_context_destroy(struct sched_context *);
|
||||
|
||||
/*
|
||||
* A cheops scheduler callback takes a pointer with callback data and
|
||||
* returns a 0 if it should not be run again, or non-zero if it should be
|
||||
* rescheduled to run again
|
||||
*/
|
||||
typedef int (*ast_sched_cb)(void *data);
|
||||
#define AST_SCHED_CB(a) ((ast_sched_cb)(a))
|
||||
|
||||
/*
|
||||
* Schedule an event to take place at some point in the future. callback
|
||||
* will be called with data as the argument, when milliseconds into the
|
||||
* future (approximately)
|
||||
*/
|
||||
extern int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, void *data);
|
||||
|
||||
/*
|
||||
* Remove this event from being run. A procedure should not remove its
|
||||
* own event, but return 0 instead.
|
||||
*/
|
||||
extern int ast_sched_del(struct sched_context *con, int id);
|
||||
|
||||
/*
|
||||
* Determine the number of seconds until the next outstanding event
|
||||
* should take place, and return the number of milliseconds until
|
||||
* it needs to be run. This value is perfect for passing to the poll
|
||||
* call. Returns "-1" if there is nothing there are no scheduled events
|
||||
* (and thus the poll should not timeout)
|
||||
*/
|
||||
extern int ast_sched_wait(struct sched_context *con);
|
||||
|
||||
/*
|
||||
* Run the queue, executing all callbacks which need to be performed
|
||||
* at this time. Returns the number of events processed.
|
||||
*/
|
||||
extern int ast_sched_runq(struct sched_context *con);
|
||||
|
||||
/*
|
||||
* Debugging: Dump the contents of the scheduler to stderr
|
||||
*/
|
||||
extern void ast_sched_dump(struct sched_context *con);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue