aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-19 06:41:58 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-05-19 06:41:58 +0000
commitfc967865e237b07e31cf7e9c5a388f351e32a784 (patch)
treece9a19af57460e9268d87b8cea5949fc8be3c716 /main
parent744136bb41f1d583f5260b3281057b49fee996d7 (diff)
Merged revisions 263950 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r263950 | tilghman | 2010-05-19 01:41:04 -0500 (Wed, 19 May 2010) | 15 lines Merged revisions 263949 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r263949 | tilghman | 2010-05-19 01:32:27 -0500 (Wed, 19 May 2010) | 8 lines Because progress is called multiple times, across several frames, we must persist states when detecting multitone sequences. (closes issue #16749) Reported by: dant Patches: dsp.c-bug16749-1.patch uploaded by dant (license 670) Tested by: dant ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@263951 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/dsp.c83
1 files changed, 43 insertions, 40 deletions
diff --git a/main/dsp.c b/main/dsp.c
index 0796fd034..1a8892289 100644
--- a/main/dsp.c
+++ b/main/dsp.c
@@ -998,10 +998,13 @@ static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len)
} else if (hz[HZ_950] > TONE_MIN_THRESH * TONE_THRESH) {
newstate = DSP_TONE_STATE_SPECIAL1;
} else if (hz[HZ_1400] > TONE_MIN_THRESH * TONE_THRESH) {
- if (dsp->tstate == DSP_TONE_STATE_SPECIAL1)
+ /* End of SPECIAL1 or middle of SPECIAL2 */
+ if (dsp->tstate == DSP_TONE_STATE_SPECIAL1 || dsp->tstate == DSP_TONE_STATE_SPECIAL2) {
newstate = DSP_TONE_STATE_SPECIAL2;
+ }
} else if (hz[HZ_1800] > TONE_MIN_THRESH * TONE_THRESH) {
- if (dsp->tstate == DSP_TONE_STATE_SPECIAL2) {
+ /* End of SPECIAL2 or middle of SPECIAL3 */
+ if (dsp->tstate == DSP_TONE_STATE_SPECIAL2 || dsp->tstate == DSP_TONE_STATE_SPECIAL3) {
newstate = DSP_TONE_STATE_SPECIAL3;
}
} else if (dsp->genergy > TONE_MIN_THRESH * TONE_THRESH) {
@@ -1035,43 +1038,43 @@ static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len)
dsp->ringtimeout++;
}
switch (dsp->tstate) {
- case DSP_TONE_STATE_RINGING:
- if ((dsp->features & DSP_PROGRESS_RINGING) &&
- (dsp->tcount==THRESH_RING)) {
- res = AST_CONTROL_RINGING;
- dsp->ringtimeout= 1;
- }
- break;
- case DSP_TONE_STATE_BUSY:
- if ((dsp->features & DSP_PROGRESS_BUSY) &&
- (dsp->tcount==THRESH_BUSY)) {
- res = AST_CONTROL_BUSY;
- dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
- }
- break;
- case DSP_TONE_STATE_TALKING:
- if ((dsp->features & DSP_PROGRESS_TALK) &&
- (dsp->tcount==THRESH_TALK)) {
- res = AST_CONTROL_ANSWER;
- dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
- }
- break;
- case DSP_TONE_STATE_SPECIAL3:
- if ((dsp->features & DSP_PROGRESS_CONGESTION) &&
- (dsp->tcount==THRESH_CONGESTION)) {
- res = AST_CONTROL_CONGESTION;
- dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
- }
- break;
- case DSP_TONE_STATE_HUNGUP:
- if ((dsp->features & DSP_FEATURE_CALL_PROGRESS) &&
- (dsp->tcount==THRESH_HANGUP)) {
- res = AST_CONTROL_HANGUP;
- dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
- }
- break;
+ case DSP_TONE_STATE_RINGING:
+ if ((dsp->features & DSP_PROGRESS_RINGING) &&
+ (dsp->tcount == THRESH_RING)) {
+ res = AST_CONTROL_RINGING;
+ dsp->ringtimeout = 1;
+ }
+ break;
+ case DSP_TONE_STATE_BUSY:
+ if ((dsp->features & DSP_PROGRESS_BUSY) &&
+ (dsp->tcount == THRESH_BUSY)) {
+ res = AST_CONTROL_BUSY;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
+ }
+ break;
+ case DSP_TONE_STATE_TALKING:
+ if ((dsp->features & DSP_PROGRESS_TALK) &&
+ (dsp->tcount == THRESH_TALK)) {
+ res = AST_CONTROL_ANSWER;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
+ }
+ break;
+ case DSP_TONE_STATE_SPECIAL3:
+ if ((dsp->features & DSP_PROGRESS_CONGESTION) &&
+ (dsp->tcount == THRESH_CONGESTION)) {
+ res = AST_CONTROL_CONGESTION;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
+ }
+ break;
+ case DSP_TONE_STATE_HUNGUP:
+ if ((dsp->features & DSP_FEATURE_CALL_PROGRESS) &&
+ (dsp->tcount == THRESH_HANGUP)) {
+ res = AST_CONTROL_HANGUP;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
+ }
+ break;
}
- if (dsp->ringtimeout==THRESH_RING2ANSWER) {
+ if (dsp->ringtimeout == THRESH_RING2ANSWER) {
ast_debug(1, "Consider call as answered because of timeout after last ring\n");
res = AST_CONTROL_ANSWER;
dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
@@ -1082,8 +1085,8 @@ static int __ast_dsp_call_progress(struct ast_dsp *dsp, short *s, int len)
dsp->tstate = newstate;
dsp->tcount = 1;
}
-
- /* Reset goertzel */
+
+ /* Reset goertzel */
for (x = 0; x < 7; x++) {
dsp->freqs[x].v2 = dsp->freqs[x].v3 = 0.0;
}