2005-12-07 16:41:26 +00:00
|
|
|
/*
|
|
|
|
* Asterisk -- An open source telephony toolkit.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
|
|
|
*
|
|
|
|
* Mark Spencer <markster@digium.com>
|
|
|
|
*
|
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*! \file
|
|
|
|
*
|
2006-09-21 20:23:32 +00:00
|
|
|
* \brief App to set callerid presentation
|
2005-12-30 21:18:06 +00:00
|
|
|
*
|
|
|
|
* \author Mark Spencer <markster@digium.com>
|
2005-12-07 16:41:26 +00:00
|
|
|
*
|
|
|
|
* \ingroup applications
|
|
|
|
*/
|
2011-07-14 20:28:54 +00:00
|
|
|
|
|
|
|
/*** MODULEINFO
|
|
|
|
<defaultenabled>no</defaultenabled>
|
|
|
|
<support_level>deprecated</support_level>
|
|
|
|
<replacement>func_callerid</replacement>
|
|
|
|
***/
|
|
|
|
|
2005-12-07 16:41:26 +00:00
|
|
|
#include "asterisk.h"
|
|
|
|
|
2006-02-11 16:15:11 +00:00
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
2005-12-07 16:41:26 +00:00
|
|
|
|
|
|
|
#include "asterisk/lock.h"
|
|
|
|
#include "asterisk/file.h"
|
|
|
|
#include "asterisk/channel.h"
|
|
|
|
#include "asterisk/pbx.h"
|
|
|
|
#include "asterisk/module.h"
|
|
|
|
#include "asterisk/translate.h"
|
|
|
|
#include "asterisk/image.h"
|
|
|
|
#include "asterisk/callerid.h"
|
|
|
|
|
2008-11-01 21:10:07 +00:00
|
|
|
/*** DOCUMENTATION
|
|
|
|
<application name="SetCallerPres" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Set CallerID Presentation.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="presentation" required="true">
|
|
|
|
<enumlist>
|
|
|
|
<enum name="allowed_not_screened">
|
|
|
|
<para>Presentation Allowed, Not Screened.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="allowed_passed_screen">
|
|
|
|
<para>Presentation Allowed, Passed Screen.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="allowed_failed_screen">
|
|
|
|
<para>Presentation Allowed, Failed Screen.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="allowed">
|
|
|
|
<para>Presentation Allowed, Network Number.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="prohib_not_screened">
|
|
|
|
<para>Presentation Prohibited, Not Screened.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="prohib_passed_screen">
|
|
|
|
<para>Presentation Prohibited, Passed Screen.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="prohib_failed_screen">
|
|
|
|
<para>Presentation Prohibited, Failed Screen.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="prohib">
|
|
|
|
<para>Presentation Prohibited, Network Number.</para>
|
|
|
|
</enum>
|
|
|
|
<enum name="unavailable">
|
|
|
|
<para>Number Unavailable.</para>
|
|
|
|
</enum>
|
|
|
|
</enumlist>
|
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Set Caller*ID presentation on a call.</para>
|
|
|
|
</description>
|
|
|
|
</application>
|
|
|
|
***/
|
2005-12-07 16:41:26 +00:00
|
|
|
|
2008-11-01 21:10:07 +00:00
|
|
|
static char *app2 = "SetCallerPres";
|
2005-12-07 16:41:26 +00:00
|
|
|
|
2009-05-21 21:13:09 +00:00
|
|
|
static int setcallerid_pres_exec(struct ast_channel *chan, const char *data)
|
2005-12-07 16:41:26 +00:00
|
|
|
{
|
|
|
|
int pres = -1;
|
2007-02-03 22:05:02 +00:00
|
|
|
static int deprecated = 0;
|
2005-12-07 16:41:26 +00:00
|
|
|
|
2007-02-03 22:05:02 +00:00
|
|
|
if (!deprecated) {
|
|
|
|
deprecated = 1;
|
|
|
|
ast_log(LOG_WARNING, "SetCallerPres is deprecated. Please use Set(CALLERPRES()=%s) instead.\n", (char *)data);
|
|
|
|
}
|
2008-04-18 06:53:47 +00:00
|
|
|
|
|
|
|
/* For interface consistency, permit the argument to be specified as a number */
|
2009-08-10 19:20:57 +00:00
|
|
|
if (sscanf(data, "%30d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
|
2008-04-18 06:53:47 +00:00
|
|
|
pres = ast_parse_caller_presentation(data);
|
|
|
|
}
|
2005-12-07 16:41:26 +00:00
|
|
|
|
|
|
|
if (pres < 0) {
|
|
|
|
ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n",
|
|
|
|
(char *) data);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-07-14 15:48:36 +00:00
|
|
|
/* Set the combined caller id presentation. */
|
2012-02-29 16:52:47 +00:00
|
|
|
ast_channel_caller(chan)->id.name.presentation = pres;
|
|
|
|
ast_channel_caller(chan)->id.number.presentation = pres;
|
2005-12-07 16:41:26 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int unload_module(void)
|
2005-12-07 16:41:26 +00:00
|
|
|
{
|
2007-07-16 13:35:20 +00:00
|
|
|
return ast_unregister_application(app2);
|
2005-12-07 16:41:26 +00:00
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int load_module(void)
|
2005-12-07 16:41:26 +00:00
|
|
|
{
|
2008-11-01 21:10:07 +00:00
|
|
|
return ast_register_application_xml(app2, setcallerid_pres_exec);
|
2005-12-07 16:41:26 +00:00
|
|
|
}
|
|
|
|
|
2014-07-25 16:47:17 +00:00
|
|
|
AST_MODULE_INFO_STANDARD_DEPRECATED(ASTERISK_GPL_KEY, "Set CallerID Presentation Application");
|
|
|
|
|