[asterisk-commits] mnicholson: branch irroot/t38gateway-trunk r324478 - in /team/irroot/t38gatew...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 22 13:17:19 CDT 2011


Author: mnicholson
Date: Wed Jun 22 13:17:15 2011
New Revision: 324478

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=324478
Log:
Consolidated ReceiveFAXStatus and SendFAXStatus to single FAXStatus event. Also
added support for gateway events and added a few gateway events.

Modified:
    team/irroot/t38gateway-trunk/CHANGES
    team/irroot/t38gateway-trunk/res/res_fax.c

Modified: team/irroot/t38gateway-trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-trunk/CHANGES?view=diff&rev=324478&r1=324477&r2=324478
==============================================================================
--- team/irroot/t38gateway-trunk/CHANGES (original)
+++ team/irroot/t38gateway-trunk/CHANGES Wed Jun 22 13:17:15 2011
@@ -149,6 +149,12 @@
  * An autoservice is now started by default for pbx_lua channels.  It can be
    stopped and restarted using the autoservice_stop() and autoservice_start()
    functions.
+
+res_fax
+--------------------------
+ * The ReceiveFAXStatus and SendFAXStatus manager events have been consolidated
+   into a FAXStatus event with an 'Operation' header that will be either
+   'send', 'receive', and 'gateway'.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.2 to Asterisk 1.8 ----------------

Modified: team/irroot/t38gateway-trunk/res/res_fax.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/t38gateway-trunk/res/res_fax.c?view=diff&rev=324478&r1=324477&r2=324478
==============================================================================
--- team/irroot/t38gateway-trunk/res/res_fax.c (original)
+++ team/irroot/t38gateway-trunk/res/res_fax.c Wed Jun 22 13:17:15 2011
@@ -982,9 +982,6 @@
 static int report_fax_status(struct ast_channel *chan, struct ast_fax_session_details *details, const char *status)
 {
 	char *filenames = generate_filenames_string(details, "FileName: ", "\r\n");
-	if (!filenames) {
-		return 1;
-	}
 
 	ast_channel_lock(chan);
 	if (details->option.statusevents) {
@@ -992,24 +989,30 @@
 
 		get_manager_event_info(chan, &info);
 		manager_event(EVENT_FLAG_CALL,
-			      (details->caps & AST_FAX_TECH_RECEIVE) ? "ReceiveFAXStatus" : "SendFAXStatus",
+			      "FAXStatus",
+			      "Operation: %s\r\n"
 			      "Status: %s\r\n"
 			      "Channel: %s\r\n"
 			      "Context: %s\r\n"
 			      "Exten: %s\r\n"
 			      "CallerID: %s\r\n"
 			      "LocalStationID: %s\r\n"
-			      "%s\r\n",
+			      "%s%s",
+			      (details->caps & AST_FAX_TECH_GATEWAY) ? "gateway" : (details->caps & AST_FAX_TECH_RECEIVE) ? "receive" : "send",
 			      status,
 			      chan->name,
 			      info.context,
 			      info.exten,
 			      info.cid,
 			      details->localstationid,
-			      filenames);
+			      S_OR(filenames, ""),
+			      filenames ? "\r\n" : "");
 	}
 	ast_channel_unlock(chan);
-	ast_free(filenames);
+
+	if (filenames) {
+		ast_free(filenames);
+	}
 
 	return 0;
 }
@@ -2354,10 +2357,7 @@
 	details->caps = AST_FAX_TECH_GATEWAY;
 	if (!(gateway->s = fax_session_new(details, chan, NULL, NULL))) {
 		ast_log(LOG_ERROR, "Can't create a FAX session, gateway attempt failed.\n");
-#if 0
-		/* XXX make report_fax_status() support the gateway */
 		report_fax_status(chan, details, "No Available Resource");
-#endif
 		return -1;
 	}
 
@@ -2366,6 +2366,8 @@
 		gateway->s = NULL;
 		return -1;
 	}
+
+	report_fax_status(chan, details, "FAX Transmission In Progress");
 
 	return 0;
 }
@@ -2501,6 +2503,7 @@
 			} else {
 				gateway->t38_state = T38_STATE_NEGOTIATED;
 				control_params->request_response = AST_T38_NEGOTIATED;
+				report_fax_status(chan, details, "T.38 Negotiated");
 			}
 
 			/* XXX check return value? */
@@ -2542,6 +2545,7 @@
 			fax_gateway_indicate_t38(chan, active, control_params);
 		} else {
 			gateway->t38_state = T38_STATE_NEGOTIATED;
+			report_fax_status(chan, details, "T.38 Negotiated");
 		}
 
 		ao2_ref(details, -1);




More information about the asterisk-commits mailing list