Fri Sep 25 19:28:17 2009

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"

Include dependency graph for app_lookupcidname.c:

Go to the source code of this file.

Functions

 AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Look up CallerID Name from local database")
static int load_module (void)
static int lookupcidname_exec (struct ast_channel *chan, void *data)
static int unload_module (void)

Variables

static char * app = "LookupCIDName"
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

AST_MODULE_INFO_STANDARD ( ASTERISK_GPL_KEY  ,
"Look up CallerID Name from local database"   
)

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_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

char* app = "LookupCIDName" [static]

Definition at line 48 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 Fri Sep 25 19:28:17 2009 for Asterisk - the Open Source PBX by  doxygen 1.5.5