[Asterisk-code-review] res_fax: Don't consume frames given to fax gateway on write. (asterisk[17])

Friendly Automation asteriskteam at digium.com
Fri Jun 5 13:19:42 CDT 2020


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

Change subject: res_fax: Don't consume frames given to fax gateway on write.
......................................................................

res_fax: Don't consume frames given to fax gateway on write.

In a particular fax gateway scenario whereby it would
have to translate using the read translation path on a
channel the frame being translated would be consumed.
When the frame is in the write path it is not permitted
to free the frame as the caller expects it to continue
to exist.

This change makes it so that the frame is only consumed
on the read path where it is acceptable to free it.

ASTERISK-28900

Change-Id: I011c321288a1b056d92b37c85e229f4a28ee737d
---
M res/res_fax.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit



diff --git a/res/res_fax.c b/res/res_fax.c
index ebb2b46..b895c57 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -3568,7 +3568,7 @@
 		 * translation is done, so we need to translate here */
 		if ((f->frametype == AST_FRAME_VOICE) && (ast_format_cmp(f->subclass.format, ast_format_slin) != AST_FORMAT_CMP_EQUAL)
 			&& (readtrans = ast_channel_readtrans(active))) {
-			if ((f = ast_translate(readtrans, f, 1)) == NULL) {
+			if ((f = ast_translate(readtrans, f, event == AST_FRAMEHOOK_EVENT_WRITE ? 0 : 1)) == NULL) {
 				f = &ast_null_frame;
 				return f;
 			}

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

Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: I011c321288a1b056d92b37c85e229f4a28ee737d
Gerrit-Change-Number: 14483
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200605/e385a4b0/attachment-0001.html>


More information about the asterisk-code-review mailing list