[svn-commits] mnicholson: branch irroot/t38gateway-trunk r323840 - /team/irroot/t38gateway-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 15 13:59:33 CDT 2011


Author: mnicholson
Date: Wed Jun 15 13:59:27 2011
New Revision: 323840

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=323840
Log:
only call ast_channel_get_t38_state() once and store the result

Modified:
    team/irroot/t38gateway-trunk/res/res_fax_spandsp.c

Modified: team/irroot/t38gateway-trunk/res/res_fax_spandsp.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-trunk/res/res_fax_spandsp.c?view=diff&rev=323840&r1=323839&r2=323840
==============================================================================
--- team/irroot/t38gateway-trunk/res/res_fax_spandsp.c (original)
+++ team/irroot/t38gateway-trunk/res/res_fax_spandsp.c Wed Jun 15 13:59:27 2011
@@ -135,6 +135,7 @@
 struct spandsp_pvt {
 	unsigned int ist38:1;
 	unsigned int isdone:1;
+	enum ast_t38_state ast_t38_state;
 	fax_state_t fax_state;
 	t38_terminal_state_t t38_state;
 	t30_state_t *t30_state;
@@ -204,7 +205,7 @@
 
 	if (s->details->caps & AST_FAX_TECH_GATEWAY) {
 		ast_set_flag(f, AST_FAX_FRFLAG_GATEWAY);
-		if (ast_channel_get_t38_state(s->chan) == T38_STATE_NEGOTIATED) {
+		if (p->ast_t38_state == T38_STATE_NEGOTIATED) {
 			return ast_write(s->chan, f);
 		} else {
 			int res = ast_queue_frame(s->chan, f);
@@ -647,7 +648,6 @@
 	struct spandsp_pvt *p = s->tech_pvt;
 	struct ast_fax_t38_parameters *t38_param;
 	int i;
-	enum ast_t38_state t38state;
 	struct ast_channel *peer;
 	static struct ast_generator t30_gen = {
 		alloc: spandsp_fax_gw_gen_alloc,
@@ -668,12 +668,12 @@
 
 	p->ist38 = 1;
 	ast_channel_lock(s->chan);
-	t38state = ast_channel_get_t38_state(s->chan);
+	p->ast_t38_state = ast_channel_get_t38_state(s->chan);
 	if (!(peer = ast_bridged_channel(s->chan))) {
 		ast_channel_unlock(s->chan);
 		return -1;
 	}
-	ast_activate_generator((t38state == T38_STATE_NEGOTIATED) ? peer : s->chan, &t30_gen , s);
+	ast_activate_generator((p->ast_t38_state == T38_STATE_NEGOTIATED) ? peer : s->chan, &t30_gen , s);
 	ast_channel_unlock(s->chan);
 
 	span_log_set_message_handler(&p->t38_gw_state.logging, spandsp_log);
@@ -681,7 +681,7 @@
 	span_log_set_level(&p->t38_gw_state.logging, SPAN_LOG_WARNING + option_debug);
 	span_log_set_level(&p->t38_core_state->logging, SPAN_LOG_WARNING + option_debug);
 
-	t38_param = (ast_channel_get_t38_state(s->chan) == T38_STATE_NEGOTIATED) ? &s->details->our_t38_parameters : &s->details->their_t38_parameters;
+	t38_param = (p->ast_t38_state == T38_STATE_NEGOTIATED) ? &s->details->our_t38_parameters : &s->details->their_t38_parameters;
 	t38_set_t38_version(p->t38_core_state, t38_param->version);
 	t38_gateway_set_ecm_capability(&p->t38_gw_state, s->details->option.ecm);
 	t38_set_max_datagram_size(p->t38_core_state, t38_param->max_ifp);




More information about the svn-commits mailing list