Merge "chan_dahdi.c: Flush the DAHDI write buffer after starting DTMF."

changes/79/1079/1
Mark Michelson 10 years ago committed by Gerrit Code Review
commit 318b97fd1e

@ -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:

Loading…
Cancel
Save