[Asterisk-code-review] res_adsi: Fix major regression caused by media format rearchitecture. (asterisk[18])

N A asteriskteam at digium.com
Wed Dec 7 08:17:04 CST 2022


N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19668 )


Change subject: res_adsi: Fix major regression caused by media format rearchitecture.
......................................................................

res_adsi: Fix major regression caused by media format rearchitecture.

The commit that rearchitected media formats,
a2c912e9972c91973ea66902d217746133f96026 (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
---
M res/res_adsi.c
1 file changed, 31 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/68/19668/1

diff --git a/res/res_adsi.c b/res/res_adsi.c
index f8a2f56..c273c00 100644
--- a/res/res_adsi.c
+++ b/res/res_adsi.c
@@ -157,7 +157,6 @@
 	struct ast_frame outf = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass.format = ast_format_ulaw,
-		.data.ptr = buf,
 	};
 	int amt;
 
@@ -171,6 +170,7 @@
 			*remain = *remain - amt;
 		}
 
+		outf.data.ptr = buf;
 		outf.datalen = amt;
 		outf.samples = amt;
 		if (ast_write(chan, &outf)) {
@@ -211,6 +211,7 @@
 		} else if (remain) {
 			*remain = inf->datalen - amt;
 		}
+		outf.data.ptr = buf;
 		outf.datalen = amt;
 		outf.samples = amt;
 		if (ast_write(chan, &outf)) {
@@ -236,6 +237,7 @@
 
 	if (ast_channel_adsicpe(chan) == AST_ADSI_UNAVAILABLE) {
 		/* Don't bother if we know they don't support ADSI */
+		ast_log(LOG_WARNING, "ADSI is not supported for %s\n", ast_channel_name(chan));
 		errno = ENOSYS;
 		return -1;
 	}
@@ -255,7 +257,7 @@
 			for (;;) {
 				if (((res = ast_waitfor(chan, waittime)) < 1)) {
 					/* Didn't get back DTMF A in time */
-					ast_debug(1, "No ADSI CPE detected (%d)\n", res);
+					ast_verb(4, "No ADSI CPE detected (%d)\n", res);
 					if (!ast_channel_adsicpe(chan)) {
 						ast_channel_adsicpe_set(chan, AST_ADSI_UNAVAILABLE);
 					}
@@ -291,7 +293,7 @@
 				ast_frfree(f);
 			}
 
-			ast_debug(1, "ADSI Compatible CPE Detected\n");
+			ast_verb(4, "ADSI Compatible CPE Detected\n");
 		} else {
 			ast_debug(1, "Already in data mode\n");
 		}

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19668
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: Icdeddf733eda2981c98712d1ac9cddc0db507dbe
Gerrit-Change-Number: 19668
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221207/ef4b85cf/attachment.html>


More information about the asterisk-code-review mailing list