[asterisk-commits] irroot: branch irroot/t38gateway-1.8 r338993 - /team/irroot/t38gateway-1.8/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 3 06:37:33 CDT 2011


Author: irroot
Date: Mon Oct  3 06:37:30 2011
New Revision: 338993

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=338993
Log:
  Fixup a race condition in res_fax.c where FAXOPT(gateway)=no will
  turn off the gateway but the framehook is not destroyed.
  
  this problem happens when a gateway is attempted in the dialplan and
  the device is not available i may want to do fax to mail in the server
  it will not be allowed.
  
  instead of checking only AST_FAX_TECH_GATEWAY also check gateway_id

Modified:
    team/irroot/t38gateway-1.8/res/res_fax.c

Modified: team/irroot/t38gateway-1.8/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-1.8/res/res_fax.c?view=diff&rev=338993&r1=338992&r2=338993
==============================================================================
--- team/irroot/t38gateway-1.8/res/res_fax.c (original)
+++ team/irroot/t38gateway-1.8/res/res_fax.c Mon Oct  3 06:37:30 2011
@@ -1721,7 +1721,7 @@
 	ast_string_field_set(details, error, "INIT_ERROR");
 	set_channel_variables(chan, details);
 
-	if (details->caps & AST_FAX_TECH_GATEWAY) {
+	if ((details->caps & AST_FAX_TECH_GATEWAY) && (details->gateway_id > 0)) {
 		ast_string_field_set(details, resultstr, "can't receive a fax on a channel with a T.38 gateway");
 		set_channel_variables(chan, details);
 		ast_log(LOG_ERROR, "executing ReceiveFAX on a channel with a T.38 Gateway is not supported\n");
@@ -2201,7 +2201,7 @@
 	ast_string_field_set(details, error, "INIT_ERROR");
 	set_channel_variables(chan, details);
 
-	if (details->caps & AST_FAX_TECH_GATEWAY) {
+	if ((details->caps & AST_FAX_TECH_GATEWAY) && (details->gateway_id > 0)) {
 		ast_string_field_set(details, resultstr, "can't send a fax on a channel with a T.38 gateway");
 		set_channel_variables(chan, details);
 		ast_log(LOG_ERROR, "executing SendFAX on a channel with a T.38 Gateway is not supported\n");
@@ -2929,8 +2929,6 @@
 				ast_channel_make_compatible(chan, peer);
 			}
 		}
-
-		details->caps &= ~AST_FAX_TECH_GATEWAY;
 
 		ao2_ref(details, -1);
 		return NULL;
@@ -3904,7 +3902,6 @@
 		} else if (ast_false(val)) {
 			ast_framehook_detach(chan, details->gateway_id);
 			details->gateway_id = -1;
-			details->caps &= ~AST_FAX_TECH_GATEWAY;
 		} else {
 			ast_log(LOG_WARNING, "Unsupported value '%s' passed to FAXOPT(%s).\n", value, data);
 		}




More information about the asterisk-commits mailing list