Asterisk.org: Developer Documentation (28 Oct 2009)

Wed Oct 28 15:49:10 2009

## Asterisk developer's documentation

# pbx_functions.c File Reference

Builtin dialplan functions. More...

`#include <sys/types.h>`
`#include <stdlib.h>`
`#include <stdio.h>`
`#include "asterisk.h"`
`#include "asterisk/module.h"`
`#include "asterisk/pbx.h"`
`#include "pbx_functions.h"`

Include dependency graph for pbx_functions.c:

Go to the source code of this file.

## Functions

char * | description (void)
| Provides a description of the module.
char * | key ()
| Returns the ASTERISK_GPL_KEY.
int | load_module (void)
| Initialize the module.
int | unload_module (void)
| Cleanup all module structures, sockets, etc.
int | usecount (void)
| Provides a usecount.

## Variables

static char * | tdesc = "Builtin dialplan functions"

## Detailed Description

Builtin dialplan functions.

Definition in file pbx_functions.c.

## Function Documentation

char* description | ( | void |  | ) |

Provides a description of the module.

Returns:
  a short description of your module

Definition at line 61 of file pbx_functions.c.

    00062 {
    00063    return tdesc;
    00064 }

char* key | ( | void |  | ) |

Returns the ASTERISK_GPL_KEY.

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;
     }

Returns:
  ASTERISK_GPL_KEY

Definition at line 71 of file pbx_functions.c.

References ASTERISK_GPL_KEY.

    00072 {
    00073    return ASTERISK_GPL_KEY;
    00074 }

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.

Returns:
  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.

Returns:
  int Always 0.

TE STUFF END

Definition at line 50 of file pbx_functions.c.

References ast_custom_function_register(), and builtins.

    00051 {
    00052    int x;
    00053
    00054    for (x = 0; x < (sizeof(builtins) / sizeof(builtins[0])); x++) {
    00055       ast_custom_function_register(builtins[x]);
    00056    }
    00057
    00058    return 0;
    00059 }

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).

Returns:
  Zero on success, or non-zero on error.

Definition at line 39 of file pbx_functions.c.

References ast_custom_function_unregister(), and builtins.

    00040 {
    00041    int x;
    00042
    00043    for (x = 0; x < (sizeof(builtins) / sizeof(builtins[0])); x++) {
    00044       ast_custom_function_unregister(builtins[x]);
    00045    }
    00046
    00047    return 0;
    00048 }

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.

Returns:
  The module's usecount.

Definition at line 66 of file pbx_functions.c.

    00067 {
    00068    return 0;
    00069 }

## Variable Documentation

char* tdesc = "Builtin dialplan functions"`[static]`

Definition at line 37 of file pbx_functions.c.