Wed Jan 8 2020 09:50:13

Asterisk developer's documentation


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"

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)
 
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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
 
static struct ast_custom_function acf_vmcount
 
static struct ast_module_infoast_module_info = &__mod_info
 

Detailed Description

Function Documentation

static void __reg_module ( void  )
static

Definition at line 117 of file func_vmcount.c.

static void __unreg_module ( void  )
static

Definition at line 117 of 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(), context, and strsep().

71 {
72  char *context;
74  AST_APP_ARG(vmbox);
75  AST_APP_ARG(folder);
76  );
77 
78  buf[0] = '\0';
79 
80  if (ast_strlen_zero(argsstr))
81  return -1;
82 
83  AST_STANDARD_APP_ARGS(args, argsstr);
84 
85  if (strchr(args.vmbox, '@')) {
86  context = args.vmbox;
87  args.vmbox = strsep(&context, "@");
88  } else {
89  context = "default";
90  }
91 
92  if (ast_strlen_zero(args.folder)) {
93  args.folder = "INBOX";
94  }
95 
96  snprintf(buf, len, "%d", ast_app_messagecount(context, args.vmbox, args.folder));
97 
98  return 0;
99 }
char * strsep(char **str, const char *delims)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
Definition: app.h:572
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
static struct @350 args
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.
Definition: app.h:555
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the &#39;standard&#39; argument separation process for an application.
Definition: app.h:604
static char context[AST_MAX_CONTEXT]
Definition: chan_alsa.c:107
int ast_app_messagecount(const char *context, const char *mailbox, const char *folder)
Check number of messages in a given context, mailbox, and folder.
Definition: app.c:486
static int load_module ( void  )
static

Definition at line 112 of file func_vmcount.c.

References ast_custom_function_register.

113 {
115 }
#define ast_custom_function_register(acf)
Register a custom function.
Definition: pbx.h:1164
static struct ast_custom_function acf_vmcount
Definition: func_vmcount.c:101
static int unload_module ( void  )
static

Definition at line 107 of file func_vmcount.c.

References ast_custom_function_unregister().

108 {
110 }
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
Definition: pbx.c:3814
static struct ast_custom_function acf_vmcount
Definition: func_vmcount.c:101

Variable Documentation

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

Definition at line 117 of file func_vmcount.c.

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:70

Definition at line 101 of file func_vmcount.c.

Definition at line 117 of file func_vmcount.c.