[asterisk-commits] mnicholson: trunk r158876 - in /trunk: include/asterisk/ main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Nov 24 15:56:22 CST 2008


Author: mnicholson
Date: Mon Nov 24 15:56:22 2008
New Revision: 158876

URL: http://svn.digium.com/view/asterisk?view=rev&rev=158876
Log:
Added EVENT_FLAG_AGI and used it for manager calls in res_agi.c

(closes issue #13873)
Reported by: fnordian
Patches:
      ami_agievent.patch uploaded by fnordian (license 110)

Modified:
    trunk/include/asterisk/manager.h
    trunk/main/manager.c
    trunk/res/res_agi.c

Modified: trunk/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/manager.h?view=diff&rev=158876&r1=158875&r2=158876
==============================================================================
--- trunk/include/asterisk/manager.h (original)
+++ trunk/include/asterisk/manager.h Mon Nov 24 15:56:22 2008
@@ -71,6 +71,7 @@
 #define EVENT_FLAG_CDR			(1 << 10) /* CDR events */
 #define EVENT_FLAG_DIALPLAN		(1 << 11) /* Dialplan events (VarSet, NewExten) */
 #define EVENT_FLAG_ORIGINATE	(1 << 12) /* Originate a call to an extension */
+#define EVENT_FLAG_AGI			(1 << 13) /* AGI events */
 /*@} */
 
 /*! \brief Export manager structures */

Modified: trunk/main/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/main/manager.c?view=diff&rev=158876&r1=158875&r2=158876
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Mon Nov 24 15:56:22 2008
@@ -336,6 +336,7 @@
 	{ EVENT_FLAG_CDR, "cdr" },
 	{ EVENT_FLAG_DIALPLAN, "dialplan" },
 	{ EVENT_FLAG_ORIGINATE, "originate" },
+	{ EVENT_FLAG_AGI, "agi" },
 	{ -1, "all" },
 	{ 0, "none" },
 };

Modified: trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_agi.c?view=diff&rev=158876&r1=158875&r2=158876
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Mon Nov 24 15:56:22 2008
@@ -620,7 +620,7 @@
 	   care of AGI commands on this channel can decide which AGI commands
 	   to execute based on the setup info */
 	ast_uri_encode(agi_buffer, ami_buffer, AMI_BUF_SIZE, 1);
-	manager_event(EVENT_FLAG_CALL, "AsyncAGI", "SubEvent: Start\r\nChannel: %s\r\nEnv: %s\r\n", chan->name, ami_buffer);
+	manager_event(EVENT_FLAG_AGI, "AsyncAGI", "SubEvent: Start\r\nChannel: %s\r\nEnv: %s\r\n", chan->name, ami_buffer);
 	while (1) {
 		/* bail out if we need to hangup */
 		if (ast_check_hangup(chan)) {
@@ -653,9 +653,9 @@
 			agi_buffer[res] = '\0';
 			ast_uri_encode(agi_buffer, ami_buffer, AMI_BUF_SIZE, 1);
 			if (ast_strlen_zero(cmd->cmd_id))
-				manager_event(EVENT_FLAG_CALL, "AsyncAGI", "SubEvent: Exec\r\nChannel: %s\r\nResult: %s\r\n", chan->name, ami_buffer);
+				manager_event(EVENT_FLAG_AGI, "AsyncAGI", "SubEvent: Exec\r\nChannel: %s\r\nResult: %s\r\n", chan->name, ami_buffer);
 			else
-				manager_event(EVENT_FLAG_CALL, "AsyncAGI", "SubEvent: Exec\r\nChannel: %s\r\nCommandID: %s\r\nResult: %s\r\n", chan->name, cmd->cmd_id, ami_buffer);
+				manager_event(EVENT_FLAG_AGI, "AsyncAGI", "SubEvent: Exec\r\nChannel: %s\r\nCommandID: %s\r\nResult: %s\r\n", chan->name, cmd->cmd_id, ami_buffer);
 			free_agi_cmd(cmd);
 		} else {
 			/* no command so far, wait a bit for a frame to read */
@@ -685,7 +685,7 @@
 quit:
 	/* notify manager users this channel cannot be
 	   controlled anymore by Async AGI */
-	manager_event(EVENT_FLAG_CALL, "AsyncAGI", "SubEvent: End\r\nChannel: %s\r\n", chan->name);
+	manager_event(EVENT_FLAG_AGI, "AsyncAGI", "SubEvent: End\r\nChannel: %s\r\n", chan->name);
 
 	/* close the pipe */
 	close(fds[0]);
@@ -2701,7 +2701,7 @@
 	char *ami_cmd = ast_strdupa(buf);
 	int command_id = ast_random(), resultcode = 200;
 
-	manager_event(EVENT_FLAG_CALL, "AGIExec",
+	manager_event(EVENT_FLAG_AGI, "AGIExec",
 			"SubEvent: Start\r\n"
 			"Channel: %s\r\n"
 			"CommandId: %d\r\n"
@@ -2721,7 +2721,7 @@
 		case RESULT_FAILURE: ami_res = "Failure"; resultcode = -1; break;
 		case RESULT_SUCCESS: ami_res = "Success"; resultcode = 200; break;
 		}
-		manager_event(EVENT_FLAG_CALL, "AGIExec",
+		manager_event(EVENT_FLAG_AGI, "AGIExec",
 				"SubEvent: End\r\n"
 				"Channel: %s\r\n"
 				"CommandId: %d\r\n"
@@ -2745,7 +2745,7 @@
 		}
 	} else if ((c = find_command(argv, 0))) {
 		ast_agi_send(agi->fd, chan, "511 Command Not Permitted on a dead channel\n");
-		manager_event(EVENT_FLAG_CALL, "AGIExec",
+		manager_event(EVENT_FLAG_AGI, "AGIExec",
 				"SubEvent: End\r\n"
 				"Channel: %s\r\n"
 				"CommandId: %d\r\n"
@@ -2754,7 +2754,7 @@
 				"Result: Command not permitted on a dead channel\r\n", chan->name, command_id, ami_cmd);
 	} else {
 		ast_agi_send(agi->fd, chan, "510 Invalid or unknown command\n");
-		manager_event(EVENT_FLAG_CALL, "AGIExec",
+		manager_event(EVENT_FLAG_AGI, "AGIExec",
 				"SubEvent: End\r\n"
 				"Channel: %s\r\n"
 				"CommandId: %d\r\n"
@@ -3243,7 +3243,7 @@
 	(void) ast_agi_register_multiple(ast_module_info->self, commands, ARRAY_LEN(commands));
 	ast_register_application(deadapp, deadagi_exec, deadsynopsis, descrip);
 	ast_register_application(eapp, eagi_exec, esynopsis, descrip);
-	ast_manager_register2("AGI", EVENT_FLAG_CALL, action_add_agi_cmd, "Add an AGI command to execute by Async AGI", mandescr_asyncagi);
+	ast_manager_register2("AGI", EVENT_FLAG_AGI, action_add_agi_cmd, "Add an AGI command to execute by Async AGI", mandescr_asyncagi);
 	return ast_register_application(app, agi_exec, synopsis, descrip);
 }
 




More information about the asterisk-commits mailing list