summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-08-12 13:37:14 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-08-12 13:37:14 -0500
commit318b97fd1e1a19fb3a03b3e7934ced74321adfb8 (patch)
tree2e4a1add09513c53f47cb11fe30781c88051cae8
parent1aa722b3ce6371e1bffb96ba15b351f37f592496 (diff)
parent87c92d2aee60cc3396f0ccab64801e41b37dd33d (diff)
Merge "chan_dahdi.c: Flush the DAHDI write buffer after starting DTMF."
-rw-r--r--channels/chan_dahdi.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index fe613097c..ac159527b 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -4198,7 +4198,7 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit)
{
struct dahdi_pvt *pvt;
int idx;
- int dtmf = -1;
+ int dtmf;
int res;
pvt = ast_channel_tech_pvt(chan);
@@ -4221,8 +4221,11 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit)
break;
}
#endif
- if ((dtmf = digit_to_dtmfindex(digit)) == -1)
+ dtmf = digit_to_dtmfindex(digit);
+ if (dtmf == -1) {
+ /* Not a valid DTMF digit */
goto out;
+ }
if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &dtmf)) {
char dial_str[] = { 'T', digit, '\0' };
@@ -4232,10 +4235,19 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit)
pvt->dialing = 1;
}
} else {
- ast_debug(1, "Channel %s started VLDTMF digit '%c'\n",
- ast_channel_name(chan), digit);
pvt->dialing = 1;
pvt->begindigit = digit;
+
+ /* Flush the write buffer in DAHDI to start sending the digit immediately. */
+ dtmf = DAHDI_FLUSH_WRITE;
+ res = ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_FLUSH, &dtmf);
+ if (res) {
+ ast_log(LOG_WARNING, "Unable to flush the DAHDI write buffer to send DTMF on channel %d: %s\n",
+ pvt->channel, strerror(errno));
+ }
+
+ ast_debug(1, "Channel %s started VLDTMF digit '%c'\n",
+ ast_channel_name(chan), digit);
}
out: