]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_fax: Fix a tight race condition causing fax to crash in audio fallback 01/4001/3
authorTorrey Searle <torrey@voxbone.com>
Thu, 29 Sep 2016 18:08:07 +0000 (20:08 +0200)
committerJoshua Colp <jcolp@digium.com>
Tue, 11 Oct 2016 18:57:42 +0000 (13:57 -0500)
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

res/res_fax.c

index 833a3c8eec25233bff751b9178c73e4d4c1e6e25..0636540398fc95b90df6eef093ef0d0956c66895 100644 (file)
@@ -1344,6 +1344,13 @@ static int generic_fax_exec(struct ast_channel *chan, struct ast_fax_session_det
        ast_format_clear(&orig_read_format);
        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");