Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals

dsp.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- A telephony toolkit for Linux.
00003  *
00004  * Convenient Signal Processing routines
00005  * 
00006  * Copyright (C) 1999, Mark Spencer
00007  *
00008  * Mark Spencer <markster@linux-support.net>
00009  *
00010  * This program is free software, distributed under the terms of
00011  * the GNU General Public License
00012  */
00013 
00014 #ifndef _ASTERISK_DSP_H
00015 #define _ASTERISK_DSP_H
00016 
00017 #define DSP_FEATURE_SILENCE_SUPPRESS (1 << 0)
00018 #define DSP_FEATURE_BUSY_DETECT      (1 << 1)
00019 #define DSP_FEATURE_CALL_PROGRESS    (1 << 2)
00020 #define DSP_FEATURE_DTMF_DETECT      (1 << 3)
00021 
00022 #define  DSP_DIGITMODE_DTMF         0           /* Detect DTMF digits */
00023 #define DSP_DIGITMODE_MF         1           /* Detect MF digits */
00024 
00025 #define DSP_DIGITMODE_NOQUELCH      (1 << 8)    /* Do not quelch DTMF from in-band */
00026 #define DSP_DIGITMODE_MUTECONF      (1 << 9)    /* Mute conference */
00027 #define DSP_DIGITMODE_MUTEMAX    (1 << 10)      /* Delay audio by a frame to try to extra quelch */
00028 #define DSP_DIGITMODE_RELAXDTMF     (1 << 11)      /* "Radio" mode (relaxed DTMF) */
00029 
00030 struct ast_dsp;
00031 
00032 struct ast_dsp *ast_dsp_new(void);
00033 void ast_dsp_free(struct ast_dsp *dsp);
00034 /* Set threshold value for silence */
00035 void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold);
00036 
00037 /* Set number of required cadences for busy */
00038 void ast_dsp_set_busy_count(struct ast_dsp *dsp, int cadences);
00039 
00040 /* Scans for progress indication in audio */
00041 int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf);
00042 
00043 /* Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on 
00044    busies, and call progress, all dependent upon which features are enabled */
00045 struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf, int needlock);
00046 
00047 /* Return non-zero if this is silence.  Updates "totalsilence" with the total
00048    number of seconds of silence  */
00049 int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence);
00050 
00051 /* Return non-zero if historically this should be a busy, request that
00052   ast_dsp_silence has already been called */
00053 int ast_dsp_busydetect(struct ast_dsp *dsp);
00054 
00055 /* Return non-zero if DTMF hit was found */
00056 int ast_dsp_digitdetect(struct ast_dsp *dsp, struct ast_frame *f);
00057 
00058 /* Reset total silence count */
00059 void ast_dsp_reset(struct ast_dsp *dsp);
00060 
00061 /* Reset DTMF detector */
00062 void ast_dsp_digitreset(struct ast_dsp *dsp);
00063 
00064 /* Select feature set */
00065 void ast_dsp_set_features(struct ast_dsp *dsp, int features);
00066 
00067 /* Get pending DTMF/MF digits */
00068 int ast_dsp_getdigits(struct ast_dsp *dsp, char *buf, int max);
00069 
00070 /* Set digit mode */
00071 int ast_dsp_digitmode(struct ast_dsp *dsp, int digitmode);
00072 
00073 #endif

Generated on Sun Apr 18 23:33:51 2004 for Asterisk by doxygen 1.3.6-20040222