#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/image.h"
#include "asterisk/app.h"
#include "asterisk/options.h"
Include dependency graph for app_image.c:
Go to the source code of this file.
Functions | |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Image Transmission Application") | |
static int | load_module (void) |
static int | sendimage_exec (struct ast_channel *chan, void *data) |
static int | unload_module (void) |
Variables | |
static char * | app = "SendImage" |
static char * | descrip |
static char * | synopsis = "Send an image file" |
Definition in file app_image.c.
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"Image Transmission Application" | ||||
) |
static int load_module | ( | void | ) | [static] |
Definition at line 120 of file app_image.c.
References ast_register_application(), and sendimage_exec().
00121 { 00122 return ast_register_application(app, sendimage_exec, synopsis, descrip); 00123 }
static int sendimage_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 63 of file app_image.c.
References AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_goto_if_exists(), ast_log(), ast_module_user_add, ast_module_user_remove, ast_opt_priority_jumping, ast_send_image(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_supports_images(), ast_module_user::chan, ast_channel::context, LOG_WARNING, parse(), and pbx_builtin_setvar_helper().
Referenced by load_module().
00064 { 00065 int res = 0; 00066 struct ast_module_user *u; 00067 char *parse; 00068 int priority_jump = 0; 00069 AST_DECLARE_APP_ARGS(args, 00070 AST_APP_ARG(filename); 00071 AST_APP_ARG(options); 00072 ); 00073 00074 u = ast_module_user_add(chan); 00075 00076 parse = ast_strdupa(data); 00077 00078 AST_STANDARD_APP_ARGS(args, parse); 00079 00080 if (ast_strlen_zero(args.filename)) { 00081 ast_log(LOG_WARNING, "SendImage requires an argument (filename[|options])\n"); 00082 return -1; 00083 } 00084 00085 if (args.options) { 00086 if (strchr(args.options, 'j')) 00087 priority_jump = 1; 00088 } 00089 00090 if (!ast_supports_images(chan)) { 00091 /* Does not support transport */ 00092 if (priority_jump || ast_opt_priority_jumping) 00093 ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101); 00094 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT"); 00095 ast_module_user_remove(u); 00096 return 0; 00097 } 00098 00099 res = ast_send_image(chan, args.filename); 00100 00101 if (!res) 00102 pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK"); 00103 00104 ast_module_user_remove(u); 00105 00106 return res; 00107 }
static int unload_module | ( | void | ) | [static] |
Definition at line 109 of file app_image.c.
References ast_module_user_hangup_all, and ast_unregister_application().
00110 { 00111 int res; 00112 00113 res = ast_unregister_application(app); 00114 00115 ast_module_user_hangup_all(); 00116 00117 return res; 00118 }
char* app = "SendImage" [static] |
Definition at line 47 of file app_image.c.
char* descrip [static] |
Definition at line 51 of file app_image.c.
Definition at line 49 of file app_image.c.