2 * Asterisk -- A telephony toolkit for Linux.
4 * App to transmit an image
6 * Copyright (C) 1999 - 2005, Digium, Inc.
8 * Mark Spencer <markster@digium.com>
10 * This program is free software, distributed under the terms of
11 * the GNU General Public License
19 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
21 #include "asterisk/lock.h"
22 #include "asterisk/file.h"
23 #include "asterisk/logger.h"
24 #include "asterisk/channel.h"
25 #include "asterisk/pbx.h"
26 #include "asterisk/module.h"
27 #include "asterisk/translate.h"
28 #include "asterisk/image.h"
30 static char *tdesc = "Image Transmission Application";
32 static char *app = "SendImage";
34 static char *synopsis = "Send an image file";
36 static char *descrip =
37 " SendImage(filename): Sends an image on a channel. If the channel\n"
38 "does not support image transport, and there exists a step with\n"
39 "priority n + 101, then execution will continue at that step.\n"
40 "Otherwise, execution will continue at the next priority level.\n"
41 "SendImage only returns 0 if the image was sent correctly or if\n"
42 "the channel does not support image transport, and -1 otherwise.\n";
48 static int sendimage_exec(struct ast_channel *chan, void *data)
52 if (!data || !strlen((char *)data)) {
53 ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
57 if (!ast_supports_images(chan)) {
58 /* Does not support transport */
59 if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->cid.cid_num))
60 chan->priority += 100;
63 res = ast_send_image(chan, data);
68 int unload_module(void)
70 STANDARD_HANGUP_LOCALUSERS;
71 return ast_unregister_application(app);
76 return ast_register_application(app, sendimage_exec, synopsis, descrip);
79 char *description(void)
87 STANDARD_USECOUNT(res);
93 return ASTERISK_GPL_KEY;