mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-03 04:16:43 +00:00
restarts busydetector (if enabled) when DTMF is received after call is bridged.
(closes issue 0016389)
Reported by: alecdavis
Tested by: alecdavis
Patch
dtmf_busydetector.diff2.txt uploaded by alecdavis (license 585)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@235774 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
18
main/dsp.c
18
main/dsp.c
@@ -1376,8 +1376,8 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dsp->features & DSP_FEATURE_DIGIT_DETECT)) {
|
if (dsp->features & (DSP_FEATURE_DIGIT_DETECT | DSP_FEATURE_BUSY_DETECT)) {
|
||||||
if ((dsp->digitmode & DSP_DIGITMODE_MF))
|
if (dsp->digitmode & DSP_DIGITMODE_MF)
|
||||||
digit = mf_detect(dsp, &dsp->digit_state, shortdata, len, (dsp->digitmode & DSP_DIGITMODE_NOQUELCH) == 0, (dsp->digitmode & DSP_DIGITMODE_RELAXDTMF));
|
digit = mf_detect(dsp, &dsp->digit_state, shortdata, len, (dsp->digitmode & DSP_DIGITMODE_NOQUELCH) == 0, (dsp->digitmode & DSP_DIGITMODE_RELAXDTMF));
|
||||||
else
|
else
|
||||||
digit = dtmf_detect(dsp, &dsp->digit_state, shortdata, len, (dsp->digitmode & DSP_DIGITMODE_NOQUELCH) == 0, (dsp->digitmode & DSP_DIGITMODE_RELAXDTMF));
|
digit = dtmf_detect(dsp, &dsp->digit_state, shortdata, len, (dsp->digitmode & DSP_DIGITMODE_NOQUELCH) == 0, (dsp->digitmode & DSP_DIGITMODE_RELAXDTMF));
|
||||||
@@ -1389,15 +1389,18 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
|
|||||||
if (!dsp->dtmf_began) {
|
if (!dsp->dtmf_began) {
|
||||||
/* We have not reported DTMF_BEGIN for anything yet */
|
/* We have not reported DTMF_BEGIN for anything yet */
|
||||||
|
|
||||||
event = AST_FRAME_DTMF_BEGIN;
|
if (dsp->features & DSP_FEATURE_DIGIT_DETECT) {
|
||||||
event_digit = dsp->digit_state.digits[0];
|
event = AST_FRAME_DTMF_BEGIN;
|
||||||
|
event_digit = dsp->digit_state.digits[0];
|
||||||
|
}
|
||||||
dsp->dtmf_began = 1;
|
dsp->dtmf_began = 1;
|
||||||
|
|
||||||
} else if (dsp->digit_state.current_digits > 1 || digit != dsp->digit_state.digits[0]) {
|
} else if (dsp->digit_state.current_digits > 1 || digit != dsp->digit_state.digits[0]) {
|
||||||
/* Digit changed. This means digit we have reported with DTMF_BEGIN ended */
|
/* Digit changed. This means digit we have reported with DTMF_BEGIN ended */
|
||||||
|
if (dsp->features & DSP_FEATURE_DIGIT_DETECT) {
|
||||||
event = AST_FRAME_DTMF_END;
|
event = AST_FRAME_DTMF_END;
|
||||||
event_digit = dsp->digit_state.digits[0];
|
event_digit = dsp->digit_state.digits[0];
|
||||||
|
}
|
||||||
memmove(dsp->digit_state.digits, dsp->digit_state.digits + 1, dsp->digit_state.current_digits);
|
memmove(dsp->digit_state.digits, dsp->digit_state.digits + 1, dsp->digit_state.current_digits);
|
||||||
dsp->digit_state.current_digits--;
|
dsp->digit_state.current_digits--;
|
||||||
dsp->dtmf_began = 0;
|
dsp->dtmf_began = 0;
|
||||||
@@ -1406,6 +1409,7 @@ struct ast_frame *ast_dsp_process(struct ast_channel *chan, struct ast_dsp *dsp,
|
|||||||
/* Reset Busy Detector as we have some confirmed activity */
|
/* Reset Busy Detector as we have some confirmed activity */
|
||||||
memset(dsp->historicsilence, 0, sizeof(dsp->historicsilence));
|
memset(dsp->historicsilence, 0, sizeof(dsp->historicsilence));
|
||||||
memset(dsp->historicnoise, 0, sizeof(dsp->historicnoise));
|
memset(dsp->historicnoise, 0, sizeof(dsp->historicnoise));
|
||||||
|
ast_debug(1, "DTMF Detected - Reset busydetector\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user