[Asterisk-code-review] res fax: Handle fax gateway being started more than once. (asterisk[13])

Joshua Colp asteriskteam at digium.com
Thu Aug 30 05:04:30 CDT 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10015 )

Change subject: res_fax: Handle fax gateway being started more than once.
......................................................................

res_fax: Handle fax gateway being started more than once.

The T.38 fax gateway state machine can cause the fax gateway
to be started more than once on a channel depending on the
responses of the remote endpoint. This would previously leak
the channel name, channel unique id, and underlying fax engine
state. This change instead makes it so that if the fax gateway
session is already present and not reserved the fax gateway
is not started again.

ASTERISK-27981

Change-Id: I552d95086860cb18f2522ee40ef47b13b6da2e0e
---
M res/res_fax.c
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/res/res_fax.c b/res/res_fax.c
index 823d560..ce5687d 100644
--- a/res/res_fax.c
+++ b/res/res_fax.c
@@ -2914,6 +2914,11 @@
 	struct ast_fax_session *s;
 	int start_res;
 
+	/* if the fax gateway is already started then do nothing */
+	if (gateway->s && gateway->s->state != AST_FAX_STATE_RESERVED) {
+		return 0;
+	}
+
 	/* create the FAX session */
 	if (!(s = fax_session_new(details, chan, gateway->s, gateway->token))) {
 		gateway->token = NULL;

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I552d95086860cb18f2522ee40ef47b13b6da2e0e
Gerrit-Change-Number: 10015
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180830/09f79e3b/attachment.html>


More information about the asterisk-code-review mailing list