Tue Aug 24 20:35:36 2010

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

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

struct ast_custom_function acf_vmcount

Detailed Description

VMCOUNT dialplan function.

Author:
Tilghman Lesher <asterisk-vmcount-func@the-tilghman.com>

Definition in file func_vmcount.c.


Function Documentation

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

Definition at line 66 of file func_vmcount.c.

References AST_APP_ARG, ast_app_messagecount(), AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, ast_strlen_zero(), context, and strsep().

00067 {
00068    char *context;
00069    AST_DECLARE_APP_ARGS(args,
00070       AST_APP_ARG(vmbox);
00071       AST_APP_ARG(folder);
00072    );
00073 
00074    buf[0] = '\0';
00075 
00076    if (ast_strlen_zero(argsstr))
00077       return -1;
00078 
00079    AST_STANDARD_APP_ARGS(args, argsstr);
00080 
00081    if (strchr(args.vmbox, '@')) {
00082       context = args.vmbox;
00083       args.vmbox = strsep(&context, "@");
00084    } else {
00085       context = "default";
00086    }
00087 
00088    if (ast_strlen_zero(args.folder)) {
00089       args.folder = "INBOX";
00090    }
00091 
00092    snprintf(buf, len, "%d", ast_app_messagecount(context, args.vmbox, args.folder));
00093    
00094    return 0;
00095 }

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 107 of file func_vmcount.c.

References ast_custom_function_register.

00108 {
00109    return ast_custom_function_register(&acf_vmcount);
00110 }

static int unload_module ( void   )  [static]

Definition at line 102 of file func_vmcount.c.

References ast_custom_function_unregister().

00103 {
00104    return ast_custom_function_unregister(&acf_vmcount);
00105 }


Variable Documentation

Initial value:
 {
   .name = "VMCOUNT",
   .read = acf_vmcount_exec,
}

Definition at line 97 of file func_vmcount.c.


Generated on 24 Aug 2010 for Asterisk - the Open Source PBX by  doxygen 1.6.1