diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-09-14 10:24:18 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-09-14 10:31:24 +0300 |
commit | 4e9ea6ee6ed5a7a6d43ddce5e3e3629194ed58d5 (patch) | |
tree | e14a77f52fc3c6d6d99e08cc773c30489a387ea4 | |
parent | 56ee3af825be8baa95f8344f1805ac5cae90b006 (diff) | |
download | aports-4e9ea6ee6ed5a7a6d43ddce5e3e3629194ed58d5.tar.bz2 aports-4e9ea6ee6ed5a7a6d43ddce5e3e3629194ed58d5.tar.xz |
main/asterisk: upgrade to 10.8.0
Also cherry-pick ASTERISK-19610 related commits from 10.9.0-rc1 to
fix a long-time DTMF detection regression bug early. These three
patches can be dropped when upgrading to 10.9.0.
-rw-r--r-- | main/asterisk/APKBUILD | 12 | ||||
-rw-r--r-- | main/asterisk/ASTERISK-19610a.patch | 115 | ||||
-rw-r--r-- | main/asterisk/ASTERISK-19610b.patch | 192 | ||||
-rw-r--r-- | main/asterisk/ASTERISK-19610c.patch | 35 |
4 files changed, 351 insertions, 3 deletions
diff --git a/main/asterisk/APKBUILD b/main/asterisk/APKBUILD index 012037f54e..760436df28 100644 --- a/main/asterisk/APKBUILD +++ b/main/asterisk/APKBUILD @@ -1,8 +1,8 @@ # Contributor: Timo Teras <timo.teras@iki.fi> # Maintainer: Timo Teras <timo.teras@iki.fi> pkgname=asterisk -pkgver=10.7.1 -pkgrel=3 +pkgver=10.8.0 +pkgrel=0 pkgdesc="Asterisk: A Module Open Source PBX System" pkgusers="asterisk" pkggroups="asterisk" @@ -27,6 +27,9 @@ source="http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-$ ASTERISK-18977.patch ASTERISK-18995.patch ASTERISK-19109.patch + ASTERISK-19610a.patch + ASTERISK-19610b.patch + ASTERISK-19610c.patch asterisk.initd asterisk.confd asterisk.logrotate" @@ -182,7 +185,7 @@ sound_en() { chown -R asterisk:asterisk "$subpkgdir"/var/*/asterisk } -md5sums="dcf0a017e2644c459f700d0df334f37d asterisk-10.7.1.tar.gz +md5sums="c4fd0e804a6d804a8909f8ce0ac65694 asterisk-10.8.0.tar.gz b00c9d98ce2ad445501248a197c6e436 100-uclibc-daemon.patch 6e1129e30c4fd2c25c86c81685a485a9 101-caps-uclibc.patch b794636266cc573f0dda730fba634567 900-tryinclude.patch @@ -190,6 +193,9 @@ d582e71b6992e4b6bfe6975bbe8f75be ASTERISK-13456.patch 1ddadef41aa7120e168738b6f3ed8917 ASTERISK-18977.patch bc6713f5434e07b79d3afdd155461d72 ASTERISK-18995.patch a22bb1d513d026564cb40ec213b1ae7f ASTERISK-19109.patch +c62a5cfa216b4e26de01ee9ec3013705 ASTERISK-19610a.patch +59d2fb1f19918f3a1c85dd974f3518c2 ASTERISK-19610b.patch +78545679947bc069ec9441d9d34a0d66 ASTERISK-19610c.patch 74cd25a5638a94ef51e9f4ede2fd28f2 asterisk.initd ed31d7ba37bcf8b0346dcf8593c395f0 asterisk.confd 3e65172275684373e1a25c8a11224411 asterisk.logrotate" diff --git a/main/asterisk/ASTERISK-19610a.patch b/main/asterisk/ASTERISK-19610a.patch new file mode 100644 index 0000000000..60ced07946 --- /dev/null +++ b/main/asterisk/ASTERISK-19610a.patch @@ -0,0 +1,115 @@ +commit f831c4f +Author: alecdavis <alecdavis@f38db490-d61c-443f-a65b-d21fe96a405b> +Date: Wed Sep 5 06:47:54 2012 +0000 + + dsp.c: optimize goerztzel sample loops, in dtmf_detect, mf_detect and tone_detect + + use a temporary short int when repeatedly used to call goertzel_sample. + + alecdavis (license 585) + Reported by: alecdavis + Tested by: alecdavis + + Review: https://reviewboard.asterisk.org/r/2093/ + ........ + + Merged revisions 372212 from http://svn.asterisk.org/svn/asterisk/branches/1.8 + + + git-svn-id: http://svn.digium.com/svn/asterisk/branches/10@372213 f38db490-d61c-443f-a65b-d21fe96a405b + +diff --git a/main/dsp.c b/main/dsp.c +index 96a101f..9ba4775 100644 +--- a/main/dsp.c ++++ b/main/dsp.c +@@ -530,6 +530,7 @@ static int tone_detect(struct ast_dsp *dsp, tone_detect_state_t *s, int16_t *amp + int limit; + int res = 0; + int16_t *ptr; ++ short samp; + int start, end; + fragment_t mute = {0, 0}; + +@@ -547,10 +548,11 @@ static int tone_detect(struct ast_dsp *dsp, tone_detect_state_t *s, int16_t *amp + end = start + limit; + + for (i = limit, ptr = amp ; i > 0; i--, ptr++) { ++ samp = *ptr; + /* signed 32 bit int should be enough to suqare any possible signed 16 bit value */ +- s->energy += (int32_t) *ptr * (int32_t) *ptr; ++ s->energy += (int32_t) samp * (int32_t) samp; + +- goertzel_sample(&s->tone, *ptr); ++ goertzel_sample(&s->tone, samp); + } + + s->samples_pending -= limit; +@@ -643,10 +645,10 @@ static int dtmf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp + { + float row_energy[4]; + float col_energy[4]; +- float famp; + int i; + int j; + int sample; ++ short samp; + int best_row; + int best_col; + int hit; +@@ -669,18 +671,18 @@ static int dtmf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp + /* The following unrolled loop takes only 35% (rough estimate) of the + time of a rolled loop on the machine on which it was developed */ + for (j = sample; j < limit; j++) { +- famp = amp[j]; +- s->td.dtmf.energy += famp*famp; ++ samp = amp[j]; ++ s->td.dtmf.energy += (int32_t) samp * (int32_t) samp; + /* With GCC 2.95, the following unrolled code seems to take about 35% + (rough estimate) as long as a neat little 0-3 loop */ +- goertzel_sample(s->td.dtmf.row_out, amp[j]); +- goertzel_sample(s->td.dtmf.col_out, amp[j]); +- goertzel_sample(s->td.dtmf.row_out + 1, amp[j]); +- goertzel_sample(s->td.dtmf.col_out + 1, amp[j]); +- goertzel_sample(s->td.dtmf.row_out + 2, amp[j]); +- goertzel_sample(s->td.dtmf.col_out + 2, amp[j]); +- goertzel_sample(s->td.dtmf.row_out + 3, amp[j]); +- goertzel_sample(s->td.dtmf.col_out + 3, amp[j]); ++ goertzel_sample(s->td.dtmf.row_out, samp); ++ goertzel_sample(s->td.dtmf.col_out, samp); ++ goertzel_sample(s->td.dtmf.row_out + 1, samp); ++ goertzel_sample(s->td.dtmf.col_out + 1, samp); ++ goertzel_sample(s->td.dtmf.row_out + 2, samp); ++ goertzel_sample(s->td.dtmf.col_out + 2, samp); ++ goertzel_sample(s->td.dtmf.row_out + 3, samp); ++ goertzel_sample(s->td.dtmf.col_out + 3, samp); + } + s->td.dtmf.current_sample += (limit - sample); + if (s->td.dtmf.current_sample < DTMF_GSIZE) { +@@ -798,6 +800,7 @@ static int mf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp[] + int i; + int j; + int sample; ++ short samp; + int hit; + int limit; + fragment_t mute = {0, 0}; +@@ -821,12 +824,13 @@ static int mf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp[] + for (j = sample; j < limit; j++) { + /* With GCC 2.95, the following unrolled code seems to take about 35% + (rough estimate) as long as a neat little 0-3 loop */ +- goertzel_sample(s->td.mf.tone_out, amp[j]); +- goertzel_sample(s->td.mf.tone_out + 1, amp[j]); +- goertzel_sample(s->td.mf.tone_out + 2, amp[j]); +- goertzel_sample(s->td.mf.tone_out + 3, amp[j]); +- goertzel_sample(s->td.mf.tone_out + 4, amp[j]); +- goertzel_sample(s->td.mf.tone_out + 5, amp[j]); ++ samp = amp[j]; ++ goertzel_sample(s->td.mf.tone_out, samp); ++ goertzel_sample(s->td.mf.tone_out + 1, samp); ++ goertzel_sample(s->td.mf.tone_out + 2, samp); ++ goertzel_sample(s->td.mf.tone_out + 3, samp); ++ goertzel_sample(s->td.mf.tone_out + 4, samp); ++ goertzel_sample(s->td.mf.tone_out + 5, samp); + } + s->td.mf.current_sample += (limit - sample); + if (s->td.mf.current_sample < MF_GSIZE) { diff --git a/main/asterisk/ASTERISK-19610b.patch b/main/asterisk/ASTERISK-19610b.patch new file mode 100644 index 0000000000..e31226cd91 --- /dev/null +++ b/main/asterisk/ASTERISK-19610b.patch @@ -0,0 +1,192 @@ +commit fd63c4b +Author: alecdavis <alecdavis@f38db490-d61c-443f-a65b-d21fe96a405b> +Date: Wed Sep 5 07:37:42 2012 +0000 + + dsp.c: Fix multiple issues when no-interdigit delay is present, and fast DTMF 50ms/50ms + + Revert DTMF hit/miss detector to original -r349249 method with some changes, remove unnecessary; + 1. reseting of hits=0, when no signal, only need to set it once. + 2. incrementing of hits, when the hit is the same as the current hit. + 3. setting of lasthit, when it's the same as before. + + Change HITS_TO_BEGIN to 2, MISSES_TO_END to 3 + + & 3 spelling mistakes + + (closes issue ASTERISK-19610) + alecdavis (license 585) + Reported by: Jean-Philippe Lord + Tested by: alecdavis + + Review: https://reviewboard.asterisk.org/r/2085/ + ........ + + Merged revisions 372239 from http://svn.asterisk.org/svn/asterisk/branches/1.8 + + + git-svn-id: http://svn.digium.com/svn/asterisk/branches/10@372240 f38db490-d61c-443f-a65b-d21fe96a405b + +diff --git a/main/dsp.c b/main/dsp.c +index 9ba4775..7541650 100644 +--- a/main/dsp.c ++++ b/main/dsp.c +@@ -205,9 +205,9 @@ enum gsamp_thresh { + #define DTMF_GSIZE 102 + + /* How many successive hits needed to consider begin of a digit */ +-#define DTMF_HITS_TO_BEGIN 4 ++#define DTMF_HITS_TO_BEGIN 2 + /* How many successive misses needed to consider end of a digit */ +-#define DTMF_MISSES_TO_END 4 ++#define DTMF_MISSES_TO_END 3 + + /*! + * \brief The default silence threshold we will use if an alternate +@@ -353,7 +353,7 @@ typedef struct { + } fragment_t; + + /* Note on tone suppression (squelching). Individual detectors (DTMF/MF/generic tone) +- * report fragmens of the frame in which detected tone resides and which needs ++ * report fragments of the frame in which detected tone resides and which needs + * to be "muted" in order to suppress the tone. To mark fragment for muting, + * detectors call mute_fragment passing fragment_t there. Multiple fragments + * can be marked and ast_dsp_process later will mute all of them. +@@ -437,7 +437,7 @@ static void ast_tone_detect_init(tone_detect_state_t *s, int freq, int duration, + s->block_size = periods_in_block * sample_rate / freq; + + /* tone_detect is currently only used to detect fax tones and we +- do not need suqlching the fax tones */ ++ do not need squelching the fax tones */ + s->squelch = 0; + + /* Account for the first and the last block to be incomplete +@@ -549,7 +549,7 @@ static int tone_detect(struct ast_dsp *dsp, tone_detect_state_t *s, int16_t *amp + + for (i = limit, ptr = amp ; i > 0; i--, ptr++) { + samp = *ptr; +- /* signed 32 bit int should be enough to suqare any possible signed 16 bit value */ ++ /* signed 32 bit int should be enough to square any possible signed 16 bit value */ + s->energy += (int32_t) samp * (int32_t) samp; + + goertzel_sample(&s->tone, samp); +@@ -726,39 +726,90 @@ static int dtmf_detect(struct ast_dsp *dsp, digit_detect_state_t *s, int16_t amp + } + } + +- if (hit == s->td.dtmf.lasthit) { +- if (s->td.dtmf.current_hit) { +- /* We are in the middle of a digit already */ +- if (hit) { +- if (hit != s->td.dtmf.current_hit) { +- /* Look for a start of a new digit. +- This is because hits_to_begin may be smaller than misses_to_end +- and we may find the beginning of new digit before we consider last one ended. */ +- s->td.dtmf.current_hit = 0; +- } else { +- /* Current hit was same as last, so increment digit duration (of last digit) */ +- s->digitlen[s->current_digits - 1] += DTMF_GSIZE; +- } +- } else { +- /* No Digit */ +- s->td.dtmf.misses++; +- if (s->td.dtmf.misses == s->td.dtmf.misses_to_end) { +- /* There were enough misses to consider digit ended */ +- s->td.dtmf.current_hit = 0; +- } +- } +- } else if (hit) { +- /* Detecting new digit */ +- s->td.dtmf.hits++; +- if (s->td.dtmf.hits == s->td.dtmf.hits_to_begin) { +- store_digit(s, hit); +- s->td.dtmf.current_hit = hit; ++/* ++ * Adapted from ETSI ES 201 235-3 V1.3.1 (2006-03) ++ * (40ms reference is tunable with hits_to_begin and misses_to_end) ++ * each hit/miss is 12.75ms with DTMF_GSIZE at 102 ++ * ++ * Character recognition: When not DRC *(1) and then ++ * Shall exist VSC > 40 ms (hits_to_begin) ++ * May exist 20 ms <= VSC <= 40 ms ++ * Shall not exist VSC < 20 ms ++ * ++ * Character recognition: When DRC and then ++ * Shall cease Not VSC > 40 ms (misses_to_end) ++ * May cease 20 ms >= Not VSC >= 40 ms ++ * Shall not cease Not VSC < 20 ms ++ * ++ * *(1) or optionally a different digit recognition condition ++ * ++ * Legend: VSC The continuous existence of a valid signal condition. ++ * Not VSC The continuous non-existence of valid signal condition. ++ * DRC The existence of digit recognition condition. ++ * Not DRC The non-existence of digit recognition condition. ++ */ ++ ++/* ++ * Example: hits_to_begin=2 misses_to_end=3 ++ * -------A last_hit=A hits=0&1 ++ * ------AA hits=2 current_hit=A misses=0 BEGIN A ++ * -----AA- misses=1 last_hit=' ' hits=0 ++ * ----AA-- misses=2 ++ * ---AA--- misses=3 current_hit=' ' END A ++ * --AA---B last_hit=B hits=0&1 ++ * -AA---BC last_hit=C hits=0&1 ++ * AA---BCC hits=2 current_hit=C misses=0 BEGIN C ++ * A---BCC- misses=1 last_hit=' ' hits=0 ++ * ---BCC-C misses=0 last_hit=C hits=0&1 ++ * --BCC-CC misses=0 ++ * ++ * Example: hits_to_begin=3 misses_to_end=2 ++ * -------A last_hit=A hits=0&1 ++ * ------AA hits=2 ++ * -----AAA hits=3 current_hit=A misses=0 BEGIN A ++ * ----AAAB misses=1 last_hit=B hits=0&1 ++ * ---AAABB misses=2 current_hit=' ' hits=2 END A ++ * --AAABBB hits=3 current_hit=B misses=0 BEGIN B ++ * -AAABBBB misses=0 ++ * ++ * Example: hits_to_begin=2 misses_to_end=2 ++ * -------A last_hit=A hits=0&1 ++ * ------AA hits=2 current_hit=A misses=0 BEGIN A ++ * -----AAB misses=1 hits=0&1 ++ * ----AABB misses=2 current_hit=' ' hits=2 current_hit=B misses=0 BEGIN B ++ * ---AABBB misses=0 ++ */ ++ ++ if (s->td.dtmf.current_hit) { ++ /* We are in the middle of a digit already */ ++ if (hit != s->td.dtmf.current_hit) { ++ s->td.dtmf.misses++; ++ if (s->td.dtmf.misses == s->td.dtmf.misses_to_end) { ++ /* There were enough misses to consider digit ended */ ++ s->td.dtmf.current_hit = 0; + } ++ } else { ++ s->td.dtmf.misses = 0; ++ /* Current hit was same as last, so increment digit duration (of last digit) */ ++ s->digitlen[s->current_digits - 1] += DTMF_GSIZE; + } +- } else { +- s->td.dtmf.hits = 1; +- s->td.dtmf.misses = 1; ++ } ++ ++ /* Look for a start of a new digit no matter if we are already in the middle of some ++ digit or not. This is because hits_to_begin may be smaller than misses_to_end ++ and we may find begin of new digit before we consider last one ended. */ ++ ++ if (hit != s->td.dtmf.lasthit) { + s->td.dtmf.lasthit = hit; ++ s->td.dtmf.hits = 0; ++ } ++ if (hit && hit != s->td.dtmf.current_hit) { ++ s->td.dtmf.hits++; ++ if (s->td.dtmf.hits == s->td.dtmf.hits_to_begin) { ++ store_digit(s, hit); ++ s->td.dtmf.current_hit = hit; ++ s->td.dtmf.misses = 0; ++ } + } + + /* If we had a hit in this block, include it into mute fragment */ diff --git a/main/asterisk/ASTERISK-19610c.patch b/main/asterisk/ASTERISK-19610c.patch new file mode 100644 index 0000000000..7151b80928 --- /dev/null +++ b/main/asterisk/ASTERISK-19610c.patch @@ -0,0 +1,35 @@ +commit 235d08f +Author: alecdavis <alecdavis@f38db490-d61c-443f-a65b-d21fe96a405b> +Date: Wed Sep 5 18:43:12 2012 +0000 + + dsp.c: in ast_mf_detect_init incorrectly sets goertzel samples to 160, should be MF_GSIZE + + Related https://reviewboard.asterisk.org/r/2097/ + ........ + + Merged revisions 372339 from http://svn.asterisk.org/svn/asterisk/branches/1.8 + + + git-svn-id: http://svn.digium.com/svn/asterisk/branches/10@372341 f38db490-d61c-443f-a65b-d21fe96a405b + +diff --git a/main/dsp.c b/main/dsp.c +index 7541650..4272158 100644 +--- a/main/dsp.c ++++ b/main/dsp.c +@@ -312,7 +312,6 @@ static inline void goertzel_sample(goertzel_state_t *s, short sample) + s->chunky++; + s->v3 = s->v3 >> 1; + s->v2 = s->v2 >> 1; +- v1 = v1 >> 1; + } + } + +@@ -502,7 +501,7 @@ static void ast_mf_detect_init (mf_detect_state_t *s, unsigned int sample_rate) + int i; + s->hits[0] = s->hits[1] = s->hits[2] = s->hits[3] = s->hits[4] = 0; + for (i = 0; i < 6; i++) { +- goertzel_init (&s->tone_out[i], mf_tones[i], 160, sample_rate); ++ goertzel_init (&s->tone_out[i], mf_tones[i], MF_SIZE, sample_rate); + } + s->current_sample = 0; + s->current_hit = 0; |