diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-09-09 20:11:06 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-09-09 20:11:06 +0000 |
commit | 887b08e13877733a0232f0f56c8e3e188c8662d8 (patch) | |
tree | b2ff17577f730bb5947bfe9bdce8c31429d6a78d /main | |
parent | 722eb3c4c3cfa1c0cee915c949c5f95199ee24dd (diff) |
Merged revisions 285744 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r285744 | qwell | 2010-09-09 15:09:23 -0500 (Thu, 09 Sep 2010) | 16 lines
Merged revisions 285742 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r285742 | qwell | 2010-09-09 15:06:31 -0500 (Thu, 09 Sep 2010) | 9 lines
Transmit silence when reading DTMF in ast_readstring.
Otherwise, you could get issues with DTMF timeouts causing hangups.
(closes issue #17370)
Reported by: makoto
Patches:
channel-readstring-silence-generator.patch uploaded by makoto (license 38)
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@285745 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/channel.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c index c0a37aaa6..5834410ca 100644 --- a/main/channel.c +++ b/main/channel.c @@ -5368,6 +5368,8 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in int pos = 0; /* index in the buffer where we accumulate digits */ int to = ftimeout; + struct ast_silence_generator *silgen = NULL; + /* Stop if we're a zombie or need a soft hangup */ if (ast_test_flag(c, AST_FLAG_ZOMBIE) || ast_check_hangup(c)) return -1; @@ -5378,24 +5380,33 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in if (c->stream) { d = ast_waitstream_full(c, AST_DIGIT_ANY, audiofd, ctrlfd); ast_stopstream(c); + if (!silgen && ast_opt_transmit_silence) + silgen = ast_channel_start_silence_generator(c); usleep(1000); if (!d) d = ast_waitfordigit_full(c, to, audiofd, ctrlfd); } else { + if (!silgen && ast_opt_transmit_silence) + silgen = ast_channel_start_silence_generator(c); d = ast_waitfordigit_full(c, to, audiofd, ctrlfd); } - if (d < 0) + if (d < 0) { + ast_channel_stop_silence_generator(c, silgen); return AST_GETDATA_FAILED; + } if (d == 0) { s[pos] = '\0'; + ast_channel_stop_silence_generator(c, silgen); return AST_GETDATA_TIMEOUT; } if (d == 1) { s[pos] = '\0'; + ast_channel_stop_silence_generator(c, silgen); return AST_GETDATA_INTERRUPTED; } if (strchr(enders, d) && (pos == 0)) { s[pos] = '\0'; + ast_channel_stop_silence_generator(c, silgen); return AST_GETDATA_EMPTY_END_TERMINATED; } if (!strchr(enders, d)) { @@ -5403,6 +5414,7 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in } if (strchr(enders, d) || (pos >= len)) { s[pos] = '\0'; + ast_channel_stop_silence_generator(c, silgen); return AST_GETDATA_COMPLETE; } to = timeout; |