Compare commits

...

3 Commits

Author SHA1 Message Date
Patrice Fournier 1d7b41dc81
Merge bab2fb7f24 into 5cb74797fe 2025-01-17 16:41:27 +00:00
Aron Podrigal 5cb74797fe
[mod_pgsql] err is now set correctly (dbh:last_error())
New function, `void pgsql_handle_set_error_if_not_set(switch_pgsql_handle_t *handle, char **err)` has been added to mod_pgsql module. This function is now called at several points where an error occurred but *err was not yet set.
2025-01-17 18:51:45 +03:00
Patrice Fournier bab2fb7f24 New options to control JBIG fax support
JBIG can be controlled with global enable-jbig or channel fax_enable_jbig
options. JBIG support is enabled by default to preserve current
functionality.
2024-09-24 10:58:56 -04:00
4 changed files with 46 additions and 3 deletions

View File

@ -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";
@ -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;

View File

@ -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;

View File

@ -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;
@ -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
@ -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 {

View File

@ -106,6 +106,22 @@ char * pgsql_handle_get_error(switch_pgsql_handle_t *handle)
return err_str;
}
void pgsql_handle_set_error_if_not_set(switch_pgsql_handle_t *handle, char **err)
{
char *err_str;
if (err && !(*err)) {
err_str = pgsql_handle_get_error(handle);
if (zstr(err_str)) {
switch_safe_free(err_str);
err_str = strdup((char *)"SQL ERROR!");
}
*err = err_str;
}
}
static int db_is_up(switch_pgsql_handle_t *handle)
{
int ret = 0;
@ -553,8 +569,15 @@ switch_status_t pgsql_handle_exec_detailed(const char *file, const char *func, i
goto error;
}
return pgsql_finish_results(handle);
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
goto error;
}
return SWITCH_STATUS_SUCCESS;
error:
pgsql_handle_set_error_if_not_set(handle, err);
return SWITCH_STATUS_FALSE;
}
@ -630,6 +653,7 @@ done:
pgsql_free_result(&result);
if (pgsql_finish_results(handle) != SWITCH_STATUS_SUCCESS) {
pgsql_handle_set_error_if_not_set(handle, err);
sstatus = SWITCH_STATUS_FALSE;
}
@ -638,6 +662,7 @@ done:
error:
pgsql_free_result(&result);
pgsql_handle_set_error_if_not_set(handle, err);
return SWITCH_STATUS_FALSE;
}
@ -1050,6 +1075,8 @@ switch_status_t pgsql_handle_callback_exec_detailed(const char *file, const char
return SWITCH_STATUS_SUCCESS;
error:
pgsql_handle_set_error_if_not_set(handle, err);
return SWITCH_STATUS_FALSE;
}