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)
60 if (!data || !strlen(data)) {
61 ast_log(LOG_WARNING, "TXTCIDName requires an argument (extension)\n");
66 res = ast_get_txt(chan, data, dest, sizeof(dest), tech, sizeof(tech), txt, sizeof(txt));
73 pbx_builtin_setvar_helper(chan, "TXTCIDNAME", txt);
75 printf("TXTCIDNAME got '%s'\n", txt);
80 /* Look for a "busy" place */
81 if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
82 chan->priority += 100;
88 static int load_config(void)
90 struct ast_config *cfg;
93 cfg = ast_load(ENUM_CONFIG);
95 if (!(s=ast_variable_retrieve(cfg, "general", "h323driver"))) {
96 strcpy(h323driver, H323DRIVERDEFAULT);
98 strcpy(h323driver, s);
103 ast_log(LOG_NOTICE, "No ENUM Config file, using defaults\n");
108 int unload_module(void)
110 STANDARD_HANGUP_LOCALUSERS;
111 return ast_unregister_application(app);
114 int load_module(void)
117 res = ast_register_application(app, txtcidname_exec, synopsis, descrip);
120 if ((res=load_config())) {
128 return(load_config());
132 char *description(void)
140 STANDARD_USECOUNT(res);
146 return ASTERISK_GPL_KEY;