diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-17 20:25:39 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-17 20:25:39 +0000 |
commit | fb32f743b5027c4e574d2039cb79026cc698d157 (patch) | |
tree | 92e188a34223a21b3056199e2c820976603f24b4 /res/res_agi.c | |
parent | 2cb447cfc6a756bf43ea4748101bb0664ab90064 (diff) |
First pass at AGI registration
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3461 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rwxr-xr-x | res/res_agi.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/res/res_agi.c b/res/res_agi.c index ba4ab0ec2..e96807b3f 100755 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1160,6 +1160,35 @@ static int help_workhorse(int fd, char *match[]) 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; |