[svn-commits] oej: branch oej/fagi-adventures r103490 - in /team/oej/fagi-adventures: inclu...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 12 15:13:38 CST 2008


Author: oej
Date: Tue Feb 12 15:13:36 2008
New Revision: 103490

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103490
Log:
Add AGIstate to manager events NewExten and CoreShowChannels

This is to tell manager controllers that these events are not generated from the dialplan, but from an AGI control script.

We might want to add a manager event when the AGI script releases control too, so we can follow the sequence of events.
AGI starts with newevent with an AGI application, then runs until there's no more AGIstates reported (or the new
end-of-agi-control manager event that only exists in my imagination yet).


Modified:
    team/oej/fagi-adventures/include/asterisk/pbx.h
    team/oej/fagi-adventures/main/manager.c
    team/oej/fagi-adventures/main/pbx.c
    team/oej/fagi-adventures/pbx/pbx_realtime.c

Modified: team/oej/fagi-adventures/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/oej/fagi-adventures/include/asterisk/pbx.h?view=diff&rev=103490&r1=103489&r2=103490
==============================================================================
--- team/oej/fagi-adventures/include/asterisk/pbx.h (original)
+++ team/oej/fagi-adventures/include/asterisk/pbx.h Tue Feb 12 15:13:36 2008
@@ -968,6 +968,9 @@
 									 struct ast_context *bypass, struct pbx_find_info *q,
 									 const char *context, const char *exten, int priority,
 									 const char *label, const char *callerid, enum ext_match_t action);
+
+/*! \brief Function in pbx.c that propably should be somewhere else, but not in res_agi, since it's a loadable module */
+const char *agi_state(struct ast_channel *chan);
 	
 
 

Modified: team/oej/fagi-adventures/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/fagi-adventures/main/manager.c?view=diff&rev=103490&r1=103489&r2=103490
==============================================================================
--- team/oej/fagi-adventures/main/manager.c (original)
+++ team/oej/fagi-adventures/main/manager.c Tue Feb 12 15:13:36 2008
@@ -2506,9 +2506,13 @@
 			"AccountCode: %s\r\n"
 			"BridgedChannel: %s\r\n"
 			"BridgedUniqueID: %s\r\n"
-			"\r\n", c->name, c->uniqueid, c->context, c->exten, c->priority, c->_state, ast_state2str(c->_state),
+			"AGIstate: %s\r\n"
+			"\r\n",
+			c->name, c->uniqueid, c->context, c->exten, c->priority, c->_state, ast_state2str(c->_state),
 			c->appl ? c->appl : "", c->data ? S_OR(c->data, ""): "",
-			S_OR(c->cid.cid_num, ""), durbuf, S_OR(c->accountcode, ""), bc ? bc->name : "", bc ? bc->uniqueid : "");
+			S_OR(c->cid.cid_num, ""), durbuf, S_OR(c->accountcode, ""), bc ? bc->name : "", bc ? bc->uniqueid : "",
+			agi_state(c)
+			);
 		ast_channel_unlock(c);
 		numchans++;
 	}

Modified: team/oej/fagi-adventures/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/fagi-adventures/main/pbx.c?view=diff&rev=103490&r1=103489&r2=103490
==============================================================================
--- team/oej/fagi-adventures/main/pbx.c (original)
+++ team/oej/fagi-adventures/main/pbx.c Tue Feb 12 15:13:36 2008
@@ -2608,6 +2608,18 @@
 	pbx_substitute_variables_helper(c, e->data, passdata, datalen - 1);
 }
 
+/*! \brief report AGI state for channel */
+const char *agi_state(struct ast_channel *chan)
+{
+	if (ast_test_flag(chan, AST_FLAG_AGI))
+		return "AGI";
+	if (ast_test_flag(chan, AST_FLAG_FASTAGI))
+		return "FASTAGI";
+	if (ast_test_flag(chan, AST_FLAG_ASYNCAGI))
+		return "ASYNCAGI";
+	return "";
+}
+
 /*! 
  * \brief The return value depends on the action:
  *
@@ -2685,8 +2697,9 @@
 					"Priority: %d\r\n"
 					"Application: %s\r\n"
 					"AppData: %s\r\n"
-					"Uniqueid: %s\r\n",
-					c->name, c->context, c->exten, c->priority, app->name, passdata, c->uniqueid);
+					"Uniqueid: %s\r\n"
+					"AGIstate: %s\r\n",
+					c->name, c->context, c->exten, c->priority, app->name, passdata, c->uniqueid, agi_state(c));
 			return pbx_exec(c, app, passdata);	/* 0 on success, -1 on failure */
 		}
 	} else if (q.swo) {	/* not found here, but in another switch */

Modified: team/oej/fagi-adventures/pbx/pbx_realtime.c
URL: http://svn.digium.com/view/asterisk/team/oej/fagi-adventures/pbx/pbx_realtime.c?view=diff&rev=103490&r1=103489&r2=103490
==============================================================================
--- team/oej/fagi-adventures/pbx/pbx_realtime.c (original)
+++ team/oej/fagi-adventures/pbx/pbx_realtime.c Tue Feb 12 15:13:36 2008
@@ -202,8 +202,9 @@
 							  "Priority: %d\r\n"
 							  "Application: %s\r\n"
 							  "AppData: %s\r\n"
-							  "Uniqueid: %s\r\n",
-							  chan->name, chan->context, chan->exten, chan->priority, app, !ast_strlen_zero(appdata) ? appdata : "(NULL)", chan->uniqueid);
+							  "Uniqueid: %s\r\n"
+                                        		  "AGIstate: %s\r\n",
+							  chan->name, chan->context, chan->exten, chan->priority, app, !ast_strlen_zero(appdata) ? appdata : "(NULL)", chan->uniqueid, agi_state(chan));
 				
 				res = pbx_exec(chan, a, appdata);
 			} else




More information about the svn-commits mailing list