Sat Aug 6 00:39:34 2011

Asterisk developer's documentation


app_lookupcidname.c File Reference

App to set callerid name from database, based on directory number. More...

#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/options.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/image.h"
#include "asterisk/callerid.h"
#include "asterisk/astdb.h"

Go to the source code of this file.

Functions

static void __reg_module (void)
static void __unreg_module (void)
static int load_module (void)
static int lookupcidname_exec (struct ast_channel *chan, void *data)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Look up CallerID Name from local database" , .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, }
static char * app = "LookupCIDName"
static const struct ast_module_infoast_module_info = &__mod_info
static char * descrip
static char * synopsis = "Look up CallerID Name from local database"


Detailed Description

App to set callerid name from database, based on directory number.

Author:
Mark Spencer <markster@digium.com>

Definition in file app_lookupcidname.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 103 of file app_lookupcidname.c.

static void __unreg_module ( void   )  [static]

Definition at line 103 of file app_lookupcidname.c.

static int load_module ( void   )  [static]

Definition at line 98 of file app_lookupcidname.c.

References ast_register_application(), and lookupcidname_exec().

00099 {
00100    return ast_register_application (app, lookupcidname_exec, synopsis, descrip);
00101 }

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

Definition at line 63 of file app_lookupcidname.c.

References ast_db_get(), ast_log(), ast_module_user_add, ast_module_user_remove, ast_set_callerid(), ast_verbose(), ast_module_user::chan, ast_channel::cid, ast_callerid::cid_num, dbname, LOG_WARNING, option_verbose, and VERBOSE_PREFIX_3.

Referenced by load_module().

00064 {
00065    char dbname[64];
00066    struct ast_module_user *u;
00067    static int dep_warning = 0;
00068 
00069    u = ast_module_user_add(chan);
00070    if (!dep_warning) {
00071       dep_warning = 1;
00072       ast_log(LOG_WARNING, "LookupCIDName is deprecated.  Please use ${DB(cidname/${CALLERID(num)})} instead.\n");
00073    }
00074    if (chan->cid.cid_num) {
00075       if (!ast_db_get ("cidname", chan->cid.cid_num, dbname, sizeof (dbname))) {
00076          ast_set_callerid (chan, NULL, dbname, NULL);
00077          if (option_verbose > 2)
00078             ast_verbose (VERBOSE_PREFIX_3 "Changed Caller*ID name to %s\n",
00079                     dbname);
00080       }
00081    }
00082    ast_module_user_remove(u);
00083 
00084    return 0;
00085 }

static int unload_module ( void   )  [static]

Definition at line 87 of file app_lookupcidname.c.

References ast_module_user_hangup_all, and ast_unregister_application().

00088 {
00089    int res;
00090 
00091    res = ast_unregister_application (app);
00092 
00093    ast_module_user_hangup_all();
00094 
00095    return res;
00096 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .description = "Look up CallerID Name from local database" , .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static]

Definition at line 103 of file app_lookupcidname.c.

char* app = "LookupCIDName" [static]

Definition at line 48 of file app_lookupcidname.c.

const struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 103 of file app_lookupcidname.c.

char* descrip [static]

Definition at line 52 of file app_lookupcidname.c.

char* synopsis = "Look up CallerID Name from local database" [static]

Definition at line 50 of file app_lookupcidname.c.


Generated on Sat Aug 6 00:39:34 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7