[asterisk-commits] mnicholson: branch irroot/t38gateway-trunk r324471 - /team/irroot/t38gateway-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 22 09:23:59 CDT 2011


Author: mnicholson
Date: Wed Jun 22 09:23:56 2011
New Revision: 324471

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324471
Log:
implement the cancel function for gateway stuff and removed some unnecessary locking

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=324471&r1=324470&r2=324471
==============================================================================
--- team/irroot/t38gateway-trunk/res/res_fax_spandsp.c (original)
+++ team/irroot/t38gateway-trunk/res/res_fax_spandsp.c Wed Jun 22 09:23:56 2011
@@ -624,19 +624,16 @@
 
 	ast_format_set(&t30_frame.subclass.format, AST_FORMAT_SLINEAR, 0);
 	if (!(f = ast_frisolate(&t30_frame))) {
-		return res;
+		return p->isdone ? -1 : res;
 	}
 
 	/* generate a T.30 packet */
 	if ((f->samples = t38_gateway_tx(&p->t38_gw_state, f->data.ptr, f->samples))) {
-		res = 0;
 		f->datalen = f->samples * sizeof(int16_t);
-		if (ast_write(chan, f) < 0) {
-			res = -1;
-		}
+		res = ast_write(chan, f);
 	}
 	ast_frfree(f);
-	return res;
+	return p->isdone ? -1 : res;
 }
 
 /*! \brief simple routine to allocate data to generator
@@ -679,14 +676,12 @@
 	}
 
 	p->ist38 = 1;
-	ast_channel_lock(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((p->ast_t38_state == T38_STATE_NEGOTIATED) ? peer : s->chan, &t30_gen , s);
-	ast_channel_unlock(s->chan);
+	ast_activate_generator(p->ast_t38_state == T38_STATE_NEGOTIATED ? peer : s->chan, &t30_gen , s);
 
 	set_logging(&p->t38_gw_state.logging, s->details);
 	set_logging(&p->t38_core_state->logging, s->details);
@@ -867,6 +862,12 @@
 static int spandsp_fax_cancel(struct ast_fax_session *s)
 {
 	struct spandsp_pvt *p = s->tech_pvt;
+
+	if (s->details->caps & AST_FAX_TECH_GATEWAY) {
+		p->isdone = 1;
+		return 0;
+	}
+
 	t30_terminate(p->t30_state);
 	p->isdone = 1;
 	return 0;




More information about the asterisk-commits mailing list