mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 00:00:09 +00:00
DSP enhancements (bug #2826) courtesy pcadach
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4248 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
13
dsp.c
13
dsp.c
@@ -1174,15 +1174,15 @@ static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len)
|
|||||||
if (newstate == dsp->tstate) {
|
if (newstate == dsp->tstate) {
|
||||||
dsp->tcount++;
|
dsp->tcount++;
|
||||||
if (dsp->tcount == COUNT_THRESH) {
|
if (dsp->tcount == COUNT_THRESH) {
|
||||||
if (dsp->tstate == TONE_STATE_BUSY) {
|
if ((dsp->features & DSP_PROGRESS_BUSY) && dsp->tstate == TONE_STATE_BUSY) {
|
||||||
res = AST_CONTROL_BUSY;
|
res = AST_CONTROL_BUSY;
|
||||||
dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
|
dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
|
||||||
} else if (dsp->tstate == TONE_STATE_TALKING) {
|
} else if ((dsp->features & DSP_PROGRESS_TALK) && dsp->tstate == TONE_STATE_TALKING) {
|
||||||
res = AST_CONTROL_ANSWER;
|
res = AST_CONTROL_ANSWER;
|
||||||
dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
|
dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
|
||||||
} else if (dsp->tstate == TONE_STATE_RINGING)
|
} else if ((dsp->features & DSP_PROGRESS_RINGING) && dsp->tstate == TONE_STATE_RINGING)
|
||||||
res = AST_CONTROL_RINGING;
|
res = AST_CONTROL_RINGING;
|
||||||
else if (dsp->tstate == TONE_STATE_SPECIAL3) {
|
else if ((dsp->features & DSP_PROGRESS_CONGESTION) && dsp->tstate == TONE_STATE_SPECIAL3) {
|
||||||
res = AST_CONTROL_CONGESTION;
|
res = AST_CONTROL_CONGESTION;
|
||||||
dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
|
dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
|
||||||
}
|
}
|
||||||
@@ -1576,15 +1576,16 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
|
|||||||
}
|
}
|
||||||
if ((dsp->features & DSP_FEATURE_CALL_PROGRESS)) {
|
if ((dsp->features & DSP_FEATURE_CALL_PROGRESS)) {
|
||||||
res = __ast_dsp_call_progress(dsp, shortdata, len);
|
res = __ast_dsp_call_progress(dsp, shortdata, len);
|
||||||
memset(&dsp->f, 0, sizeof(dsp->f));
|
|
||||||
dsp->f.frametype = AST_FRAME_CONTROL;
|
|
||||||
if (res) {
|
if (res) {
|
||||||
switch(res) {
|
switch(res) {
|
||||||
case AST_CONTROL_ANSWER:
|
case AST_CONTROL_ANSWER:
|
||||||
case AST_CONTROL_BUSY:
|
case AST_CONTROL_BUSY:
|
||||||
case AST_CONTROL_RINGING:
|
case AST_CONTROL_RINGING:
|
||||||
case AST_CONTROL_CONGESTION:
|
case AST_CONTROL_CONGESTION:
|
||||||
|
memset(&dsp->f, 0, sizeof(dsp->f));
|
||||||
|
dsp->f.frametype = AST_FRAME_CONTROL;
|
||||||
dsp->f.subclass = res;
|
dsp->f.subclass = res;
|
||||||
|
dsp->f.src = "dsp_progress";
|
||||||
if (chan)
|
if (chan)
|
||||||
ast_queue_frame(chan, &dsp->f);
|
ast_queue_frame(chan, &dsp->f);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -14,11 +14,10 @@
|
|||||||
#ifndef _ASTERISK_DSP_H
|
#ifndef _ASTERISK_DSP_H
|
||||||
#define _ASTERISK_DSP_H
|
#define _ASTERISK_DSP_H
|
||||||
|
|
||||||
#define DSP_FEATURE_SILENCE_SUPPRESS (1 << 0)
|
#define DSP_FEATURE_SILENCE_SUPPRESS (1 << 0)
|
||||||
#define DSP_FEATURE_BUSY_DETECT (1 << 1)
|
#define DSP_FEATURE_BUSY_DETECT (1 << 1)
|
||||||
#define DSP_FEATURE_CALL_PROGRESS (1 << 2)
|
#define DSP_FEATURE_DTMF_DETECT (1 << 3)
|
||||||
#define DSP_FEATURE_DTMF_DETECT (1 << 3)
|
#define DSP_FEATURE_FAX_DETECT (1 << 4)
|
||||||
#define DSP_FEATURE_FAX_DETECT (1 << 4)
|
|
||||||
|
|
||||||
#define DSP_DIGITMODE_DTMF 0 /* Detect DTMF digits */
|
#define DSP_DIGITMODE_DTMF 0 /* Detect DTMF digits */
|
||||||
#define DSP_DIGITMODE_MF 1 /* Detect MF digits */
|
#define DSP_DIGITMODE_MF 1 /* Detect MF digits */
|
||||||
@@ -28,6 +27,12 @@
|
|||||||
#define DSP_DIGITMODE_MUTEMAX (1 << 10) /* Delay audio by a frame to try to extra quelch */
|
#define DSP_DIGITMODE_MUTEMAX (1 << 10) /* Delay audio by a frame to try to extra quelch */
|
||||||
#define DSP_DIGITMODE_RELAXDTMF (1 << 11) /* "Radio" mode (relaxed DTMF) */
|
#define DSP_DIGITMODE_RELAXDTMF (1 << 11) /* "Radio" mode (relaxed DTMF) */
|
||||||
|
|
||||||
|
#define DSP_PROGRESS_TALK (1 << 16) /* Enable talk detection */
|
||||||
|
#define DSP_PROGRESS_RINGING (1 << 17) /* Enable calling tone detection */
|
||||||
|
#define DSP_PROGRESS_BUSY (1 << 18) /* Enable busy tone detection */
|
||||||
|
#define DSP_PROGRESS_CONGESTION (1 << 19) /* Enable congestion tone detection */
|
||||||
|
#define DSP_FEATURE_CALL_PROGRESS (DSP_PROGRESS_TALK | DSP_PROGRESS_RINGING | DSP_PROGRESS_BUSY | DSP_PROGRESS_CONGESTION)
|
||||||
|
|
||||||
struct ast_dsp;
|
struct ast_dsp;
|
||||||
|
|
||||||
struct ast_dsp *ast_dsp_new(void);
|
struct ast_dsp *ast_dsp_new(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user