Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
Functions | Variables
func_vmcount.c File Reference

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"
Include dependency graph for func_vmcount.c:

Go to the source code of this file.

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
static int acf_vmcount_exec (struct ast_channel *chan, const char *cmd, char *argsstr, char *buf, size_t len)
 
struct ast_moduleAST_MODULE_SELF_SYM (void)
 
static int load_module (void)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Indicator for whether a voice mailbox has messages in a given folder." , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
 
static struct ast_custom_function acf_vmcount
 
static const struct ast_module_infoast_module_info = &__mod_info
 

Detailed Description

VMCOUNT dialplan function.

Author
Tilghman Lesher aster.nosp@m.isk-.nosp@m.vmcou.nosp@m.nt-f.nosp@m.unc@t.nosp@m.he-t.nosp@m.ilghm.nosp@m.an.c.nosp@m.om

Definition in file func_vmcount.c.

Function Documentation

◆ __reg_module()

static void __reg_module ( void  )
static

Definition at line 128 of file func_vmcount.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 128 of file func_vmcount.c.

◆ acf_vmcount_exec()

static int acf_vmcount_exec ( struct ast_channel chan,
const char *  cmd,
char *  argsstr,
char *  buf,
size_t  len 
)
static

Definition at line 75 of file func_vmcount.c.

76{
77 int total = 0;
78 char *mailbox = NULL;
80 AST_APP_ARG(vmbox);
81 AST_APP_ARG(folder);
82 );
83
84 buf[0] = '\0';
85
86 if (ast_strlen_zero(argsstr))
87 return -1;
88
90
91 if (ast_strlen_zero(args.vmbox)) {
92 return -1;
93 }
94
95 if (ast_strlen_zero(args.folder)) {
96 args.folder = "INBOX";
97 }
98
99 while ((mailbox = strsep(&args.vmbox, "&"))) {
100 int c;
101 if (ast_strlen_zero(mailbox)) {
102 continue;
103 }
104 c = ast_app_messagecount(mailbox, args.folder);
105 total += (c > 0 ? c : 0);
106 }
107 snprintf(buf, len, "%d", total);
108
109 return 0;
110}
char * strsep(char **str, const char *delims)
char buf[BUFSIZE]
Definition eagi_proxy.c:66
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define AST_APP_ARG(name)
Define an application argument.
int ast_app_messagecount(const char *mailbox_id, const char *folder)
Get the number of messages in a given mailbox folder.
Definition main/app.c:645
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
static int total
Definition res_adsi.c:970
static struct @519 args
#define NULL
Definition resample.c:96
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition strings.h:65
static struct test_val c

References args, AST_APP_ARG, ast_app_messagecount(), AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, ast_strlen_zero(), buf, c, len(), NULL, strsep(), and total.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 128 of file func_vmcount.c.

◆ load_module()

static int load_module ( void  )
static

Definition at line 123 of file func_vmcount.c.

124{
126}
static struct ast_custom_function acf_vmcount
#define ast_custom_function_register(acf)
Register a custom function.
Definition pbx.h:1562

References acf_vmcount, and ast_custom_function_register.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 118 of file func_vmcount.c.

119{
121}
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.

References acf_vmcount, and ast_custom_function_unregister().

Variable Documentation

◆ __mod_info

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Indicator for whether a voice mailbox has messages in a given folder." , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 128 of file func_vmcount.c.

◆ acf_vmcount

struct ast_custom_function acf_vmcount
static
Initial value:
= {
.name = "VMCOUNT",
.read_max = 12,
}
static int acf_vmcount_exec(struct ast_channel *chan, const char *cmd, char *argsstr, char *buf, size_t len)

Definition at line 112 of file func_vmcount.c.

112 {
113 .name = "VMCOUNT",
114 .read = acf_vmcount_exec,
115 .read_max = 12,
116};

Referenced by load_module(), and unload_module().

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 128 of file func_vmcount.c.