call ast_register_application properly
[asterisk/asterisk.git] / apps / app_skel.c
1 /*
2  * Asterisk -- A telephony toolkit for Linux.
3  *
4  * Skeleton application
5  * 
6  * Copyright (C) 1999, Mark Spencer
7  *
8  * Mark Spencer <markster@linux-support.net>
9  *
10  * This program is free software, distributed under the terms of
11  * the GNU General Public License
12  */
13
14 #include <asterisk/file.h>
15 #include <asterisk/logger.h>
16 #include <asterisk/channel.h>
17 #include <asterisk/pbx.h>
18 #include <asterisk/module.h>
19 #include <stdlib.h>
20 #include <unistd.h>
21 #include <string.h>
22 #include <stdlib.h>
23 #include <pthread.h>
24
25 static char *tdesc = "Trivial skeleton Application";
26 static char *app = "skel";
27 static char *synopsis = 
28 "  This is a skeleton application that shows you the basic structure to create your\n"
29 "own asterisk applications.\n";
30
31 STANDARD_LOCAL_USER;
32
33 LOCAL_USER_DECL;
34
35 static int skel_exec(struct ast_channel *chan, void *data)
36 {
37         int res=0;
38         struct localuser *u;
39         if (!data) {
40                 ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
41                 return -1;
42         }
43         LOCAL_USER_ADD(u);
44         /* Do our thing here */
45         LOCAL_USER_REMOVE(u);
46         return res;
47 }
48
49 int unload_module(void)
50 {
51         STANDARD_HANGUP_LOCALUSERS;
52         return ast_unregister_application(app);
53 }
54
55 int load_module(void)
56 {
57         return ast_register_application(app, skel_exec, synopsis, tdesc);
58 }
59
60 char *description(void)
61 {
62         return tdesc;
63 }
64
65 int usecount(void)
66 {
67         int res;
68         STANDARD_USECOUNT(res);
69         return res;
70 }
71
72 char *key()
73 {
74         return ASTERISK_GPL_KEY;
75 }