app_skel.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #include <asterisk/file.h>
  14. #include <asterisk/logger.h>
  15. #include <asterisk/channel.h>
  16. #include <asterisk/pbx.h>
  17. #include <asterisk/module.h>
  18. #include <asterisk/lock.h>
  19. #include <stdlib.h>
  20. #include <unistd.h>
  21. #include <string.h>
  22. static char *tdesc = "Trivial skeleton Application";
  23. static char *app = "skel";
  24. static char *synopsis =
  25. " This is a skeleton application that shows you the basic structure to create your\n"
  26. "own asterisk applications.\n";
  27. STANDARD_LOCAL_USER;
  28. LOCAL_USER_DECL;
  29. static int skel_exec(struct ast_channel *chan, void *data)
  30. {
  31. int res=0;
  32. struct localuser *u;
  33. if (!data) {
  34. ast_log(LOG_WARNING, "skel requires an argument (filename)\n");
  35. return -1;
  36. }
  37. LOCAL_USER_ADD(u);
  38. /* Do our thing here */
  39. LOCAL_USER_REMOVE(u);
  40. return res;
  41. }
  42. int unload_module(void)
  43. {
  44. STANDARD_HANGUP_LOCALUSERS;
  45. return ast_unregister_application(app);
  46. }
  47. int load_module(void)
  48. {
  49. return ast_register_application(app, skel_exec, synopsis, tdesc);
  50. }
  51. char *description(void)
  52. {
  53. return tdesc;
  54. }
  55. int usecount(void)
  56. {
  57. int res;
  58. STANDARD_USECOUNT(res);
  59. return res;
  60. }
  61. char *key()
  62. {
  63. return ASTERISK_GPL_KEY;
  64. }