Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "asterisk.h"
00029
00030 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 153365 $")
00031
00032 #include <dirent.h>
00033
00034 #include "asterisk/file.h"
00035 #include "asterisk/channel.h"
00036 #include "asterisk/pbx.h"
00037 #include "asterisk/module.h"
00038 #include "asterisk/lock.h"
00039 #include "asterisk/utils.h"
00040 #include "asterisk/app.h"
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 static int acf_vmcount_exec(struct ast_channel *chan, const char *cmd, char *argsstr, char *buf, size_t len)
00067 {
00068 char *context;
00069 AST_DECLARE_APP_ARGS(args,
00070 AST_APP_ARG(vmbox);
00071 AST_APP_ARG(folder);
00072 );
00073
00074 buf[0] = '\0';
00075
00076 if (ast_strlen_zero(argsstr))
00077 return -1;
00078
00079 AST_STANDARD_APP_ARGS(args, argsstr);
00080
00081 if (strchr(args.vmbox, '@')) {
00082 context = args.vmbox;
00083 args.vmbox = strsep(&context, "@");
00084 } else {
00085 context = "default";
00086 }
00087
00088 if (ast_strlen_zero(args.folder)) {
00089 args.folder = "INBOX";
00090 }
00091
00092 snprintf(buf, len, "%d", ast_app_messagecount(context, args.vmbox, args.folder));
00093
00094 return 0;
00095 }
00096
00097 struct ast_custom_function acf_vmcount = {
00098 .name = "VMCOUNT",
00099 .read = acf_vmcount_exec,
00100 };
00101
00102 static int unload_module(void)
00103 {
00104 return ast_custom_function_unregister(&acf_vmcount);
00105 }
00106
00107 static int load_module(void)
00108 {
00109 return ast_custom_function_register(&acf_vmcount);
00110 }
00111
00112 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Indicator for whether a voice mailbox has messages in a given folder.");