[asterisk-commits] mnicholson: branch group/res_fax r237916 - /team/group/res_fax/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 5 15:29:11 CST 2010


Author: mnicholson
Date: Tue Jan  5 15:29:07 2010
New Revision: 237916

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=237916
Log:
Change the way res_fax_spandsp detects the end of a fax session for spandsp 0.0.5.

Modified:
    team/group/res_fax/res/res_fax_spandsp.c

Modified: team/group/res_fax/res/res_fax_spandsp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/res_fax/res/res_fax_spandsp.c?view=diff&rev=237916&r1=237915&r2=237916
==============================================================================
--- team/group/res_fax/res/res_fax_spandsp.c (original)
+++ team/group/res_fax/res/res_fax_spandsp.c Tue Jan  5 15:29:07 2010
@@ -114,6 +114,7 @@
 struct spandsp_pvt {
 	struct ast_fax_session *session;  /* XXX this is unnecessary */
 	unsigned int ist38:1;
+	unsigned int isdone:1;
 	fax_state_t fax_state;
 	t38_terminal_state_t t38_state;
 	t30_state_t *t30_state;
@@ -140,9 +141,9 @@
 	struct ast_frame *f;
 
 	t30_terminate(p->t30_state);
+	p->isdone = 1;
 
 	if (p->session_thread != AST_PTHREADT_NULL) {
-		/* XXX perhaps s->state should be set here */
 		pthread_join(p->session_thread, NULL);
 	}
 
@@ -169,9 +170,10 @@
 	now = ast_tvnow();
 
 #if SPANDSP_RELEASE_DATE >= 20080725
+	/* spandsp 0.0.6 */
 	while (t30_call_active(p->t30_state)) {
 #else
-	while (p->state != T30_PHASE_CALL_FINISHED) {
+	while (!p->isdone) {
 #endif
 		if (p->ist38) {
 			last_frame = now;
@@ -234,9 +236,12 @@
 static void t30_phase_e_handler(t30_state_t *t30_state, void *data, int completion_code)
 {
 	struct ast_fax_session *s = data;
+	struct spandsp_pvt *p = s->tech_pvt;
 	char headerinfo[T30_MAX_PAGE_HEADER_INFO + 1];
 	const char *c;
 	t30_stats_t stats;
+
+	p->isdone = 1;
 
 	t30_get_transfer_statistics(t30_state, &stats);
 
@@ -519,6 +524,7 @@
 
 
 	/* create the session thread */
+	p->isdone = 0;
 	if (ast_pthread_create(&p->session_thread, NULL, session_thread, s) < 0) {
 		ast_log(LOG_ERROR, "failed to create FAX thread for session: %d\n", s->id);
 		return -1;
@@ -533,6 +539,7 @@
 {
 	struct spandsp_pvt *p = s->tech_pvt;
 	t30_terminate(p->t30_state);
+	p->isdone = 1;
 	return 0;
 }
 
@@ -551,7 +558,11 @@
 	/* prevent the phase E handler from running, this is not a real termination */
 	t30_set_phase_e_handler(p->t30_state, NULL, NULL);
 
+	p->isdone = 1;
 	t30_terminate(p->t30_state);
+	if (p->session_thread != AST_PTHREADT_NULL) {
+		pthread_join(p->session_thread, NULL);
+	}
 
 	s->details->option.switch_to_t38 = 1;
 




More information about the asterisk-commits mailing list