2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * Mark Spencer <markster@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
21 * \brief App to set callerid presentation
23 * \author Mark Spencer <markster@digium.com>
25 * \ingroup applications
30 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
36 #include "asterisk/lock.h"
37 #include "asterisk/file.h"
38 #include "asterisk/logger.h"
39 #include "asterisk/channel.h"
40 #include "asterisk/pbx.h"
41 #include "asterisk/module.h"
42 #include "asterisk/translate.h"
43 #include "asterisk/image.h"
44 #include "asterisk/callerid.h"
46 static char *app2 = "SetCallerPres";
48 static char *synopsis2 = "Set CallerID Presentation";
51 static char *descrip2 =
52 " SetCallerPres(presentation): Set Caller*ID presentation on a call.\n"
53 " Valid presentations are:\n"
55 " allowed_not_screened : Presentation Allowed, Not Screened\n"
56 " allowed_passed_screen : Presentation Allowed, Passed Screen\n"
57 " allowed_failed_screen : Presentation Allowed, Failed Screen\n"
58 " allowed : Presentation Allowed, Network Number\n"
59 " prohib_not_screened : Presentation Prohibited, Not Screened\n"
60 " prohib_passed_screen : Presentation Prohibited, Passed Screen\n"
61 " prohib_failed_screen : Presentation Prohibited, Failed Screen\n"
62 " prohib : Presentation Prohibited, Network Number\n"
63 " unavailable : Number Unavailable\n"
67 static int setcallerid_pres_exec(struct ast_channel *chan, void *data)
69 struct ast_module_user *u;
72 u = ast_module_user_add(chan);
74 pres = ast_parse_caller_presentation(data);
77 ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n",
79 ast_module_user_remove(u);
83 chan->cid.cid_pres = pres;
84 ast_module_user_remove(u);
88 static int unload_module(void)
90 int res = ast_unregister_application(app2);
91 ast_module_user_hangup_all();
95 static int load_module(void)
97 return ast_register_application(app2, setcallerid_pres_exec, synopsis2, descrip2);
100 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Set CallerID Presentation Application");