VMCOUNT dialplan function. More...
#include "asterisk.h"
#include <dirent.h>
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
Go to the source code of this file.
Functions | |
static int | acf_vmcount_exec (struct ast_channel *chan, const char *cmd, char *argsstr, char *buf, size_t len) |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Indicator for whether a voice mailbox has messages in a given folder.") | |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_custom_function | acf_vmcount |
VMCOUNT dialplan function.
Definition in file func_vmcount.c.
static int acf_vmcount_exec | ( | struct ast_channel * | chan, | |
const char * | cmd, | |||
char * | argsstr, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 70 of file func_vmcount.c.
References args, AST_APP_ARG, ast_app_messagecount(), AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, ast_strlen_zero(), and context.
00071 { 00072 char *context; 00073 AST_DECLARE_APP_ARGS(args, 00074 AST_APP_ARG(vmbox); 00075 AST_APP_ARG(folder); 00076 ); 00077 00078 buf[0] = '\0'; 00079 00080 if (ast_strlen_zero(argsstr)) 00081 return -1; 00082 00083 AST_STANDARD_APP_ARGS(args, argsstr); 00084 00085 if (strchr(args.vmbox, '@')) { 00086 context = args.vmbox; 00087 args.vmbox = strsep(&context, "@"); 00088 } else { 00089 context = "default"; 00090 } 00091 00092 if (ast_strlen_zero(args.folder)) { 00093 args.folder = "INBOX"; 00094 } 00095 00096 snprintf(buf, len, "%d", ast_app_messagecount(context, args.vmbox, args.folder)); 00097 00098 return 0; 00099 }
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"Indicator for whether a voice mailbox has messages in a given folder." | ||||
) |
static int load_module | ( | void | ) | [static] |
Definition at line 112 of file func_vmcount.c.
References ast_custom_function_register.
00113 { 00114 return ast_custom_function_register(&acf_vmcount); 00115 }
static int unload_module | ( | void | ) | [static] |
Definition at line 107 of file func_vmcount.c.
References ast_custom_function_unregister().
00108 { 00109 return ast_custom_function_unregister(&acf_vmcount); 00110 }
struct ast_custom_function acf_vmcount [static] |
{ .name = "VMCOUNT", .read = acf_vmcount_exec, .read_max = 12, }
Definition at line 101 of file func_vmcount.c.