app_image.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "asterisk.h"
00029
00030 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 134088 $")
00031
00032 #include "asterisk/pbx.h"
00033 #include "asterisk/module.h"
00034 #include "asterisk/image.h"
00035
00036 static char *app = "SendImage";
00037
00038 static char *synopsis = "Send an image file";
00039
00040 static char *descrip =
00041 " SendImage(filename): Sends an image on a channel.\n"
00042 "Result of transmission will be stored in SENDIMAGESTATUS\n"
00043 "channel variable:\n"
00044 " SUCCESS Transmission succeeded\n"
00045 " FAILURE Transmission failed\n"
00046 " UNSUPPORTED Image transmission not supported by channel\n";
00047
00048
00049 static int sendimage_exec(struct ast_channel *chan, void *data)
00050 {
00051
00052 if (ast_strlen_zero(data)) {
00053 ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
00054 return -1;
00055 }
00056
00057 if (!ast_supports_images(chan)) {
00058
00059 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "UNSUPPORTED");
00060 return 0;
00061 }
00062
00063 if (!ast_send_image(chan, data)) {
00064 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "SUCCESS");
00065 } else {
00066 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "FAILURE");
00067 }
00068
00069 return 0;
00070 }
00071
00072 static int unload_module(void)
00073 {
00074 return ast_unregister_application(app);
00075 }
00076
00077 static int load_module(void)
00078 {
00079 return ast_register_application(app, sendimage_exec, synopsis, descrip);
00080 }
00081
00082 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Image Transmission Application");