1999-10-22 01:49:23 +00:00
|
|
|
/*
|
|
|
|
* Asterisk -- A telephony toolkit for Linux.
|
|
|
|
*
|
|
|
|
* Skeleton application
|
|
|
|
*
|
1999-12-11 20:09:45 +00:00
|
|
|
* Copyright (C) 1999, Mark Spencer
|
1999-10-22 01:49:23 +00:00
|
|
|
*
|
|
|
|
* Mark Spencer <markster@linux-support.net>
|
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
* the GNU General Public License
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <asterisk/file.h>
|
|
|
|
#include <asterisk/logger.h>
|
|
|
|
#include <asterisk/channel.h>
|
|
|
|
#include <asterisk/pbx.h>
|
2000-01-02 20:59:00 +00:00
|
|
|
#include <asterisk/module.h>
|
2004-06-22 19:32:52 +00:00
|
|
|
#include <asterisk/lock.h>
|
1999-10-22 01:49:23 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
static char *tdesc = "Trivial skeleton Application";
|
|
|
|
static char *app = "skel";
|
2003-11-11 07:56:13 +00:00
|
|
|
static char *synopsis =
|
|
|
|
" This is a skeleton application that shows you the basic structure to create your\n"
|
|
|
|
"own asterisk applications.\n";
|
1999-10-22 01:49:23 +00:00
|
|
|
|
2000-01-02 20:59:00 +00:00
|
|
|
STANDARD_LOCAL_USER;
|
|
|
|
|
|
|
|
LOCAL_USER_DECL;
|
1999-10-22 01:49:23 +00:00
|
|
|
|
|
|
|
static int skel_exec(struct ast_channel *chan, void *data)
|
|
|
|
{
|
|
|
|
int res=0;
|
2000-01-02 20:59:00 +00:00
|
|
|
struct localuser *u;
|
1999-10-22 01:49:23 +00:00
|
|
|
if (!data) {
|
|
|
|
ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2000-01-02 20:59:00 +00:00
|
|
|
LOCAL_USER_ADD(u);
|
1999-10-22 01:49:23 +00:00
|
|
|
/* Do our thing here */
|
2000-01-02 20:59:00 +00:00
|
|
|
LOCAL_USER_REMOVE(u);
|
1999-10-22 01:49:23 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
int unload_module(void)
|
|
|
|
{
|
2000-01-02 20:59:00 +00:00
|
|
|
STANDARD_HANGUP_LOCALUSERS;
|
1999-10-22 01:49:23 +00:00
|
|
|
return ast_unregister_application(app);
|
|
|
|
}
|
|
|
|
|
|
|
|
int load_module(void)
|
|
|
|
{
|
2003-11-11 07:56:13 +00:00
|
|
|
return ast_register_application(app, skel_exec, synopsis, tdesc);
|
1999-10-22 01:49:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char *description(void)
|
|
|
|
{
|
|
|
|
return tdesc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int usecount(void)
|
|
|
|
{
|
|
|
|
int res;
|
2000-01-02 20:59:00 +00:00
|
|
|
STANDARD_USECOUNT(res);
|
1999-10-22 01:49:23 +00:00
|
|
|
return res;
|
|
|
|
}
|
2001-03-07 00:52:22 +00:00
|
|
|
|
|
|
|
char *key()
|
|
|
|
{
|
|
|
|
return ASTERISK_GPL_KEY;
|
|
|
|
}
|