Asterisk - The Open Source Telephony Project GIT-master-3dae2cf
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 = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .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 125 of file func_vmcount.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

Definition at line 125 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 72 of file func_vmcount.c.

73{
74 int total = 0;
75 char *mailbox = NULL;
77 AST_APP_ARG(vmbox);
78 AST_APP_ARG(folder);
79 );
80
81 buf[0] = '\0';
82
83 if (ast_strlen_zero(argsstr))
84 return -1;
85
87
88 if (ast_strlen_zero(args.vmbox)) {
89 return -1;
90 }
91
92 if (ast_strlen_zero(args.folder)) {
93 args.folder = "INBOX";
94 }
95
96 while ((mailbox = strsep(&args.vmbox, "&"))) {
97 int c;
99 continue;
100 }
102 total += (c > 0 ? c : 0);
103 }
104 snprintf(buf, len, "%d", total);
105
106 return 0;
107}
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.
char * strsep(char **str, const char *delims)
static int total
Definition: res_adsi.c:970
#define NULL
Definition: resample.c:96
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
const char * args
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(), voicemailpwcheck::mailbox, NULL, strsep(), and total.

◆ AST_MODULE_SELF_SYM()

struct ast_module * AST_MODULE_SELF_SYM ( void  )

Definition at line 125 of file func_vmcount.c.

◆ load_module()

static int load_module ( void  )
static

Definition at line 120 of file func_vmcount.c.

121{
123}
static struct ast_custom_function acf_vmcount
Definition: func_vmcount.c:109
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1558

References acf_vmcount, and ast_custom_function_register.

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 115 of file func_vmcount.c.

116{
118}
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 = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .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 125 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: func_vmcount.c:72

Definition at line 109 of file func_vmcount.c.

Referenced by load_module(), and unload_module().

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 125 of file func_vmcount.c.