Skip to content

Commit

Permalink
New options to control JBIG fax support
Browse files Browse the repository at this point in the history
JBIG can be controlled with global enable-jbig or channel fax_enable_jbig
options. JBIG support is enabled by default to preserve current
functionality.
  • Loading branch information
pfournier committed Sep 24, 2024
1 parent c402ce1 commit bab2fb7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/mod/applications/mod_spandsp/mod_spandsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ switch_status_t load_configuration(switch_bool_t reload)
spandsp_globals.verbose_log_level = SWITCH_LOG_DEBUG;
spandsp_globals.use_ecm = 1;
spandsp_globals.disable_v17 = 0;
spandsp_globals.enable_jbig = 1;
spandsp_globals.prepend_string = switch_core_strdup(spandsp_globals.config_pool, "fax");
spandsp_globals.spool = switch_core_strdup(spandsp_globals.config_pool, "/tmp");
spandsp_globals.ident = "SpanDSP Fax Ident";
Expand Down Expand Up @@ -602,6 +603,11 @@ switch_status_t load_configuration(switch_bool_t reload)
spandsp_globals.disable_v17 = 1;
else
spandsp_globals.disable_v17 = 0;
} else if (!strcmp(name, "enable-jbig")) {
if (switch_true(value))
spandsp_globals.enable_jbig = 1;
else
spandsp_globals.enable_jbig = 0;
} else if (!strcmp(name, "enable-colour")) {
if (switch_true(value))
spandsp_globals.enable_colour_fax = 1;
Expand Down
1 change: 1 addition & 0 deletions src/mod/applications/mod_spandsp/mod_spandsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct spandsp_globals {
switch_log_level_t verbose_log_level;
short int disable_v17;
short int enable_tep;
short int enable_jbig;
short int enable_colour_fax;
short int enable_image_resizing;
short int enable_colour_to_bilevel;
Expand Down
13 changes: 11 additions & 2 deletions src/mod/applications/mod_spandsp/mod_spandsp_fax.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ struct pvt_s {
int use_ecm;
int disable_v17;
int enable_tep;
int enable_jbig;
int enable_colour_fax;
int enable_image_resizing;
int enable_colour_to_bilevel;
Expand Down Expand Up @@ -983,9 +984,11 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
| T4_RESOLUTION_400_400);
compressions = T4_COMPRESSION_T4_1D
| T4_COMPRESSION_T4_2D
| T4_COMPRESSION_T6
| T4_COMPRESSION_T85
| T4_COMPRESSION_T6;
if (pvt->enable_jbig) {
compressions |= T4_COMPRESSION_T85
| T4_COMPRESSION_T85_L0;
}
if (pvt->enable_colour_fax) {
t30_set_supported_colour_resolutions(t30, T4_RESOLUTION_100_100
| T4_RESOLUTION_200_200
Expand Down Expand Up @@ -1363,6 +1366,12 @@ static pvt_t *pvt_init(switch_core_session_t *session, mod_spandsp_fax_applicati
pvt->disable_v17 = spandsp_globals.disable_v17;
}

if ((tmp = switch_channel_get_variable(channel, "fax_enable_jbig"))) {
pvt->enable_jbig = switch_true(tmp);
} else {
pvt->enable_jbig = spandsp_globals.enable_jbig;
}

if ((tmp = switch_channel_get_variable(channel, "fax_enable_colour"))) {
pvt->enable_colour_fax = switch_true(tmp);
} else {
Expand Down

0 comments on commit bab2fb7

Please sign in to comment.