2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
5 * Copyright (C) 2003, Jefferson Noxon
7 * Mark Spencer <markster@digium.com>
8 * Jefferson Noxon <jeff@debian.org>
10 * See http://www.asterisk.org for more information about
11 * the Asterisk project. Please do not directly contact
12 * any of the maintainers of this project for assistance;
13 * the project provides a web site, mailing lists and IRC
14 * channels for your use.
16 * This program is free software, distributed under the terms of
17 * the GNU General Public License Version 2. See the LICENSE file
18 * at the top of the source tree.
23 * \brief Database access functions
25 * \author Mark Spencer <markster@digium.com>
26 * \author Jefferson Noxon <jeff@debian.org>
28 * \ingroup applications
32 <support_level>core</support_level>
37 #include "asterisk/file.h"
38 #include "asterisk/channel.h"
39 #include "asterisk/pbx.h"
40 #include "asterisk/module.h"
41 #include "asterisk/astdb.h"
42 #include "asterisk/lock.h"
45 <application name="DBdeltree" language="en_US">
47 Delete a family or keytree from the asterisk database.
50 <parameter name="family" required="true" />
51 <parameter name="keytree" />
54 <para>This application will delete a <replaceable>family</replaceable> or <replaceable>keytree</replaceable>
55 from the Asterisk database.</para>
58 <ref type="function">DB_DELETE</ref>
59 <ref type="function">DB</ref>
64 static const char dt_app[] = "DBdeltree";
66 static int deltree_exec(struct ast_channel *chan, const char *data)
68 char *argv, *family, *keytree;
70 argv = ast_strdupa(data);
72 if (strchr(argv, '/')) {
73 family = strsep(&argv, "/");
74 keytree = strsep(&argv, "\0");
75 if (!family || !keytree) {
76 ast_debug(1, "Ignoring; Syntax error in argument\n");
79 if (ast_strlen_zero(keytree))
87 ast_verb(3, "DBdeltree: family=%s, keytree=%s\n", family, keytree);
89 ast_verb(3, "DBdeltree: family=%s\n", family);
92 if (ast_db_deltree(family, keytree) < 0) {
93 ast_verb(3, "DBdeltree: Error deleting key from database.\n");
99 static int unload_module(void)
101 return ast_unregister_application(dt_app);
104 static int load_module(void)
106 return ast_register_application_xml(dt_app, deltree_exec);
109 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Database Access Functions");