Skip to content
Snippets Groups Projects
Commit 318b97fd authored by Mark Michelson's avatar Mark Michelson Committed by Gerrit Code Review
Browse files

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

parents 1aa722b3 87c92d2a
Branches
Tags
No related merge requests found
...@@ -4198,7 +4198,7 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit) ...@@ -4198,7 +4198,7 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit)
{ {
struct dahdi_pvt *pvt; struct dahdi_pvt *pvt;
int idx; int idx;
int dtmf = -1; int dtmf;
int res; int res;
   
pvt = ast_channel_tech_pvt(chan); pvt = ast_channel_tech_pvt(chan);
...@@ -4221,8 +4221,11 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit) ...@@ -4221,8 +4221,11 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit)
break; break;
} }
#endif #endif
if ((dtmf = digit_to_dtmfindex(digit)) == -1) dtmf = digit_to_dtmfindex(digit);
if (dtmf == -1) {
/* Not a valid DTMF digit */
goto out; goto out;
}
   
if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &dtmf)) { if (pvt->pulse || ioctl(pvt->subs[SUB_REAL].dfd, DAHDI_SENDTONE, &dtmf)) {
char dial_str[] = { 'T', digit, '\0' }; char dial_str[] = { 'T', digit, '\0' };
...@@ -4232,10 +4235,19 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit) ...@@ -4232,10 +4235,19 @@ static int dahdi_digit_begin(struct ast_channel *chan, char digit)
pvt->dialing = 1; pvt->dialing = 1;
} }
} else { } else {
ast_debug(1, "Channel %s started VLDTMF digit '%c'\n",
ast_channel_name(chan), digit);
pvt->dialing = 1; pvt->dialing = 1;
pvt->begindigit = digit; 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: out:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment