add execute_on_fax_success, execute_on_fax_failure and execute_on_fax_result channel variables to trigger an app or lua script when a fax result is received

This commit is contained in:
Anthony Minessale 2011-06-29 18:22:57 -05:00
parent f8c029a191
commit 79e9f19cb9

View File

@ -341,6 +341,7 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax successfully managed. How ?\n");
}
switch_channel_set_variable(channel, "fax_success", "1");
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Fax processing not successful - result (%d) %s.\n", result,
t30_completion_code_to_str(result));
@ -430,6 +431,15 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-station-id", far_ident);
switch_event_fire(&event);
}
switch_channel_execute_on(channel, "execute_on_fax_result");
if (result == T30_ERR_OK) {
switch_channel_execute_on(channel, "execute_on_fax_success");
} else {
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)