diff options
author | Torrey Searle <torrey@voxbone.com> | 2016-09-29 20:08:07 +0200 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-10-12 06:54:02 -0500 |
commit | 8d2d6361ff12fa81822b85c045100e4a4ab3a3d9 (patch) | |
tree | 7c37cd95e9a7cddf486a23952e61118aabf94f23 /res | |
parent | 07a84b39feeeb72886d7c9df6a0743edd7d8b41c (diff) |
res_fax: Fix a tight race condition causing fax to crash in audio fallback
When T.38 gets rejected and G711 failback occurs there is a period of
time where neither AST_FAX_TECH_T38 nor AST_FAX_TECH_AUDIO is set,
leading to a crash.
Change-Id: Icc3f457b2292d48a9d7843dac0028347420cc982
Diffstat (limited to 'res')
-rw-r--r-- | res/res_fax.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/res/res_fax.c b/res/res_fax.c index a2e179323..b97f3eb29 100644 --- a/res/res_fax.c +++ b/res/res_fax.c @@ -1600,6 +1600,13 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det chancount = 1; + /* Make sure one or the other is set to avoid race condition */ + if (t38negotiated) { + details->caps |= AST_FAX_TECH_T38; + } else { + details->caps |= AST_FAX_TECH_AUDIO; + } + /* create the FAX session */ if (!(fax = fax_session_new(details, chan, reserved, token))) { ast_log(LOG_ERROR, "Can't create a FAX session, FAX attempt failed.\n"); |