2 * Asterisk -- A telephony toolkit for Linux.
4 * Time of day - Report the time of day
6 * Copyright (C) 1999, Mark Spencer
8 * Mark Spencer <markster@linux-support.net>
10 * This program is free software, distributed under the terms of
11 * the GNU General Public License
14 #include <asterisk/lock.h>
15 #include <asterisk/file.h>
16 #include <asterisk/logger.h>
17 #include <asterisk/channel.h>
18 #include <asterisk/pbx.h>
19 #include <asterisk/options.h>
20 #include <asterisk/config.h>
21 #include <asterisk/module.h>
22 #include <asterisk/enum.h>
32 static char *tdesc = "TXTCIDName";
34 static char *app = "TXTCIDName";
36 static char *synopsis = "Lookup caller name from TXT record";
38 static char *descrip =
39 " TXTLookup(CallerID): Looks up an Caller Name via DNS and sets\n"
40 "the variable 'TXTCIDNAME'. TXTCIDName will either be blank\n"
41 "or return the value found in the TXT record in DNS.\n" ;
43 #define ENUM_CONFIG "enum.conf"
45 static char h323driver[80];
46 #define H323DRIVERDEFAULT "H323"
52 static int txtcidname_exec(struct ast_channel *chan, void *data)
61 if (!data || !strlen(data)) {
62 ast_log(LOG_WARNING, "TXTCIDName requires an argument (extension)\n");
67 res = ast_get_txt(chan, data, dest, sizeof(dest), tech, sizeof(tech), txt, sizeof(txt));
74 pbx_builtin_setvar_helper(chan, "TXTCIDNAME", txt);
76 printf("TXTCIDNAME got '%s'\n", txt);
81 /* Look for a "busy" place */
82 if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
83 chan->priority += 100;
89 static int load_config(void)
91 struct ast_config *cfg;
94 cfg = ast_load(ENUM_CONFIG);
96 if (!(s=ast_variable_retrieve(cfg, "general", "h323driver"))) {
97 strcpy(h323driver, H323DRIVERDEFAULT);
99 strcpy(h323driver, s);
104 ast_log(LOG_NOTICE, "No ENUM Config file, using defaults\n");
109 int unload_module(void)
111 STANDARD_HANGUP_LOCALUSERS;
112 return ast_unregister_application(app);
115 int load_module(void)
118 res = ast_register_application(app, txtcidname_exec, synopsis, descrip);
121 if ((res=load_config())) {
129 return(load_config());
133 char *description(void)
141 STANDARD_USECOUNT(res);
147 return ASTERISK_GPL_KEY;