app_cdr.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Asterisk -- A telephony toolkit for Linux.
  3. *
  4. * Applictions connected with CDR engine
  5. *
  6. * Copyright (C) 2003, Digium
  7. *
  8. * Martin Pycko <martinp@digium.com>
  9. *
  10. * This program is free software, distributed under the terms of
  11. * the GNU General Public License
  12. */
  13. #include <sys/types.h>
  14. #include <asterisk/channel.h>
  15. #include <asterisk/module.h>
  16. #include <asterisk/pbx.h>
  17. #include <stdlib.h>
  18. static char *tdesc = "Make sure asterisk doesn't save CDR for a certain call";
  19. static char *nocdr_descrip = "NoCDR(): makes sure there won't be any CDR written for a certain call";
  20. static char *nocdr_app = "NoCDR";
  21. static char *nocdr_synopsis = "Make sure asterisk doesn't save CDR for a certain call";
  22. STANDARD_LOCAL_USER;
  23. LOCAL_USER_DECL;
  24. static int nocdr_exec(struct ast_channel *chan, void *data)
  25. {
  26. if (chan->cdr) {
  27. ast_cdr_free(chan->cdr);
  28. chan->cdr = NULL;
  29. }
  30. return 0;
  31. }
  32. int unload_module(void)
  33. {
  34. STANDARD_HANGUP_LOCALUSERS;
  35. return ast_unregister_application(nocdr_app);
  36. }
  37. int load_module(void)
  38. {
  39. return ast_register_application(nocdr_app, nocdr_exec, nocdr_synopsis, nocdr_descrip);
  40. }
  41. char *description(void)
  42. {
  43. return tdesc;
  44. }
  45. int usecount(void)
  46. {
  47. int res;
  48. STANDARD_USECOUNT(res);
  49. return res;
  50. }
  51. char *key()
  52. {
  53. return ASTERISK_GPL_KEY;
  54. }