2001-08-23 17:57:10 +00:00
|
|
|
/*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2001-08-23 17:57:10 +00:00
|
|
|
*
|
2005-01-21 07:06:25 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
2001-08-23 17:57:10 +00:00
|
|
|
*
|
2004-10-02 00:58:31 +00:00
|
|
|
* Mark Spencer <markster@digium.com>
|
2001-08-23 17:57:10 +00:00
|
|
|
*
|
2005-09-14 20:46:50 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2001-08-23 17:57:10 +00:00
|
|
|
* This program is free software, distributed under the terms of
|
2005-09-14 20:46:50 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2005-10-24 20:12:06 +00:00
|
|
|
* \brief App to transmit an image
|
2005-12-30 21:18:06 +00:00
|
|
|
*
|
|
|
|
* \author Mark Spencer <markster@digium.com>
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2005-11-06 15:09:47 +00:00
|
|
|
* \ingroup applications
|
2001-08-23 17:57:10 +00:00
|
|
|
*/
|
2011-07-14 20:28:54 +00:00
|
|
|
|
|
|
|
/*** MODULEINFO
|
|
|
|
<support_level>extended</support_level>
|
|
|
|
***/
|
2001-08-23 17:57:10 +00:00
|
|
|
|
2005-06-06 22:39:32 +00:00
|
|
|
#include "asterisk.h"
|
|
|
|
|
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|
|
|
|
2005-04-21 06:02:45 +00:00
|
|
|
#include "asterisk/pbx.h"
|
|
|
|
#include "asterisk/module.h"
|
|
|
|
#include "asterisk/image.h"
|
2001-08-23 17:57:10 +00:00
|
|
|
|
|
|
|
static char *app = "SendImage";
|
|
|
|
|
2008-11-01 21:10:07 +00:00
|
|
|
/*** DOCUMENTATION
|
|
|
|
<application name="SendImage" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Sends an image file.
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="filename" required="true">
|
|
|
|
<para>Path of the filename (image) to send.</para>
|
|
|
|
</parameter>
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Send an image file on a channel supporting it.</para>
|
|
|
|
<para>Result of transmission will be stored in <variable>SENDIMAGESTATUS</variable></para>
|
|
|
|
<variablelist>
|
|
|
|
<variable name="SENDIMAGESTATUS">
|
|
|
|
<value name="SUCCESS">
|
|
|
|
Transmission succeeded.
|
|
|
|
</value>
|
|
|
|
<value name="FAILURE">
|
|
|
|
Transmission failed.
|
|
|
|
</value>
|
|
|
|
<value name="UNSUPPORTED">
|
|
|
|
Image transmission not supported by channel.
|
|
|
|
</value>
|
|
|
|
</variable>
|
|
|
|
</variablelist>
|
|
|
|
</description>
|
2008-11-05 13:07:29 +00:00
|
|
|
<see-also>
|
|
|
|
<ref type="application">SendText</ref>
|
|
|
|
<ref type="application">SendURL</ref>
|
|
|
|
</see-also>
|
2008-11-01 21:10:07 +00:00
|
|
|
</application>
|
|
|
|
***/
|
2001-08-23 17:57:10 +00:00
|
|
|
|
2009-05-21 21:13:09 +00:00
|
|
|
static int sendimage_exec(struct ast_channel *chan, const char *data)
|
2001-08-23 17:57:10 +00:00
|
|
|
{
|
2005-10-18 22:52:21 +00:00
|
|
|
|
2007-07-31 01:10:47 +00:00
|
|
|
if (ast_strlen_zero(data)) {
|
|
|
|
ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
|
2005-11-06 19:19:59 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2001-08-23 17:57:10 +00:00
|
|
|
if (!ast_supports_images(chan)) {
|
|
|
|
/* Does not support transport */
|
2008-07-28 16:49:29 +00:00
|
|
|
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "UNSUPPORTED");
|
2001-08-23 17:57:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2005-10-18 22:52:21 +00:00
|
|
|
|
2008-07-28 16:49:29 +00:00
|
|
|
if (!ast_send_image(chan, data)) {
|
|
|
|
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "SUCCESS");
|
|
|
|
} else {
|
|
|
|
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "FAILURE");
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2001-08-23 17:57:10 +00:00
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int unload_module(void)
|
2001-08-23 17:57:10 +00:00
|
|
|
{
|
2007-07-16 13:35:20 +00:00
|
|
|
return ast_unregister_application(app);
|
2001-08-23 17:57:10 +00:00
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int load_module(void)
|
2001-08-23 17:57:10 +00:00
|
|
|
{
|
2008-11-01 21:10:07 +00:00
|
|
|
return ast_register_application_xml(app, sendimage_exec);
|
2001-08-23 17:57:10 +00:00
|
|
|
}
|
|
|
|
|
2014-07-25 16:47:17 +00:00
|
|
|
AST_MODULE_INFO_STANDARD_EXTENDED(ASTERISK_GPL_KEY, "Image Transmission Application");
|
|
|
|
|