Main Page | Alphabetical List | Data Structures | Directories | 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 #define DSP_FEATURE_FAX_DETECT       (1 << 4)
00022 
00023 #define  DSP_DIGITMODE_DTMF         0           /* Detect DTMF digits */
00024 #define DSP_DIGITMODE_MF         1           /* Detect MF digits */
00025 
00026 #define DSP_DIGITMODE_NOQUELCH      (1 << 8)    /* Do not quelch DTMF from in-band */
00027 #define DSP_DIGITMODE_MUTECONF      (1 << 9)    /* Mute conference */
00028 #define DSP_DIGITMODE_MUTEMAX    (1 << 10)      /* Delay audio by a frame to try to extra quelch */
00029 #define DSP_DIGITMODE_RELAXDTMF     (1 << 11)      /* "Radio" mode (relaxed DTMF) */
00030 
00031 struct ast_dsp;
00032 
00033 struct ast_dsp *ast_dsp_new(void);
00034 void ast_dsp_free(struct ast_dsp *dsp);
00035 /* Set threshold value for silence */
00036 void ast_dsp_set_threshold(struct ast_dsp *dsp, int threshold);
00037 
00038 /* Set number of required cadences for busy */
00039 void ast_dsp_set_busy_count(struct ast_dsp *dsp, int cadences);
00040 
00041 /* Scans for progress indication in audio */
00042 int ast_dsp_call_progress(struct ast_dsp *dsp, struct ast_frame *inf);
00043 
00044 /* Set zone for doing progress detection */
00045 int ast_dsp_set_call_progress_zone(struct ast_dsp *dsp, char *zone);
00046 
00047 /* Return AST_FRAME_NULL frames when there is silence, AST_FRAME_BUSY on 
00048    busies, and call progress, all dependent upon which features are enabled */
00049 struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp, struct ast_frame *inf);
00050 
00051 /* Return non-zero if this is silence.  Updates "totalsilence" with the total
00052    number of seconds of silence  */
00053 int ast_dsp_silence(struct ast_dsp *dsp, struct ast_frame *f, int *totalsilence);
00054 
00055 /* Return non-zero if historically this should be a busy, request that
00056   ast_dsp_silence has already been called */
00057 int ast_dsp_busydetect(struct ast_dsp *dsp);
00058 
00059 /* Return non-zero if DTMF hit was found */
00060 int ast_dsp_digitdetect(struct ast_dsp *dsp, struct ast_frame *f);
00061 
00062 /* Reset total silence count */
00063 void ast_dsp_reset(struct ast_dsp *dsp);
00064 
00065 /* Reset DTMF detector */
00066 void ast_dsp_digitreset(struct ast_dsp *dsp);
00067 
00068 /* Select feature set */
00069 void ast_dsp_set_features(struct ast_dsp *dsp, int features);
00070 
00071 /* Get pending DTMF/MF digits */
00072 int ast_dsp_getdigits(struct ast_dsp *dsp, char *buf, int max);
00073 
00074 /* Set digit mode */
00075 int ast_dsp_digitmode(struct ast_dsp *dsp, int digitmode);
00076 
00077 #endif

Generated on Wed Mar 16 20:08:34 2005 for Asterisk by  doxygen 1.4.0