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$")
32 #include "asterisk/lock.h"
33 #include "asterisk/file.h"
34 #include "asterisk/channel.h"
35 #include "asterisk/pbx.h"
36 #include "asterisk/module.h"
37 #include "asterisk/translate.h"
38 #include "asterisk/image.h"
39 #include "asterisk/callerid.h"
42 <application name="SetCallerPres" language="en_US">
44 Set CallerID Presentation.
47 <parameter name="presentation" required="true">
49 <enum name="allowed_not_screened">
50 <para>Presentation Allowed, Not Screened.</para>
52 <enum name="allowed_passed_screen">
53 <para>Presentation Allowed, Passed Screen.</para>
55 <enum name="allowed_failed_screen">
56 <para>Presentation Allowed, Failed Screen.</para>
59 <para>Presentation Allowed, Network Number.</para>
61 <enum name="prohib_not_screened">
62 <para>Presentation Prohibited, Not Screened.</para>
64 <enum name="prohib_passed_screen">
65 <para>Presentation Prohibited, Passed Screen.</para>
67 <enum name="prohib_failed_screen">
68 <para>Presentation Prohibited, Failed Screen.</para>
71 <para>Presentation Prohibited, Network Number.</para>
73 <enum name="unavailable">
74 <para>Number Unavailable.</para>
80 <para>Set Caller*ID presentation on a call.</para>
85 static char *app2 = "SetCallerPres";
87 static int setcallerid_pres_exec(struct ast_channel *chan, const char *data)
90 static int deprecated = 0;
94 ast_log(LOG_WARNING, "SetCallerPres is deprecated. Please use Set(CALLERPRES()=%s) instead.\n", (char *)data);
97 /* For interface consistency, permit the argument to be specified as a number */
98 if (sscanf(data, "%30d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
99 pres = ast_parse_caller_presentation(data);
103 ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n",
108 chan->cid.cid_pres = pres;
112 static int unload_module(void)
114 return ast_unregister_application(app2);
117 static int load_module(void)
119 return ast_register_application_xml(app2, setcallerid_pres_exec);
122 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Set CallerID Presentation Application");