Creating tag for the release of asterisk-1.6.1-beta1
[asterisk-bristuff.git] / apps / app_image.c
blobac44495e30b13c807bc1367e86a679077fd3e6fe
1 /*
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.
19 /*! \file
21 * \brief App to transmit an image
23 * \author Mark Spencer <markster@digium.com>
25 * \ingroup applications
28 #include "asterisk.h"
30 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
32 #include "asterisk/pbx.h"
33 #include "asterisk/module.h"
34 #include "asterisk/image.h"
36 static char *app = "SendImage";
38 static char *synopsis = "Send an image file";
40 static char *descrip =
41 " SendImage(filename): Sends an image on a channel.\n"
42 "Result of transmission will be stored in SENDIMAGESTATUS\n"
43 "channel variable:\n"
44 " SUCCESS Transmission succeeded\n"
45 " FAILURE Transmission failed\n"
46 " UNSUPPORTED Image transmission not supported by channel\n";
49 static int sendimage_exec(struct ast_channel *chan, void *data)
52 if (ast_strlen_zero(data)) {
53 ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
54 return -1;
57 if (!ast_supports_images(chan)) {
58 /* Does not support transport */
59 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "UNSUPPORTED");
60 return 0;
63 if (!ast_send_image(chan, data)) {
64 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "SUCCESS");
65 } else {
66 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "FAILURE");
69 return 0;
72 static int unload_module(void)
74 return ast_unregister_application(app);
77 static int load_module(void)
79 return ast_register_application(app, sendimage_exec, synopsis, descrip);
82 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Image Transmission Application");