Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 159013 | Differences between
and this patch

Collapse All | Expand All

(-)agx-ast-addons.orig/app_txfax.c (-16 / +22 lines)
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);
(-)agx-ast-addons.orig/app_rxfax.c (-14 / +20 lines)
Lines 95-123 Link Here
95
}
95
}
96
/*- End of function --------------------------------------------------------*/
96
/*- End of function --------------------------------------------------------*/
97
97
98
static void phase_b_handler(t30_state_t *s, void *user_data, int result)
98
static int phase_b_handler(t30_state_t *s, void *user_data, int result)
99
{
99
{
100
	if (rxfax_logfile!=NULL) {
100
	if (rxfax_logfile!=NULL) {
101
		fprintf( rxfax_logfile, "[phase_b_handler] mark\n" );
101
		fprintf( rxfax_logfile, "[phase_b_handler] mark\n" );
102
		fflush(rxfax_logfile);
102
		fflush(rxfax_logfile);
103
	}
103
	}
104
	return T30_ERR_OK;
104
}
105
}
105
106
106
/*- End of function --------------------------------------------------------*/
107
/*- End of function --------------------------------------------------------*/
107
static void phase_e_handler(t30_state_t *s, void *user_data, int result)
108
static void phase_e_handler(t30_state_t *s, void *user_data, int result)
108
{
109
{
109
    struct ast_channel *chan;
110
    struct ast_channel *chan;
110
    char local_ident[21];
111
    char far_ident[21];
112
    char buf[128];
111
    char buf[128];
113
    t30_stats_t t;
112
    t30_stats_t t;
113
    const char *tx_ident;
114
    const char *rx_ident;
114
115
115
    t30_get_transfer_statistics(s, &t);
116
    t30_get_transfer_statistics(s, &t);
116
117
117
    chan = (struct ast_channel *) user_data;
118
    chan = (struct ast_channel *) user_data;
118
    t30_get_local_ident(s, local_ident);
119
    tx_ident = t30_get_tx_ident(s);
119
    t30_get_far_ident(s, far_ident);
120
    if (tx_ident == NULL)
120
    pbx_builtin_setvar_helper(chan, "REMOTESTATIONID", far_ident);
121
        tx_ident = "";
122
    rx_ident = t30_get_rx_ident(s);
123
    if (rx_ident == NULL)
124
        rx_ident = "";
125
    pbx_builtin_setvar_helper(chan, "REMOTESTATIONID", rx_ident);
121
    snprintf(buf, sizeof(buf), "%d", t.pages_transferred);
126
    snprintf(buf, sizeof(buf), "%d", t.pages_transferred);
122
    pbx_builtin_setvar_helper(chan, "FAXPAGES", buf);
127
    pbx_builtin_setvar_helper(chan, "FAXPAGES", buf);
123
    snprintf(buf, sizeof(buf), "%d", t.y_resolution);
128
    snprintf(buf, sizeof(buf), "%d", t.y_resolution);
Lines 133-140 Link Here
133
    if (result == T30_ERR_OK)
138
    if (result == T30_ERR_OK)
134
    {
139
    {
135
        xast_log(LOG_DEBUG, "Fax successfully received.\n");
140
        xast_log(LOG_DEBUG, "Fax successfully received.\n");
136
        xast_log(LOG_DEBUG, "Remote station id: %s\n", far_ident);
141
        xast_log(LOG_DEBUG, "Remote station id: %s\n", rx_ident);
137
        xast_log(LOG_DEBUG, "Local station id:  %s\n", local_ident);
142
        xast_log(LOG_DEBUG, "Local station id:  %s\n", tx_ident);
138
        xast_log(LOG_DEBUG, "Pages transferred: %i\n", t.pages_transferred);
143
        xast_log(LOG_DEBUG, "Pages transferred: %i\n", t.pages_transferred);
139
        xast_log(LOG_DEBUG, "Image resolution:  %i x %i\n", t.x_resolution, t.y_resolution);
144
        xast_log(LOG_DEBUG, "Image resolution:  %i x %i\n", t.x_resolution, t.y_resolution);
140
        xast_log(LOG_DEBUG, "Transfer Rate:     %i\n", t.bit_rate);
145
        xast_log(LOG_DEBUG, "Transfer Rate:     %i\n", t.bit_rate);
Lines 143-157 Link Here
143
                      chan->name,
148
                      chan->name,
144
                      chan->exten,
149
                      chan->exten,
145
                      (chan->cid.cid_num)  ?  chan->cid.cid_num  :  "",
150
                      (chan->cid.cid_num)  ?  chan->cid.cid_num  :  "",
146
                      far_ident,
151
                      rx_ident,
147
                      local_ident,
152
                      tx_ident,
148
                      t.pages_transferred,
153
                      t.pages_transferred,
149
                      t.y_resolution,
154
                      t.y_resolution,
150
                      t.bit_rate,
155
                      t.bit_rate,
151
                      s->rx_file);
156
                      s->rx_file);
152
	if (rxfax_logfile!=NULL) {
157
	if (rxfax_logfile!=NULL) {
153
		fprintf( rxfax_logfile, "\n[FAX OK] Remote: %s Local: %s Pages: %i Speed: %i\n\n", 
158
		fprintf( rxfax_logfile, "\n[FAX OK] Remote: %s Local: %s Pages: %i Speed: %i\n\n", 
154
			far_ident, local_ident, t.pages_transferred, t.bit_rate
159
			rx_ident, tx_ident, t.pages_transferred, t.bit_rate
155
		);
160
		);
156
		fflush(rxfax_logfile);
161
		fflush(rxfax_logfile);
157
	}
162
	}
Lines 168-174 Link Here
168
}
173
}
169
/*- End of function --------------------------------------------------------*/
174
/*- End of function --------------------------------------------------------*/
170
175
171
static void phase_d_handler(t30_state_t *s, void *user_data, int result)
176
static int phase_d_handler(t30_state_t *s, void *user_data, int result)
172
{
177
{
173
    struct ast_channel *chan;
178
    struct ast_channel *chan;
174
    t30_stats_t t;
179
    t30_stats_t t;
Lines 192-197 Link Here
192
		fflush(rxfax_logfile);
197
		fflush(rxfax_logfile);
193
	}
198
	}
194
    }
199
    }
200
    return T30_ERR_OK;
195
}
201
}
196
/*- End of function --------------------------------------------------------*/
202
/*- End of function --------------------------------------------------------*/
197
203
Lines 328-337 Link Here
328
	}
334
	}
329
        x = pbx_builtin_getvar_helper(chan, "LOCALSTATIONID");
335
        x = pbx_builtin_getvar_helper(chan, "LOCALSTATIONID");
330
        if (x  &&  x[0])
336
        if (x  &&  x[0])
331
            t30_set_local_ident(&fax.t30_state, x);
337
            t30_set_tx_ident(&fax.t30_state, x);
332
        x = pbx_builtin_getvar_helper(chan, "LOCALHEADERINFO");
338
        x = pbx_builtin_getvar_helper(chan, "LOCALHEADERINFO");
333
        if (x  &&  x[0])
339
        if (x  &&  x[0])
334
            t30_set_header_info(&fax.t30_state, x);
340
            t30_set_tx_page_header_info(&fax.t30_state, x);
335
        t30_set_rx_file(&fax.t30_state, target_file, -1);
341
        t30_set_rx_file(&fax.t30_state, target_file, -1);
336
        t30_set_phase_b_handler(&fax.t30_state, phase_b_handler, chan);
342
        t30_set_phase_b_handler(&fax.t30_state, phase_b_handler, chan);
337
        t30_set_phase_d_handler(&fax.t30_state, phase_d_handler, chan);
343
        t30_set_phase_d_handler(&fax.t30_state, phase_d_handler, chan);

Return to bug 159013