Wed Oct 28 15:47:59 2009

Asterisk developer's documentation

app_cdr.c File Reference

Applications connected with CDR engine. More...

#include <sys/types.h>
#include <stdlib.h>
#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"

Include dependency graph for app_cdr.c:

Go to the source code of this file.


char * description (void)
 Provides a description of the module.
char * key ()
 Returns the ASTERISK_GPL_KEY.
int load_module (void)
 Initialize the module.
static int nocdr_exec (struct ast_channel *chan, void *data)
int unload_module (void)
 Cleanup all module structures, sockets, etc.
int usecount (void)
 Provides a usecount.


static char * nocdr_app = "NoCDR"
static char * nocdr_descrip
static char * nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the current call"
static char * tdesc = "Tell Asterisk to not maintain a CDR for the current call"

Detailed Description

Applications connected with CDR engine.

Definition in file app_cdr.c.

Function Documentation

char* description ( void   ) 

Provides a description of the module.

a short description of your module

Definition at line 82 of file app_cdr.c.

00083 {
00084    return tdesc;
00085 }

char* key ( void   ) 


This returns the ASTERISK_GPL_KEY, signifiying that you agree to the terms of the GPL stated in the ASTERISK_GPL_KEY. Your module will not load if it does not return the EXACT message:

 char *key(void) {
         return ASTERISK_GPL_KEY;


Definition at line 94 of file app_cdr.c.


00095 {
00096    return ASTERISK_GPL_KEY;
00097 }

int load_module ( void   ) 

Initialize the module.

This function is called at module load time. Put all code in here that needs to set up your module's hardware, software, registrations, etc.

This function should return 0 on success and non-zero on failure. If the module is not loaded successfully, Asterisk will call its unload_module() function.
Initialize the Agents module. This function is being called by Asterisk when loading the module. Among other thing it registers applications, cli commands and reads the cofiguration file.

int Always 0.

Definition at line 77 of file app_cdr.c.

References ast_register_application(), and nocdr_exec().

static int nocdr_exec ( struct ast_channel chan,
void *  data 
) [static]

Definition at line 50 of file app_cdr.c.

References ast_cdr_free(), ast_channel::cdr, LOCAL_USER_ADD, and LOCAL_USER_REMOVE.

Referenced by load_module().

00051 {
00052    struct localuser *u;
00054    LOCAL_USER_ADD(u);
00056    if (chan->cdr) {
00057       ast_cdr_free(chan->cdr);
00058       chan->cdr = NULL;
00059    }
00061    LOCAL_USER_REMOVE(u);
00063    return 0;
00064 }

int unload_module ( void   ) 

Cleanup all module structures, sockets, etc.

This is called at exit. Any registrations and memory allocations need to be unregistered and free'd here. Nothing else will do these for you (until exit).

Zero on success, or non-zero on error.

Definition at line 66 of file app_cdr.c.

References ast_unregister_application(), and STANDARD_HANGUP_LOCALUSERS.

00067 {
00068    int res;
00070    res = ast_unregister_application(nocdr_app);
00074    return res;
00075 }

int usecount ( void   ) 

Provides a usecount.

This function will be called by various parts of asterisk. Basically, all it has to do is to return a usecount when called. You will need to maintain your usecount within the module somewhere. The usecount should be how many channels provided by this module are in use.

The module's usecount.

Definition at line 87 of file app_cdr.c.


00088 {
00089    int res;
00090    STANDARD_USECOUNT(res);
00091    return res;
00092 }

Variable Documentation

Definition at line 48 of file app_cdr.c.

char* nocdr_app = "NoCDR" [static]

Definition at line 43 of file app_cdr.c.

char* nocdr_descrip [static]

Initial value:

"  NoCDR(): This application will tell Asterisk not to maintain a CDR for the\n"
"current call.\n"

Definition at line 39 of file app_cdr.c.

char* nocdr_synopsis = "Tell Asterisk to not maintain a CDR for the current call" [static]

Definition at line 44 of file app_cdr.c.

Definition at line 46 of file app_cdr.c.

char* tdesc = "Tell Asterisk to not maintain a CDR for the current call" [static]

Definition at line 37 of file app_cdr.c.

Generated on Wed Oct 28 15:47:59 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.6