Asterisk - The Open Source Telephony Project  GIT-master-9ed6387
Functions | Variables
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

 AST_MODULE_INFO_STANDARD_DEPRECATED (ASTERISK_GPL_KEY, "Image Transmission Application")
 
static int load_module (void)
 
static int sendimage_exec (struct ast_channel *chan, const char *data)
 
static int unload_module (void)
 

Variables

static char * app = "SendImage"
 

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

◆ AST_MODULE_INFO_STANDARD_DEPRECATED()

AST_MODULE_INFO_STANDARD_DEPRECATED ( ASTERISK_GPL_KEY  ,
"Image Transmission Application"   
)

Referenced by load_module().

◆ load_module()

static int load_module ( void  )
static

Definition at line 102 of file app_image.c.

References app, AST_MODULE_INFO_STANDARD_DEPRECATED(), ast_register_application_xml, ASTERISK_GPL_KEY, and sendimage_exec().

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

◆ sendimage_exec()

static int sendimage_exec ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 74 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().

75 {
76 
77  if (ast_strlen_zero(data)) {
78  ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
79  return -1;
80  }
81 
82  if (!ast_supports_images(chan)) {
83  /* Does not support transport */
84  pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "UNSUPPORTED");
85  return 0;
86  }
87 
88  if (!ast_send_image(chan, data)) {
89  pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "SUCCESS");
90  } else {
91  pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "FAILURE");
92  }
93 
94  return 0;
95 }
#define LOG_WARNING
Definition: logger.h:274
int ast_send_image(struct ast_channel *chan, const char *filename)
Sends an image.
Definition: image.c:158
union ast_frame::@255 data
#define ast_log
Definition: astobj2.c:42
int ast_supports_images(struct ast_channel *chan)
Check for image support on a channel.
Definition: image.c:67
#define ast_strlen_zero(a)
Definition: muted.c:73
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...

◆ unload_module()

static int unload_module ( void  )
static

Definition at line 97 of file app_image.c.

References app, and ast_unregister_application().

98 {
100 }
static char * app
Definition: app_image.c:38
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx_app.c:392

Variable Documentation

◆ app

char* app = "SendImage"
static

Definition at line 38 of file app_image.c.

Referenced by load_module(), and unload_module().