Lines 100-129
Link Here
|
100 |
volatile int finished; |
100 |
volatile int finished; |
101 |
} fax_session; |
101 |
} fax_session; |
102 |
|
102 |
|
103 |
static void phase_b_handler(t30_state_t *s, void *user_data, int result) |
103 |
static int phase_b_handler(t30_state_t *s, void *user_data, int result) |
104 |
{ |
104 |
{ |
105 |
if (txfax_logfile!=NULL) { |
105 |
if (txfax_logfile!=NULL) { |
106 |
fprintf( txfax_logfile, "[phase_b_handler] mark\n" ); |
106 |
fprintf( txfax_logfile, "[phase_b_handler] mark\n" ); |
107 |
fflush(txfax_logfile); |
107 |
fflush(txfax_logfile); |
108 |
} |
108 |
} |
|
|
109 |
return T30_ERR_OK; |
109 |
} |
110 |
} |
110 |
|
111 |
|
111 |
static void phase_e_handler(t30_state_t *s, void *user_data, int result) |
112 |
static void phase_e_handler(t30_state_t *s, void *user_data, int result) |
112 |
{ |
113 |
{ |
113 |
struct ast_channel *chan; |
114 |
struct ast_channel *chan; |
114 |
char local_ident[21]; |
|
|
115 |
char far_ident[21]; |
116 |
char buf[128]; |
115 |
char buf[128]; |
117 |
t30_stats_t t; |
116 |
t30_stats_t t; |
|
|
117 |
const char *rx_ident; |
118 |
const char *tx_ident; |
118 |
|
119 |
|
119 |
t30_get_transfer_statistics(s, &t); |
120 |
t30_get_transfer_statistics(s, &t); |
120 |
|
121 |
|
121 |
fax_session *fax = (fax_session *) user_data; |
122 |
fax_session *fax = (fax_session *) user_data; |
122 |
chan = fax->chan; |
123 |
chan = fax->chan; |
123 |
|
124 |
|
124 |
t30_get_local_ident(s, local_ident); |
125 |
tx_ident = t30_get_tx_ident(s); |
125 |
t30_get_far_ident(s, far_ident); |
126 |
if (tx_ident == NULL) |
126 |
pbx_builtin_setvar_helper(chan, "REMOTESTATIONID", far_ident); |
127 |
tx_ident = ""; |
|
|
128 |
rx_ident = t30_get_rx_ident(s); |
129 |
if (rx_ident == NULL) |
130 |
rx_ident = ""; |
131 |
pbx_builtin_setvar_helper(chan, "REMOTESTATIONID", rx_ident); |
127 |
snprintf(buf, sizeof(buf), "%d", t.pages_transferred); |
132 |
snprintf(buf, sizeof(buf), "%d", t.pages_transferred); |
128 |
pbx_builtin_setvar_helper(chan, "FAXPAGES", buf); |
133 |
pbx_builtin_setvar_helper(chan, "FAXPAGES", buf); |
129 |
snprintf(buf, sizeof(buf), "%d", t.y_resolution); |
134 |
snprintf(buf, sizeof(buf), "%d", t.y_resolution); |
Lines 138-148
Link Here
|
138 |
ast_log(LOG_DEBUG, "==============================================================================\n"); |
143 |
ast_log(LOG_DEBUG, "==============================================================================\n"); |
139 |
if (result == T30_ERR_OK) { |
144 |
if (result == T30_ERR_OK) { |
140 |
|
145 |
|
141 |
fax->finished = 1; |
146 |
fax->finished = 1; |
142 |
|
147 |
|
143 |
ast_log(LOG_DEBUG, "Fax successfully sent.\n"); |
148 |
ast_log(LOG_DEBUG, "Fax successfully sent.\n"); |
144 |
ast_log(LOG_DEBUG, "Remote station id: %s\n", far_ident); |
149 |
ast_log(LOG_DEBUG, "Remote station id: %s\n", rx_ident); |
145 |
ast_log(LOG_DEBUG, "Local station id: %s\n", local_ident); |
150 |
ast_log(LOG_DEBUG, "Local station id: %s\n", tx_ident); |
146 |
ast_log(LOG_DEBUG, "Pages transferred: %i\n", t.pages_transferred); |
151 |
ast_log(LOG_DEBUG, "Pages transferred: %i\n", t.pages_transferred); |
147 |
ast_log(LOG_DEBUG, "Image resolution: %i x %i\n", t.x_resolution, t.y_resolution); |
152 |
ast_log(LOG_DEBUG, "Image resolution: %i x %i\n", t.x_resolution, t.y_resolution); |
148 |
ast_log(LOG_DEBUG, "Transfer Rate: %i\n", t.bit_rate); |
153 |
ast_log(LOG_DEBUG, "Transfer Rate: %i\n", t.bit_rate); |
Lines 151-165
Link Here
|
151 |
chan->name, |
156 |
chan->name, |
152 |
chan->exten, |
157 |
chan->exten, |
153 |
(chan->cid.cid_num) ? chan->cid.cid_num : "", |
158 |
(chan->cid.cid_num) ? chan->cid.cid_num : "", |
154 |
far_ident, |
159 |
rx_ident, |
155 |
local_ident, |
160 |
tx_ident, |
156 |
t.pages_transferred, |
161 |
t.pages_transferred, |
157 |
t.y_resolution, |
162 |
t.y_resolution, |
158 |
t.bit_rate, |
163 |
t.bit_rate, |
159 |
s->rx_file); |
164 |
s->rx_file); |
160 |
if (txfax_logfile!=NULL) { |
165 |
if (txfax_logfile!=NULL) { |
161 |
fprintf( txfax_logfile, "\n[FAX OK] Remote: %s Local: %s Pages: %i Speed: %i\n\n", |
166 |
fprintf( txfax_logfile, "\n[FAX OK] Remote: %s Local: %s Pages: %i Speed: %i\n\n", |
162 |
far_ident, local_ident, t.pages_transferred, t.bit_rate |
167 |
rx_ident, tx_ident, t.pages_transferred, t.bit_rate |
163 |
); |
168 |
); |
164 |
fflush(txfax_logfile); |
169 |
fflush(txfax_logfile); |
165 |
} |
170 |
} |
Lines 173-179
Link Here
|
173 |
ast_log(LOG_DEBUG, "==============================================================================\n"); |
172 |
ast_log(LOG_DEBUG, "==============================================================================\n"); |
174 |
} |
173 |
} |
175 |
/*- End of function --------------------------------------------------------*/ |
174 |
/*- End of function --------------------------------------------------------*/ |
176 |
static void phase_d_handler(t30_state_t *s, void *user_data, int result) |
175 |
static int phase_d_handler(t30_state_t *s, void *user_data, int result) |
177 |
{ |
176 |
{ |
178 |
// struct ast_channel *chan; |
177 |
// struct ast_channel *chan; |
179 |
// chan = (struct ast_channel *) user_data; |
178 |
// chan = (struct ast_channel *) user_data; |
Lines 197-202
Link Here
|
197 |
fflush(txfax_logfile); |
202 |
fflush(txfax_logfile); |
198 |
} |
203 |
} |
199 |
} |
204 |
} |
|
|
205 |
return T30_ERR_OK; |
200 |
} |
206 |
} |
201 |
/*- End of function --------------------------------------------------------*/ |
207 |
/*- End of function --------------------------------------------------------*/ |
202 |
|
208 |
|
Lines 344-353
Link Here
|
344 |
} |
350 |
} |
345 |
x = pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"); |
351 |
x = pbx_builtin_getvar_helper(chan, "LOCALSTATIONID"); |
346 |
if (x && x[0]) |
352 |
if (x && x[0]) |
347 |
t30_set_local_ident(&(fax.t30_state), x); |
353 |
t30_set_tx_ident(&(fax.t30_state), x); |
348 |
x = pbx_builtin_getvar_helper(chan, "LOCALHEADERINFO"); |
354 |
x = pbx_builtin_getvar_helper(chan, "LOCALHEADERINFO"); |
349 |
if (x && x[0]) |
355 |
if (x && x[0]) |
350 |
t30_set_header_info(&(fax.t30_state), x); |
356 |
t30_set_tx_page_header_info(&(fax.t30_state), x); |
351 |
t30_set_tx_file(&(fax.t30_state), source_file, -1, -1); |
357 |
t30_set_tx_file(&(fax.t30_state), source_file, -1, -1); |
352 |
t30_set_phase_b_handler(&(fax.t30_state), phase_b_handler, chan); |
358 |
t30_set_phase_b_handler(&(fax.t30_state), phase_b_handler, chan); |
353 |
t30_set_phase_d_handler(&(fax.t30_state), phase_d_handler, chan); |
359 |
t30_set_phase_d_handler(&(fax.t30_state), phase_d_handler, chan); |