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
00029
00030
00031
00032 #include "asterisk.h"
00033
00034 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 328209 $")
00035
00036 #include "asterisk/pbx.h"
00037 #include "asterisk/module.h"
00038 #include "asterisk/image.h"
00039
00040 static char *app = "SendImage";
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 static int sendimage_exec(struct ast_channel *chan, const char *data)
00077 {
00078
00079 if (ast_strlen_zero(data)) {
00080 ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
00081 return -1;
00082 }
00083
00084 if (!ast_supports_images(chan)) {
00085
00086 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "UNSUPPORTED");
00087 return 0;
00088 }
00089
00090 if (!ast_send_image(chan, data)) {
00091 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "SUCCESS");
00092 } else {
00093 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "FAILURE");
00094 }
00095
00096 return 0;
00097 }
00098
00099 static int unload_module(void)
00100 {
00101 return ast_unregister_application(app);
00102 }
00103
00104 static int load_module(void)
00105 {
00106 return ast_register_application_xml(app, sendimage_exec);
00107 }
00108
00109 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Image Transmission Application");