Wed Jan 8 2020 09:49:53

Asterisk developer's documentation


app_image.c File Reference

App to transmit an image. More...

#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/image.h"

Go to the source code of this file.

Functions

static void __reg_module (void)
 
static void __unreg_module (void)
 
static int load_module (void)
 
static int sendimage_exec (struct ast_channel *chan, const char *data)
 
static int unload_module (void)
 

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Image Transmission Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
 
static char * app = "SendImage"
 
static struct ast_module_infoast_module_info = &__mod_info
 

Detailed Description

App to transmit an image.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m

Definition in file app_image.c.

Function Documentation

static void __reg_module ( void  )
static

Definition at line 109 of file app_image.c.

static void __unreg_module ( void  )
static

Definition at line 109 of file app_image.c.

static int load_module ( void  )
static

Definition at line 104 of file app_image.c.

References ast_register_application_xml, and sendimage_exec().

105 {
107 }
static int sendimage_exec(struct ast_channel *chan, const char *data)
Definition: app_image.c:76
static char * app
Definition: app_image.c:40
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:437
static int sendimage_exec ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 76 of file app_image.c.

References ast_log(), ast_send_image(), ast_strlen_zero(), ast_supports_images(), LOG_WARNING, and pbx_builtin_setvar_helper().

Referenced by load_module().

77 {
78 
79  if (ast_strlen_zero(data)) {
80  ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
81  return -1;
82  }
83 
84  if (!ast_supports_images(chan)) {
85  /* Does not support transport */
86  pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "UNSUPPORTED");
87  return 0;
88  }
89 
90  if (!ast_send_image(chan, data)) {
91  pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "SUCCESS");
92  } else {
93  pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "FAILURE");
94  }
95 
96  return 0;
97 }
#define LOG_WARNING
Definition: logger.h:144
int ast_send_image(struct ast_channel *chan, const char *filename)
Sends an image.
Definition: image.c:159
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
int ast_supports_images(struct ast_channel *chan)
Check for image support on a channel.
Definition: image.c:69
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
Definition: pbx.c:10546
union ast_frame::@172 data
static int unload_module ( void  )
static

Definition at line 99 of file app_image.c.

References ast_unregister_application().

100 {
102 }
static char * app
Definition: app_image.c:40
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx.c:7705

Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Image Transmission Application" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static

Definition at line 109 of file app_image.c.

char* app = "SendImage"
static

Definition at line 40 of file app_image.c.

Definition at line 109 of file app_image.c.