[asterisk-dev] [Code Review] refactor dsp.c that can no longer detect a quick DTMF sequence.

Alec Davis reviewboard at asterisk.org
Sun Aug 26 02:20:53 CDT 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2084/
-----------------------------------------------------------

(Updated Aug. 26, 2012, 2:20 a.m.)


Review request for Asterisk Developers, rmudgett and Jason Parker.


Changes
-------

After documenting, DTMF events, before and after this patch, the existing code works well.
Except to handle fast DTMF;
  DTMF_HITS_TO_BEGIN needs to be changed to 3.
  DTMF_MISSES_TO_END needs to be changed to 2.

History:

The DTMF_HITS_TO_BEGIN and DTMF_MISSES_TO_END and other variables were added to handle GSM issues. 
https://issues.asterisk.org/view.php?id=11968
"These will allow people easily patch the code and have reliable DTMF recognition in cases where signal is wobbling (like when GSM phone calls in). Increasing DTMF_MISSES_TO_END to 4-6 will allow DSP code to ignore long "dropouts" of DTMF within digit without ending it. "

There is one improvement to existing code, in the case where 'no interdigit pause' is received.
Hits should be incremented as current_hit is set to 0


Summary (updated)
-------

Use a simpler method to detect changes in DTMF ON/OFF tones.

Similar method to latest spandsp/dtmf.c

   We must detect 2 silences for DTMF END.


Reverts some of 111022 that added DTMF_HITS_TO_BEGIN and DTMF_MISSES_TO_END

Exisiting dtmf events with;
/* hits_to_begin = 3, misses to end = 2 */
/* --------A    hits=1, misses=1, lasthit='A'
 * -------AA    hits=2
 * ------AAA    hits=3, store_digit, current_hit='A',	BEGIN A
 * -----AAA-    hits=1, misses=1, lasthit=' '
 * ----AAA--    misses=2, current_hit=' ', 		END A
 * ---AAA--B    hits=1, misses=1, lasthit='B'
 * --AAA--BB    hits=2
 * -AAA--BBB    hits=3, store_digit, current_hit='B',	BEGIN B
 * AAA--BBB-    hits=1, misses=1, lasthit=' '
 * AA--BBB-B    hits=1, misses=1, lasthit='B'
 * A--BBB-BB    digitlen += GSIZE
 *              deal with an interruption
 * --BBB-BB-    hits=1, misses=1, lasthit=' '
 * -BBB-BB-B    hits=1, misses=1, lasthit='B'
 * BBB-BB-BB    digitlen += GSIZE
 *              deal with no interdigit pause
 * BB-BB-BBC    hits=1, misses=1, lasthit='C'
 * B-BB-BBCC    current_hit=' ',			END B
 * -BB-BBCCC    hits=2
 * BB-BBCCCC    hits=3, store_digit, current_hit='C',	BEGIN C
 */


How it would be without, hits_to_begin, and misses_to_end

/*  ------AA    Begin A
 *  -----AA-    no change
 *  ----AA--    End A
 *  ---AA--B    no change
 *  --AA--BC    no change
 *  -AA--BCC    Start C
 *  AA--BCCD    no change
 *  A--BCCDD    Start D
 *  --BCCDD-    no change
 *  -BCCDD-E    no change
 *  BCCDD-EE    Start E
 *  CCDD-EE-    no change
 *  CDD-EE-F    no change
 *  DD-EE-F-    no change
 *  D-EE-F--    End E
 */


This addresses bugs ASTERISK-17493 and ASTERISK-19610.
    https://issues.asterisk.org/jira/browse/ASTERISK-17493
    https://issues.asterisk.org/jira/browse/ASTERISK-19610


Diffs
-----

  trunk/main/dsp.c 371649 

Diff: https://reviewboard.asterisk.org/r/2084/diff


Testing
-------


Thanks,

Alec

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120826/6a73cbc2/attachment.htm>


More information about the asterisk-dev mailing list