[Asterisk-code-review] say: Abort play loop if caller hangs up. (asterisk[master])

Friendly Automation asteriskteam at digium.com
Thu Jun 30 16:25:08 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18575 )

Change subject: say: Abort play loop if caller hangs up.
......................................................................

say: Abort play loop if caller hangs up.

If the caller has hung up, break out of the play loop so we don't try
to play remaining files and fail to do so.

ASTERISK-30075 #close

Change-Id: I55e85be28ee90b48c0fe4ce20ac136a7dbb49f14
---
M main/say.c
1 file changed, 3 insertions(+), 9 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit



diff --git a/main/say.c b/main/say.c
index 8fb5e97..b60d4bf 100644
--- a/main/say.c
+++ b/main/say.c
@@ -189,19 +189,13 @@
 
 	files = ast_str_buffer(filenames);
 
-	while ((fn = strsep(&files, "&"))) {
+	while (!res && (fn = strsep(&files, "&"))) {
 		res = ast_streamfile(chan, fn, lang);
 		if (!res) {
-			if ((audiofd  > -1) && (ctrlfd > -1))
+			if ((audiofd  > -1) && (ctrlfd > -1)) {
 				res = ast_waitstream_full(chan, ints, audiofd, ctrlfd);
-			else
+			} else {
 				res = ast_waitstream(chan, ints);
-
-			if (res > 0) {
-				/* We were interrupted by a digit */
-				ast_stopstream(chan);
-				ast_free(filenames);
-				return res;
 			}
 		}
 		ast_stopstream(chan);

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I55e85be28ee90b48c0fe4ce20ac136a7dbb49f14
Gerrit-Change-Number: 18575
Gerrit-PatchSet: 4
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-CC: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220630/ce73baf1/attachment.html>


More information about the asterisk-code-review mailing list