提交 38abcf7e authored 作者: Steve Underwood's avatar Steve Underwood

The APIs for spandsp FAX have changes, removing one of the parameters passed in

the callbacks.
上级 9db6d5ba
......@@ -153,43 +153,38 @@ typedef struct t30_state_s t30_state_t;
can access whatever additional information might have been received, using
t30_get_received_info().
\brief T.30 phase B callback handler.
\param s The T.30 context.
\param user_data An opaque pointer.
\param result The phase B event code.
\return The new status. Normally, T30_ERR_OK is returned.
*/
typedef int (*t30_phase_b_handler_t)(t30_state_t *s, void *user_data, int result);
typedef int (*t30_phase_b_handler_t)(void *user_data, int result);
/*!
T.30 phase D callback handler.
\brief T.30 phase D callback handler.
\param s The T.30 context.
\param user_data An opaque pointer.
\param result The phase D event code.
\return The new status. Normally, T30_ERR_OK is returned.
*/
typedef int (*t30_phase_d_handler_t)(t30_state_t *s, void *user_data, int result);
typedef int (*t30_phase_d_handler_t)(void *user_data, int result);
/*!
T.30 phase E callback handler.
\brief T.30 phase E callback handler.
\param s The T.30 context.
\param user_data An opaque pointer.
\param completion_code The phase E completion code.
*/
typedef void (*t30_phase_e_handler_t)(t30_state_t *s, void *user_data, int completion_code);
typedef void (*t30_phase_e_handler_t)(void *user_data, int completion_code);
/*!
T.30 real time frame handler.
\brief T.30 real time frame handler.
\param s The T.30 context.
\param user_data An opaque pointer.
\param incoming True for incoming, false for outgoing.
\param msg The HDLC message.
\param len The length of the message.
*/
typedef void (*t30_real_time_frame_handler_t)(t30_state_t *s,
void *user_data,
typedef void (*t30_real_time_frame_handler_t)(void *user_data,
bool direction,
const uint8_t msg[],
int len);
......@@ -197,11 +192,10 @@ typedef void (*t30_real_time_frame_handler_t)(t30_state_t *s,
/*!
T.30 document handler.
\brief T.30 document handler.
\param s The T.30 context.
\param user_data An opaque pointer.
\param result The document event code.
*/
typedef int (*t30_document_handler_t)(t30_state_t *s, void *user_data, int status);
typedef int (*t30_document_handler_t)(void *user_data, int status);
/*!
T.30 set a receive or transmit type handler.
......
差异被折叠。
......@@ -98,7 +98,13 @@ enum
{
AUDIO_FAX,
T38_TERMINAL_FAX,
T38_GATEWAY_FAX
T38_GATEWAY_FAX,
T31_AUDIO_FAX,
T31_T38_TERMINAL_FAX,
T31_T38_GATEWAY_FAX,
TSB85_AUDIO_FAX,
TSB85_T38_TERMINAL_FAX,
TSB85_T38_GATEWAY_FAX
};
int mode[2] = {AUDIO_FAX, AUDIO_FAX};
......@@ -127,17 +133,19 @@ bool succeeded[2] = {false, false};
bool t38_simulate_incrementing_repeats = false;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_b_handler(void *user_data, int result)
{
int i;
int ch;
int status;
int len;
t30_state_t *s;
char tag[20];
const char *u;
const uint8_t *v;
i = (int) (intptr_t) user_data;
s = t30_state[i];
ch = i + 'A';
snprintf(tag, sizeof(tag), "%c: Phase B", ch);
printf("%c: Phase B handler - (0x%X) %s\n", ch, result, t30_frametype(result));
......@@ -296,14 +304,18 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
}
/*- End of function --------------------------------------------------------*/
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D", i + 'A');
printf("%c: Phase D handler - (0x%X) %s\n", i + 'A', result, t30_frametype(result));
s = t30_state[i];
ch = i + 'A';
snprintf(tag, sizeof(tag), "%c: Phase D", ch);
printf("%c: Phase D handler - (0x%X) %s\n", ch, result, t30_frametype(result));
fax_log_page_transfer_statistics(s, tag);
fax_log_tx_parameters(s, tag);
fax_log_rx_parameters(s, tag);
......@@ -313,9 +325,9 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int result)
if (test_local_interrupt)
{
if (i == 'A')
if (i == 0)
{
printf("%c: Initiating interrupt request\n", i);
printf("%c: Initiating interrupt request\n", ch);
t30_local_interrupt_request(s, true);
}
else
......@@ -326,7 +338,7 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int result)
case T30_PRI_MPS:
case T30_PRI_EOM:
case T30_PRI_EOP:
printf("%c: Accepting interrupt request\n", i);
printf("%c: Accepting interrupt request\n", ch);
t30_local_interrupt_request(s, true);
break;
case T30_PIN:
......@@ -338,15 +350,19 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int result)
}
/*- End of function --------------------------------------------------------*/
static void phase_e_handler(t30_state_t *s, void *user_data, int result)
static void phase_e_handler(void *user_data, int result)
{
int i;
int ch;
t30_stats_t t;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E", i + 'A');
printf("%c: Phase E handler - (%d) %s\n", i + 'A', result, t30_completion_code_to_str(result));
s = t30_state[i];
ch = i + 'A';
snprintf(tag, sizeof(tag), "%c: Phase E", ch);
printf("%c: Phase E handler - (%d) %s\n", ch, result, t30_completion_code_to_str(result));
fax_log_final_transfer_statistics(s, tag);
fax_log_tx_parameters(s, tag);
fax_log_rx_parameters(s, tag);
......@@ -356,29 +372,32 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
}
/*- End of function --------------------------------------------------------*/
static void real_time_frame_handler(t30_state_t *s,
void *user_data,
static void real_time_frame_handler(void *user_data,
bool incoming,
const uint8_t *msg,
int len)
{
int i;
int ch;
i = (intptr_t) user_data;
ch = i + 'A';
printf("%c: Real time frame handler - %s, %s, length = %d\n",
i + 'A',
ch,
(incoming) ? "line->T.30" : "T.30->line",
t30_frametype(msg[2]),
len);
}
/*- End of function --------------------------------------------------------*/
static int document_handler(t30_state_t *s, void *user_data, int event)
static int document_handler(void *user_data, int event)
{
int i;
int ch;
i = (intptr_t) user_data;
printf("%c: Document handler - event %d\n", i + 'A', event);
ch = i + 'A';
printf("%c: Document handler - event %d\n", ch, event);
return false;
}
/*- End of function --------------------------------------------------------*/
......
......@@ -91,27 +91,31 @@ int test_seq_ptr = 0;
t31_state_t *t31_state;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_b_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B", i);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B", ch);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", ch, ch, result, t30_frametype(result));
fax_log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D", i);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D", ch);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", ch, ch, result, t30_frametype(result));
fax_log_page_transfer_statistics(s, tag);
fax_log_tx_parameters(s, tag);
fax_log_rx_parameters(s, tag);
......@@ -119,18 +123,19 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int result)
}
/*- End of function --------------------------------------------------------*/
static void phase_e_handler(t30_state_t *s, void *user_data, int result)
static void phase_e_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E", i);
printf("Phase E handler on channel %c\n", i);
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E", ch);
printf("Phase E handler on channel %c\n", ch);
fax_log_final_transfer_statistics(s, tag);
fax_log_tx_parameters(s, tag);
fax_log_rx_parameters(s, tag);
//exit(0);
}
/*- End of function --------------------------------------------------------*/
......@@ -502,9 +507,9 @@ static int t30_tests(int t38_mode, int use_ecm, int use_gui, int log_audio, int
t30_set_tx_ident(t30, "11111111");
t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17);
//t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
t30_set_phase_b_handler(t30, phase_b_handler, (void *) 'A');
t30_set_phase_d_handler(t30, phase_d_handler, (void *) 'A');
t30_set_phase_e_handler(t30, phase_e_handler, (void *) 'A');
t30_set_phase_b_handler(t30, phase_b_handler, (void *) t30);
t30_set_phase_d_handler(t30, phase_d_handler, (void *) t30);
t30_set_phase_e_handler(t30, phase_e_handler, (void *) t30);
if (t38_mode)
logging = t38_terminal_get_logging_state(t38_state);
......
......@@ -280,27 +280,31 @@ int test_seq_ptr = 0;
t31_state_t *t31_state;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_b_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B", i);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B", ch);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", ch, ch, result, t30_frametype(result));
fax_log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D", i);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D", ch);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", ch, ch, result, t30_frametype(result));
fax_log_page_transfer_statistics(s, tag);
fax_log_tx_parameters(s, tag);
fax_log_rx_parameters(s, tag);
......@@ -308,18 +312,19 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int result)
}
/*- End of function --------------------------------------------------------*/
static void phase_e_handler(t30_state_t *s, void *user_data, int result)
static void phase_e_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E", i);
printf("Phase E handler on channel %c\n", i);
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E", ch);
printf("Phase E handler on channel %c\n", ch);
fax_log_final_transfer_statistics(s, tag);
fax_log_tx_parameters(s, tag);
fax_log_rx_parameters(s, tag);
//exit(0);
}
/*- End of function --------------------------------------------------------*/
......@@ -600,9 +605,9 @@ static int t30_tests(int t38_mode, int use_gui, int log_audio, int test_sending,
t30_set_tx_ident(t30, "11111111");
t30_set_supported_modems(t30, T30_SUPPORT_V27TER | T30_SUPPORT_V29 | T30_SUPPORT_V17);
//t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
t30_set_phase_b_handler(t30, phase_b_handler, (void *) 'A');
t30_set_phase_d_handler(t30, phase_d_handler, (void *) 'A');
t30_set_phase_e_handler(t30, phase_e_handler, (void *) 'A');
t30_set_phase_b_handler(t30, phase_b_handler, (void *) t30);
t30_set_phase_d_handler(t30, phase_d_handler, (void *) t30);
t30_set_phase_e_handler(t30, phase_e_handler, (void *) t30);
if (t38_mode)
logging = t38_terminal_get_logging_state(t38_state);
......
......@@ -70,27 +70,31 @@ static int done = false;
static int started = false;
static int64_t current = 0;
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_b_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B", i);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase B", ch);
printf("%c: Phase B handler on channel %c - (0x%X) %s\n", ch, ch, result, t30_frametype(result));
fax_log_rx_parameters(s, tag);
return T30_ERR_OK;
}
/*- End of function --------------------------------------------------------*/
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
static int phase_d_handler(void *user_data, int result)
{
int i;
int ch;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D", i);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase D", ch);
printf("%c: Phase D handler on channel %c - (0x%X) %s\n", ch, ch, result, t30_frametype(result));
fax_log_page_transfer_statistics(s, tag);
fax_log_tx_parameters(s, tag);
fax_log_rx_parameters(s, tag);
......@@ -98,15 +102,17 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int result)
}
/*- End of function --------------------------------------------------------*/
static void phase_e_handler(t30_state_t *s, void *user_data, int result)
static void phase_e_handler(void *user_data, int result)
{
int i;
int ch;
t30_stats_t t;
t30_state_t *s;
char tag[20];
i = (int) (intptr_t) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E", i);
printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
ch = 'A';
s = (t30_state_t *) user_data;
snprintf(tag, sizeof(tag), "%c: Phase E", ch);
printf("%c: Phase E handler on channel %c - (%d) %s\n", ch, ch, result, t30_completion_code_to_str(result));
fax_log_final_transfer_statistics(s, tag);
fax_log_tx_parameters(s, tag);
fax_log_rx_parameters(s, tag);
......@@ -319,6 +325,7 @@ int main(int argc, char *argv[])
t30_state_t *t30;
logging_state_t *logging;
const char *input_file_name;
const char *input_tiff_file_name;
int t38_version;
int caller;
int use_ecm;
......@@ -338,6 +345,7 @@ int main(int argc, char *argv[])
t38_version = 0;
options = 0;
input_file_name = INPUT_FILE_NAME;
input_tiff_file_name = INPUT_TIFF_FILE_NAME;
fill_removal = false;
use_tep = false;
use_transmit_on_idle = true;
......@@ -348,7 +356,7 @@ int main(int argc, char *argv[])
src_port = 0;
dest_addr = 0;
dest_port = 0;
while ((opt = getopt(argc, argv, "cD:d:eFGi:lm:oS:s:tv:")) != -1)
while ((opt = getopt(argc, argv, "cD:d:eFGi:lm:oS:s:T:tv:")) != -1)
{
switch (opt)
{
......@@ -388,6 +396,9 @@ int main(int argc, char *argv[])
case 's':
src_port = atoi(optarg);
break;
case 'T':
input_tiff_file_name = optarg;
break;
case 't':
use_tep = true;
break;
......@@ -433,12 +444,12 @@ int main(int argc, char *argv[])
t30_set_tx_ident(t30, "11111111");
t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
if (caller)
t30_set_tx_file(t30, INPUT_TIFF_FILE_NAME, -1, -1);
t30_set_tx_file(t30, input_tiff_file_name, -1, -1);
else
t30_set_rx_file(t30, OUTPUT_TIFF_FILE_NAME, -1);
t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'A');
t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'A');
t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'A');
t30_set_phase_b_handler(t30, phase_b_handler, (void *) t30);
t30_set_phase_d_handler(t30, phase_d_handler, (void *) t30);
t30_set_phase_e_handler(t30, phase_e_handler, (void *) t30);
t30_set_ecm_capability(t30, use_ecm);
t30_set_supported_compressions(t30,
T4_COMPRESSION_T4_1D
......@@ -519,12 +530,12 @@ int main(int argc, char *argv[])
t30_set_tx_ident(t30, "22222222");
t30_set_tx_nsf(t30, (const uint8_t *) "\x50\x00\x00\x00Spandsp\x00", 12);
if (caller)
t30_set_tx_file(t30, INPUT_TIFF_FILE_NAME, -1, -1);
t30_set_tx_file(t30, input_tiff_file_name, -1, -1);
else
t30_set_rx_file(t30, OUTPUT_TIFF_FILE_NAME, -1);
t30_set_phase_b_handler(t30, phase_b_handler, (void *) (intptr_t) 'B');
t30_set_phase_d_handler(t30, phase_d_handler, (void *) (intptr_t) 'B');
t30_set_phase_e_handler(t30, phase_e_handler, (void *) (intptr_t) 'B');
t30_set_phase_b_handler(t30, phase_b_handler, (void *) t30);
t30_set_phase_d_handler(t30, phase_d_handler, (void *) t30);
t30_set_phase_e_handler(t30, phase_e_handler, (void *) t30);
t30_set_ecm_capability(t30, use_ecm);
t30_set_supported_compressions(t30,
T4_COMPRESSION_T4_1D
......
......@@ -75,6 +75,7 @@ struct pvt_s {
mod_spandsp_fax_application_mode_t app_mode;
t30_state_t *t30;
fax_state_t *fax_state;
t38_terminal_state_t *t38_state;
t38_gateway_state_t *t38_gateway_state;
......@@ -292,7 +293,7 @@ void mod_spandsp_log_message(void *user_data, int level, const char *msg)
}
}
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
static int phase_b_handler(void *user_data, int result)
{
t30_stats_t t30_stats;
switch_core_session_t *session;
......@@ -312,10 +313,10 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
channel = switch_core_session_get_channel(session);
switch_assert(channel);
t30_get_transfer_statistics(s, &t30_stats);
t30_get_transfer_statistics(pvt->t30, &t30_stats);
local_ident = switch_str_nil(t30_get_tx_ident(s));
far_ident = switch_str_nil(t30_get_rx_ident(s));
local_ident = switch_str_nil(t30_get_tx_ident(pvt->t30));
far_ident = switch_str_nil(t30_get_rx_ident(pvt->t30));
fax_transfer_rate = switch_core_session_sprintf(session, "%i", t30_stats.bit_rate);
if (fax_transfer_rate) {
......@@ -324,9 +325,9 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
switch_channel_set_variable(channel, "fax_ecm_used", (t30_stats.error_correcting_mode) ? "on" : "off");
switch_channel_set_variable(channel, "fax_local_station_id", local_ident);
switch_channel_set_variable(channel, "fax_remote_station_id", far_ident);
switch_channel_set_variable(channel, "fax_remote_country", switch_str_nil(t30_get_rx_country(s)));
switch_channel_set_variable(channel, "fax_remote_vendor", switch_str_nil(t30_get_rx_vendor(s)));
switch_channel_set_variable(channel, "fax_remote_model", switch_str_nil(t30_get_rx_model(s)));
switch_channel_set_variable(channel, "fax_remote_country", switch_str_nil(t30_get_rx_country(pvt->t30)));
switch_channel_set_variable(channel, "fax_remote_vendor", switch_str_nil(t30_get_rx_vendor(pvt->t30)));
switch_channel_set_variable(channel, "fax_remote_model", switch_str_nil(t30_get_rx_model(pvt->t30)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "=== Negotiation Result =======================================================\n");
......@@ -335,9 +336,9 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Transfer Rate: %i\n", t30_stats.bit_rate);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ECM status %s\n", (t30_stats.error_correcting_mode) ? "on" : "off");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote country: %s\n", switch_str_nil(t30_get_rx_country(s)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor: %s\n", switch_str_nil(t30_get_rx_vendor(s)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model: %s\n", switch_str_nil(t30_get_rx_model(s)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote country: %s\n", switch_str_nil(t30_get_rx_country(pvt->t30)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor: %s\n", switch_str_nil(t30_get_rx_vendor(pvt->t30)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model: %s\n", switch_str_nil(t30_get_rx_model(pvt->t30)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n");
......@@ -353,16 +354,16 @@ static int phase_b_handler(t30_state_t *s, void *user_data, int result)
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-ecm-used", (t30_stats.error_correcting_mode) ? "on" : "off");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-local-station-id", local_ident);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-station-id", far_ident);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-country", switch_str_nil(t30_get_rx_country(s)));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-vendor", switch_str_nil(t30_get_rx_vendor(s)));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-model", switch_str_nil(t30_get_rx_model(s)));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-country", switch_str_nil(t30_get_rx_country(pvt->t30)));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-vendor", switch_str_nil(t30_get_rx_vendor(pvt->t30)));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-model", switch_str_nil(t30_get_rx_model(pvt->t30)));
switch_event_fire(&event);
}
return T30_ERR_OK;
}
static int phase_d_handler(t30_state_t *s, void *user_data, int msg)
static int phase_d_handler(void *user_data, int msg)
{
t30_stats_t t30_stats;
char *fax_file_image_resolution = NULL;
......@@ -388,7 +389,7 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int msg)
channel = switch_core_session_get_channel(session);
switch_assert(channel);
t30_get_transfer_statistics(s, &t30_stats);
t30_get_transfer_statistics(pvt->t30, &t30_stats);
/* Set Channel Variable */
......@@ -476,7 +477,7 @@ static int phase_d_handler(t30_state_t *s, void *user_data, int msg)
/*
* Called at the end of the document
*/
static void phase_e_handler(t30_state_t *s, void *user_data, int result)
static void phase_e_handler(void *user_data, int result)
{
t30_stats_t t;
const char *local_ident;
......@@ -504,9 +505,9 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result)
channel = switch_core_session_get_channel(session);
switch_assert(channel);
t30_get_transfer_statistics(s, &t);
local_ident = switch_str_nil(t30_get_tx_ident(s));
far_ident = switch_str_nil(t30_get_rx_ident(s));
t30_get_transfer_statistics(pvt->t30, &t);
local_ident = switch_str_nil(t30_get_tx_ident(pvt->t30));
far_ident = switch_str_nil(t30_get_rx_ident(pvt->t30));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n");
......@@ -519,7 +520,6 @@ 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));
......@@ -535,9 +535,9 @@ 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, "Transfer Rate: %i\n", t.bit_rate);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "ECM status %s\n", (t.error_correcting_mode) ? "on" : "off");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote country: %s\n", switch_str_nil(t30_get_rx_country(s)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor: %s\n", switch_str_nil(t30_get_rx_vendor(s)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model: %s\n", switch_str_nil(t30_get_rx_model(s)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote country: %s\n", switch_str_nil(t30_get_rx_country(pvt->t30)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor: %s\n", switch_str_nil(t30_get_rx_vendor(pvt->t30)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model: %s\n", switch_str_nil(t30_get_rx_model(pvt->t30)));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n");
......@@ -687,7 +687,6 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin
static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
{
switch_core_session_t *session;
switch_channel_t *channel;
fax_state_t *fax;
......@@ -699,7 +698,6 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
int fec_span = DEFAULT_FEC_SPAN;
int compressions;
session = (switch_core_session_t *) pvt->session;
switch_assert(session);
......@@ -724,7 +722,8 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
}
fax = pvt->fax_state;
t30 = fax_get_t30_state(fax);
pvt->t30 = fax_get_t30_state(fax);
t30 = pvt->t30;
memset(fax, 0, sizeof(fax_state_t));
if (fax_init(fax, pvt->caller) == NULL) {
......@@ -762,7 +761,8 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
}
t38 = pvt->t38_state;
t30 = t38_terminal_get_t30_state(t38);
pvt->t30 = t38_terminal_get_t30_state(t38);
t30 = pvt->t30;
memset(t38, 0, sizeof(t38_terminal_state_t));
......@@ -856,7 +856,6 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
t38_gateway_set_ecm_capability(pvt->t38_gateway_state, 1);
return SWITCH_STATUS_SUCCESS;
default:
assert(0); /* What? */
return SWITCH_STATUS_SUCCESS;
......@@ -975,7 +974,6 @@ static switch_status_t spanfax_destroy(pvt_t *pvt)
}
t30 = t38_terminal_get_t30_state(pvt->t38_state);
if (terminate && t30) {
t30_terminate(t30);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论