Skip to content

Commit 2b0f87c

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
res_adsi: Fix major regression caused by media format rearchitecture.
The commit that rearchitected media formats, a2c912e (ASTERISK_23114) introduced a regression by improperly translating code in res_adsi.c. In particular, the pointer to the frame buffer was initialized at the top of adsi_careful_send, rather than dynamically updating it for each frame, as is required. This resulted in the first frame being repeatedly sent, rather than advancing through the frames. This corrupted the transmission of the CAS to the CPE, which meant that CPE would never respond with the DTMF acknowledgment, effectively completely breaking ADSI functionality. This issue is now fixed, and ADSI now works properly again. ASTERISK-29793 #close Change-Id: Icdeddf733eda2981c98712d1ac9cddc0db507dbe
1 parent f37194e commit 2b0f87c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

res/res_adsi.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int l
157157
struct ast_frame outf = {
158158
.frametype = AST_FRAME_VOICE,
159159
.subclass.format = ast_format_ulaw,
160-
.data.ptr = buf,
161160
};
162161
int amt;
163162

@@ -171,6 +170,7 @@ static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int l
171170
*remain = *remain - amt;
172171
}
173172

173+
outf.data.ptr = buf;
174174
outf.datalen = amt;
175175
outf.samples = amt;
176176
if (ast_write(chan, &outf)) {
@@ -211,6 +211,7 @@ static int adsi_careful_send(struct ast_channel *chan, unsigned char *buf, int l
211211
} else if (remain) {
212212
*remain = inf->datalen - amt;
213213
}
214+
outf.data.ptr = buf;
214215
outf.datalen = amt;
215216
outf.samples = amt;
216217
if (ast_write(chan, &outf)) {
@@ -236,6 +237,7 @@ static int __adsi_transmit_messages(struct ast_channel *chan, unsigned char **ms
236237

237238
if (ast_channel_adsicpe(chan) == AST_ADSI_UNAVAILABLE) {
238239
/* Don't bother if we know they don't support ADSI */
240+
ast_log(LOG_WARNING, "ADSI is not supported for %s\n", ast_channel_name(chan));
239241
errno = ENOSYS;
240242
return -1;
241243
}
@@ -255,7 +257,7 @@ static int __adsi_transmit_messages(struct ast_channel *chan, unsigned char **ms
255257
for (;;) {
256258
if (((res = ast_waitfor(chan, waittime)) < 1)) {
257259
/* Didn't get back DTMF A in time */
258-
ast_debug(1, "No ADSI CPE detected (%d)\n", res);
260+
ast_verb(4, "No ADSI CPE detected (%d)\n", res);
259261
if (!ast_channel_adsicpe(chan)) {
260262
ast_channel_adsicpe_set(chan, AST_ADSI_UNAVAILABLE);
261263
}
@@ -291,7 +293,7 @@ static int __adsi_transmit_messages(struct ast_channel *chan, unsigned char **ms
291293
ast_frfree(f);
292294
}
293295

294-
ast_debug(1, "ADSI Compatible CPE Detected\n");
296+
ast_verb(4, "ADSI Compatible CPE Detected\n");
295297
} else {
296298
ast_debug(1, "Already in data mode\n");
297299
}

0 commit comments

Comments
 (0)