Asterisk - The Open Source Telephony Project  18.5.0
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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .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 106 of file func_vmcount.c.

◆ __unreg_module()

static void __unreg_module ( void  )
static

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

References args, AST_APP_ARG, ast_app_messagecount(), AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, and ast_strlen_zero.

64 {
66  AST_APP_ARG(vmbox);
67  AST_APP_ARG(folder);
68  );
69 
70  buf[0] = '\0';
71 
72  if (ast_strlen_zero(argsstr))
73  return -1;
74 
75  AST_STANDARD_APP_ARGS(args, argsstr);
76 
77  if (ast_strlen_zero(args.vmbox)) {
78  return -1;
79  }
80 
81  if (ast_strlen_zero(args.folder)) {
82  args.folder = "INBOX";
83  }
84 
85  snprintf(buf, len, "%d", ast_app_messagecount(args.vmbox, args.folder));
86 
87  return 0;
88 }
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
const char * args
#define ast_strlen_zero(foo)
Definition: strings.h:52
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
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:718
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
#define AST_APP_ARG(name)
Define an application argument.

◆ AST_MODULE_SELF_SYM()

struct ast_module* AST_MODULE_SELF_SYM ( void  )

Definition at line 106 of file func_vmcount.c.

◆ load_module()

static int load_module ( void  )
static

Definition at line 101 of file func_vmcount.c.

References ast_custom_function_register.

102 {
104 }
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1508
static struct ast_custom_function acf_vmcount
Definition: func_vmcount.c:90

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 96 of file func_vmcount.c.

References ast_custom_function_unregister().

97 {
99 }
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static struct ast_custom_function acf_vmcount
Definition: func_vmcount.c:90

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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, }
static

Definition at line 106 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:63

Definition at line 90 of file func_vmcount.c.

◆ ast_module_info

const struct ast_module_info* ast_module_info = &__mod_info
static

Definition at line 106 of file func_vmcount.c.