[Asterisk-cvs] asterisk/res res_agi.c,1.1,1.2

markster at lists.digium.com markster at lists.digium.com
Sat Jul 17 16:39:37 CDT 2004


Update of /usr/cvsroot/asterisk/res
In directory localhost.localdomain:/tmp/cvs-serv20033/res

Modified Files:
	res_agi.c 
Log Message:
First pass at AGI registration


Index: res_agi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_agi.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- res_agi.c	17 Jul 2004 20:12:28 -0000	1.1
+++ res_agi.c	17 Jul 2004 20:25:39 -0000	1.2
@@ -1160,6 +1160,35 @@
 	return 0;
 }
 
+static int agi_register(agi_command *agi)
+{
+	int x;
+	for (x=0;x<MAX_COMMANDS - 1;x++) {
+		if (commands[x].cmda[0] == agi->cmda[0]) {
+			ast_log(LOG_WARNING, "Command already registered!\n");
+			return -1;
+		}
+	}
+	for (x=0;x<MAX_COMMANDS - 1;x++) {
+		if (!commands[x].cmda[0]) {
+			commands[x] = *agi;
+			return 0;
+		}
+	}
+	ast_log(LOG_WARNING, "No more room for new commands!\n");
+	return -1;
+}
+
+static void agi_unregister(agi_command *agi)
+{
+	int x;
+	for (x=0;x<MAX_COMMANDS - 1;x++) {
+		if (commands[x].cmda[0] == agi->cmda[0]) {
+			memset(&commands[x], 0, sizeof(agi_command));
+		}
+	}
+}
+
 static agi_command *find_command(char *cmds[], int exact)
 {
 	int x;




More information about the svn-commits mailing list