Review Board 1.7.16


DTMF emulation bad calculation that hurts RTP

Review Request #3546 - Created May 16, 2014 and updated

Olle E Johansson
1.8
ASTERISK-23747
Reviewers
asterisk-dev
Asterisk
This code in channel.c is wrong. It first checks if we have a length. If not, we set it to a measured time, which is fine.

If we have a length and it's under the minimum DTMF duration, we set it again to the measured time. In an RTP session, the duration can be under minimum, but has no relationship to the measured time between DTMF start and end. We should keep the given RTP DTMF time and use that for emulation. I have had DTMF that was extended by up to 60 ms because of this code and that really, really broke communication for these alarm panels that send many short DTMF tones.

I suggest that this fix goes into 1.8 and later revisions.
Hours and hours of reading DTMF logs. Countless cups of tea. A gazillion milliseconds wasted. All tested in 1.8.

Diff revision 1 (Latest)

  1. /trunk/main/channel.c: Loading...
/trunk/main/channel.c
Revision 414046 New Change
[20] 4070 lines
[+20] [+] static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
4071
					 * to the actual duration of the DTMF
4071
					 * to the actual duration of the DTMF
4072
					 * frames on the wire.  This will cause
4072
					 * frames on the wire.  This will cause
4073
					 * dtmf emulation to be triggered later
4073
					 * dtmf emulation to be triggered later
4074
					 * on.
4074
					 * on.
4075
					 */
4075
					 */
4076
					if (ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan)) < option_dtmfminduration) {
4076
					if (f->len < option_dtmfminduration) {
4077
						f->len = ast_tvdiff_ms(now, *ast_channel_dtmf_tv(chan));

   
4078
						ast_log(LOG_DTMF, "DTMF end '%c' detected to have actual duration %ld on the wire, emulation will be triggered on %s\n", f->subclass.integer, f->len, ast_channel_name(chan));
4077
						ast_log(LOG_DTMF, "DTMF end '%c' detected to have actual duration %ld on the wire, emulation will be triggered on %s\n", f->subclass.integer, f->len, ast_channel_name(chan));
4079
					}
4078
					}
4080
				} else if (!f->len) {
4079
				} else if (!f->len) {
4081
					ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
4080
					ast_log(LOG_DTMF, "DTMF end accepted without begin '%c' on %s\n", f->subclass.integer, ast_channel_name(chan));
4082
					f->len = option_dtmfminduration;
4081
					f->len = option_dtmfminduration;
[+20] [20] 6364 lines
  1. /trunk/main/channel.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.