aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2001-03-10 19:12:11 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2001-03-10 19:12:11 +0000
commitdc884645e6463fb181af816fdea3599713b0bd87 (patch)
treec16bdd5583e05977a7893075e3b541e1a3afa073 /include
parentea452d3fd8f99256d987297e5afa8d1c226b465e (diff)
Version 0.1.7 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@236 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rwxr-xr-xinclude/asterisk/channel.h58
-rwxr-xr-xinclude/asterisk/channel_pvt.h12
-rwxr-xr-xinclude/asterisk/translate.h29
3 files changed, 71 insertions, 28 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index b3ef37653..3f7d5e744 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -36,27 +36,37 @@ extern "C" {
struct ast_channel {
char name[AST_CHANNEL_NAME]; /* ASCII Description of channel name */
char language[MAX_LANGUAGE]; /* Language requested */
+ char *type; /* Type of channel */
+ int fd; /* File descriptor for channel -- all must have
+ a file descriptor! */
+
+ int blocking; /* Whether or not we're blocking */
pthread_t blocker; /* If anyone is blocking, this is them */
pthread_mutex_t lock; /* Lock, can be used to lock a channel for some operations */
char *blockproc; /* Procedure causing blocking */
+
char *appl; /* Current application */
char *data; /* Data passed to current application */
- int blocking; /* Whether or not we're blocking */
+
+ int exception; /* Has an exception been detected */
struct sched_context *sched; /* Schedule context */
+
int streamid; /* For streaming playback, the schedule ID */
struct ast_filestream *stream; /* Stream itself. */
- struct ast_channel *trans; /* Translator if present */
- struct ast_channel *master; /* Master channel, if this is a translator */
- int fd; /* File descriptor for channel -- all must have
- a file descriptor! */
- char *type; /* Type of channel */
+ int oldwriteformat; /* Original writer format */
+
int state; /* State of line */
int rings; /* Number of rings so far */
int stack; /* Current level of application */
- int format; /* Kinds of data this channel can
+
+ int nativeformats; /* Kinds of data this channel can
natively handle */
+ int readformat; /* Requested read format */
+ int writeformat; /* Requested write format */
+
char *dnid; /* Malloc'd Dialed Number Identifier */
char *callerid; /* Malloc'd Caller ID */
+
char context[AST_MAX_EXTENSION]; /* Current extension context */
char exten[AST_MAX_EXTENSION]; /* Current extension number */
int priority; /* Current extension priority */
@@ -125,7 +135,7 @@ int ast_waitfor(struct ast_channel *chan, int ms);
struct ast_channel *ast_waitfor_n(struct ast_channel **chan, int n, int *ms);
/* This version works on fd's only. Be careful with it. */
-int ast_waitfor_n_fd(int *fds, int n, int *ms);
+int ast_waitfor_n_fd(int *fds, int n, int *ms, int *exception);
/* Read a frame. Returns a frame, or NULL on error. If it returns NULL, you
best just stop reading frames and assume the channel has been
@@ -135,6 +145,12 @@ struct ast_frame *ast_read(struct ast_channel *chan);
/* Write a frame to a channel */
int ast_write(struct ast_channel *chan, struct ast_frame *frame);
+/* Set read format for channelto whichever component of "format" is best. */
+int ast_set_read_format(struct ast_channel *chan, int format);
+
+/* Set write format for channel to whichever compoent of "format" is best. */
+int ast_set_write_format(struct ast_channel *chan, int format);
+
/* Write text to a display on a channel */
int ast_sendtext(struct ast_channel *chan, char *text);
@@ -148,10 +164,32 @@ char ast_waitfordigit(struct ast_channel *c, int ms);
digits "timeout" (-1 for none), terminated by anything in "enders". Give them rtimeout
for the first digit */
int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int rtimeout, char *enders);
+
+#define AST_BRIDGE_DTMF_CHANNEL_0 (1 << 0) /* Report DTMF on channel 0 */
+#define AST_BRIDGE_DTMF_CHANNEL_1 (1 << 1) /* Report DTMF on channel 1 */
+#define AST_BRIDGE_REC_CHANNEL_0 (1 << 2) /* Return all voice frames on channel 0 */
+#define AST_BRIDGE_REC_CHANNEL_1 (1 << 3) /* Return all voice frames on channel 1 */
+#define AST_BRIDGE_IGNORE_SIGS (1 << 4) /* Ignore all signal frames except NULL */
+
+
+/* Set two channels to compatible formats -- call before ast_channel_bridge in general . Returns 0 on success
+ and -1 if it could not be done */
+int ast_channel_make_compatible(struct ast_channel *c0, struct ast_channel *c1);
+
+/* Bridge two channels (c0 and c1) together. If an important frame occurs, we return that frame in
+ *rf (remember, it could be NULL) and which channel (0 or 1) in rc */
+int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
+
+#ifdef DO_CRASH
+#define CRASH do { *((int *)0) = 0; } while(0)
+#else
+#define CRASH do { } while(0)
+#endif
+
#define CHECK_BLOCKING(c) { \
if ((c)->blocking) {\
- ast_log(LOG_WARNING, "Blocking '%s', already blocked by thread %ld in procedure %s\n", (c)->name, (c)->blocker, (c)->blockproc); \
- /* *((int *)0)=0; */ \
+ ast_log(LOG_WARNING, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", pthread_self(), (c)->name, (c)->blocker, (c)->blockproc); \
+ CRASH; \
} else { \
(c)->blocker = pthread_self(); \
(c)->blockproc = __PRETTY_FUNCTION__; \
diff --git a/include/asterisk/channel_pvt.h b/include/asterisk/channel_pvt.h
index 8657d4d58..7fc464ebb 100755
--- a/include/asterisk/channel_pvt.h
+++ b/include/asterisk/channel_pvt.h
@@ -24,6 +24,14 @@ extern "C" {
struct ast_channel_pvt {
/* Private data used by channel backend */
void *pvt;
+ /* Write translation path */
+ struct ast_trans_pvt *writetrans;
+ /* Read translation path */
+ struct ast_trans_pvt *readtrans;
+ /* Raw read format */
+ int rawreadformat;
+ /* Raw write format */
+ int rawwriteformat;
/* Send a literal DTMF digit */
int (*send_digit)(struct ast_channel *chan, char digit);
/* Call a given phone number (address, etc), but don't
@@ -39,6 +47,10 @@ struct ast_channel_pvt {
int (*write)(struct ast_channel *chan, struct ast_frame *frame);
/* Display or transmit text */
int (*send_text)(struct ast_channel *chan, char *text);
+ /* Handle an exception, reading a frame */
+ struct ast_frame * (*exception)(struct ast_channel *chan);
+ /* Bridge two channels of the same type together */
+ int (*bridge)(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc);
};
/* Create a channel structure */
diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h
index a2bcfff19..640c5794d 100755
--- a/include/asterisk/translate.h
+++ b/include/asterisk/translate.h
@@ -29,7 +29,7 @@ struct ast_translator {
char name[80];
int srcfmt;
int dstfmt;
- struct ast_translator_pvt *(*new)();
+ struct ast_translator_pvt *(*new)(void);
int (*framein)(struct ast_translator_pvt *pvt, struct ast_frame *in);
struct ast_frame * (*frameout)(struct ast_translator_pvt *pvt);
void (*destroy)(struct ast_translator_pvt *pvt);
@@ -44,29 +44,22 @@ struct ast_translator {
struct ast_trans_pvt;
-/* Create a pseudo channel which translates from a real channel into our
- desired format. When a translator is installed, you should not use the
- sub channel until you have stopped the translator. For all other
- actions, use the real channel. Generally, translators should be created
- when needed and immediately destroyed when no longer needed. */
-
-/* Directions */
-#define AST_DIRECTION_OUT 1
-#define AST_DIRECTION_IN 2
-#define AST_DIRECTION_BOTH 3
-
-extern struct ast_channel *ast_translator_create(struct ast_channel *real, int format, int direction);
-extern void ast_translator_destroy(struct ast_channel *tran);
/* Register a Codec translator */
extern int ast_register_translator(struct ast_translator *t);
/* Unregister same */
extern int ast_unregister_translator(struct ast_translator *t);
/* Given a list of sources, and a designed destination format, which should
- I choose? */
-extern int ast_translator_best_choice(int dst, int srcs);
-extern struct ast_trans_pvt *ast_translator_build_path(int source, int dest);
+ I choose? Returns 0 on success, -1 if no path could be found. Modifies
+ dests and srcs in place */
+extern int ast_translator_best_choice(int *dsts, int *srcs);
+
+/* Build a path (possibly NULL) from source to dest */
+extern struct ast_trans_pvt *ast_translator_build_path(int dest, int source);
extern void ast_translator_free_path(struct ast_trans_pvt *tr);
-extern struct ast_frame_chain *ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f);
+
+/* Apply an input frame into the translator and receive zero or one output frames. Consume
+ determines whether the original frame should be freed */
+extern struct ast_frame *ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, int consume);
#if defined(__cplusplus) || defined(c_plusplus)