FS-3724 2 ways to fix after updating to this version, 1) run set_zombie_exec in the dp; 2) use system_on_fax_success/system_on_fax_failure vars with explicit name of your command

This commit is contained in:
Anthony Minessale 2011-11-28 16:45:59 -06:00
parent ead7c770bd
commit 12f2bdf66a
3 changed files with 30 additions and 3 deletions

View File

@ -4140,7 +4140,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>",
SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>",
SAF_SUPPORT_NOMEDIA);
SAF_SUPPORT_NOMEDIA | SAF_ZOMBIE_EXEC);
SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE);
SWITCH_ADD_APP(app_interface, "wait_for_silence", "wait_for_silence", "wait_for_silence", wait_for_silence_function, WAIT_FOR_SILENCE_SYNTAX,

View File

@ -316,6 +316,8 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
char *fax_transfer_rate = NULL;
char *fax_result_code = NULL;
switch_event_t *event;
const char *var;
char *expanded;
pvt = (pvt_t *) user_data;
switch_assert(pvt);
@ -432,14 +434,36 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
switch_event_fire(&event);
}
if ((var = switch_channel_get_variable(channel, "system_on_fax_result"))) {
expanded = switch_channel_expand_variables(channel, var);
switch_system(expanded, SWITCH_FALSE);
if (expanded != var) {
free(expanded);
}
}
switch_channel_execute_on(channel, "execute_on_fax_result");
if (result == T30_ERR_OK) {
if ((var = switch_channel_get_variable(channel, "system_on_fax_success"))) {
expanded = switch_channel_expand_variables(channel, var);
switch_system(expanded, SWITCH_FALSE);
if (expanded != var) {
free(expanded);
}
}
switch_channel_execute_on(channel, "execute_on_fax_success");
} else {
if ((var = switch_channel_get_variable(channel, "system_on_fax_failure"))) {
expanded = switch_channel_expand_variables(channel, var);
switch_system(expanded, SWITCH_FALSE);
if (expanded != var) {
free(expanded);
}
}
switch_channel_execute_on(channel, "execute_on_fax_failure");
}
}
static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)

View File

@ -2408,6 +2408,7 @@ static int max_open(void)
static int switch_system_fork(const char *cmd, switch_bool_t wait)
{
int pid;
char *dcmd = strdup(cmd);
switch_core_set_signal_handlers();
@ -2417,6 +2418,7 @@ static int switch_system_fork(const char *cmd, switch_bool_t wait)
if (wait) {
waitpid(pid, NULL, 0);
}
free(dcmd);
} else {
int open_max = max_open();
int i;
@ -2426,7 +2428,8 @@ static int switch_system_fork(const char *cmd, switch_bool_t wait)
}
set_low_priority();
i = system(cmd);
i = system(dcmd);
free(dcmd);
exit(0);
}