]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_fax: add FAXMODE variable 58/2758/1
authorAlexei Gradinari <alex2grad@gmail.com>
Mon, 2 May 2016 21:08:06 +0000 (17:08 -0400)
committerAlexei Gradinari <alex2grad@gmail.com>
Wed, 4 May 2016 14:37:15 +0000 (09:37 -0500)
The app_fax set FAXMODE variable, but res_fax missing this feature.
This patch add FAXMODE variable which is set to either "audio" or "T38".

ASTERISK-25980

Change-Id: Ie3dcbfb72cc681e9e267a60202f7fb8723a51b6b

CHANGES
res/res_fax.c

diff --git a/CHANGES b/CHANGES
index 8d1e339d6144888df170f8f5f84ffde81429d6d0..255ccd24accd325db874f235da7c3c5b9976e445 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -275,6 +275,11 @@ Queue
 --- Functionality changes from Asterisk 13.9.0 to Asterisk 13.10.0 -----------
 ------------------------------------------------------------------------------
 
+res_fax
+------------------
+ * Added FAXMODE variable to let dialplan know what fax transport was used.
+   FAXMODE variable is set to either "audio" or "T38".
+
 res_pjsip
 ------------------
  * Added new status Updated to AMI event ContactStatus on update registration
index f171af92a9348acc7f4a8424833548566fd3dfab..33c3f116b9045a14667760c4d058cda4676b41de 100644 (file)
@@ -1447,6 +1447,12 @@ static void set_channel_variables(struct ast_channel *chan, struct ast_fax_sessi
        pbx_builtin_setvar_helper(chan, "FAXBITRATE", S_OR(details->transfer_rate, NULL));
        pbx_builtin_setvar_helper(chan, "FAXRESOLUTION", S_OR(details->resolution, NULL));
 
+       if (ast_channel_get_t38_state(chan) == T38_STATE_NEGOTIATED) {
+               pbx_builtin_setvar_helper(chan, "FAXMODE", "T38");
+       } else {
+               pbx_builtin_setvar_helper(chan, "FAXMODE", "audio");
+       }
+
        snprintf(buf, sizeof(buf), "%u", details->pages_transferred);
        pbx_builtin_setvar_helper(chan, "FAXPAGES", buf);
 }
@@ -2071,6 +2077,7 @@ static int receivefax_exec(struct ast_channel *chan, const char *data)
        pbx_builtin_setvar_helper(chan, "FAXPAGES", "0");
        pbx_builtin_setvar_helper(chan, "FAXBITRATE", NULL);
        pbx_builtin_setvar_helper(chan, "FAXRESOLUTION", NULL);
+       pbx_builtin_setvar_helper(chan, "FAXMODE", NULL);
 
        /* Get a FAX session details structure from the channel's FAX datastore and create one if
         * it does not already exist. */
@@ -2578,6 +2585,7 @@ static int sendfax_exec(struct ast_channel *chan, const char *data)
        pbx_builtin_setvar_helper(chan, "FAXPAGES", "0");
        pbx_builtin_setvar_helper(chan, "FAXBITRATE", NULL);
        pbx_builtin_setvar_helper(chan, "FAXRESOLUTION", NULL);
+       pbx_builtin_setvar_helper(chan, "FAXMODE", NULL);
 
        /* Get a requirement structure and set it.  This structure is used
         * to tell the FAX technology module about the higher level FAX session */