mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
issue #5626
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6984 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -6,9 +6,10 @@
|
|||||||
* apps/app_externalivr.c: Add a space that fixes building on older versions of gcc
|
* apps/app_externalivr.c: Add a space that fixes building on older versions of gcc
|
||||||
* many files: Add doxygen updates to categorize modules into groups. Convert a lot of comments over to doxygen style. Add some text giving a basic overview of channels.
|
* many files: Add doxygen updates to categorize modules into groups. Convert a lot of comments over to doxygen style. Add some text giving a basic overview of channels.
|
||||||
* apps/app_chanisavail.c: Make priority jumping optional
|
* apps/app_chanisavail.c: Make priority jumping optional
|
||||||
* apps/app_db.c: Add an exit status variable and make priority jumping optional
|
* apps/app_db.c: Add an exit status variable, and make priority jumping optional
|
||||||
* apps/app_enumlookup.c: Make priority jumping optional
|
* apps/app_enumlookup.c: Make priority jumping optional
|
||||||
* apps/app_groupcount.c: Add an exit status variable, make priority jumping optional, and use new args parsing macros
|
* apps/app_groupcount.c: Add an exit status variable, make priority jumping optional, and use new args parsing macros
|
||||||
|
* apps/app_image.c: Add an exit status variable, make priority jumping optional, and use new args parsing macros
|
||||||
|
|
||||||
2005-11-05 Kevin P. Fleming <kpfleming@digium.com>
|
2005-11-05 Kevin P. Fleming <kpfleming@digium.com>
|
||||||
|
|
||||||
|
@@ -38,6 +38,8 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include "asterisk/module.h"
|
#include "asterisk/module.h"
|
||||||
#include "asterisk/translate.h"
|
#include "asterisk/translate.h"
|
||||||
#include "asterisk/image.h"
|
#include "asterisk/image.h"
|
||||||
|
#include "asterisk/app.h"
|
||||||
|
#include "asterisk/options.h"
|
||||||
|
|
||||||
static char *tdesc = "Image Transmission Application";
|
static char *tdesc = "Image Transmission Application";
|
||||||
|
|
||||||
@@ -46,12 +48,14 @@ static char *app = "SendImage";
|
|||||||
static char *synopsis = "Send an image file";
|
static char *synopsis = "Send an image file";
|
||||||
|
|
||||||
static char *descrip =
|
static char *descrip =
|
||||||
" SendImage(filename): Sends an image on a channel. If the channel\n"
|
" SendImage(filename): Sends an image on a channel. \n"
|
||||||
"does not support image transport, and there exists a step with\n"
|
|
||||||
"priority n + 101, then execution will continue at that step.\n"
|
|
||||||
"Otherwise, execution will continue at the next priority level.\n"
|
|
||||||
"SendImage only returns 0 if the image was sent correctly or if\n"
|
"SendImage only returns 0 if the image was sent correctly or if\n"
|
||||||
"the channel does not support image transport, and -1 otherwise.\n";
|
"the channel does not support image transport, and -1 otherwise.\n"
|
||||||
|
"The option string may contain zero or the following character:\n"
|
||||||
|
" 'j' -- jump to priority n+101 if the channel doesn't support image transport\n"
|
||||||
|
"This application sets the following channel variable upon completion:\n"
|
||||||
|
" SENDIMAGESTATUS The status is the attempt to send an image as a text string, one of\n"
|
||||||
|
" OK | NOSUPPORT \n";
|
||||||
|
|
||||||
STANDARD_LOCAL_USER;
|
STANDARD_LOCAL_USER;
|
||||||
|
|
||||||
@@ -61,22 +65,46 @@ static int sendimage_exec(struct ast_channel *chan, void *data)
|
|||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
struct localuser *u;
|
struct localuser *u;
|
||||||
|
char *parse;
|
||||||
if (ast_strlen_zero(data)) {
|
int priority_jump = 0;
|
||||||
ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
|
AST_DECLARE_APP_ARGS(args,
|
||||||
return -1;
|
AST_APP_ARG(filename);
|
||||||
}
|
AST_APP_ARG(options);
|
||||||
|
);
|
||||||
|
|
||||||
LOCAL_USER_ADD(u);
|
LOCAL_USER_ADD(u);
|
||||||
|
|
||||||
|
if (!(parse = ast_strdupa(data))) {
|
||||||
|
ast_log(LOG_WARNING, "Memory Error!\n");
|
||||||
|
LOCAL_USER_REMOVE(u);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
AST_STANDARD_APP_ARGS(args, parse);
|
||||||
|
|
||||||
|
if (ast_strlen_zero(args.filename)) {
|
||||||
|
ast_log(LOG_WARNING, "SendImage requires an argument (filename[|options])\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.options) {
|
||||||
|
if (strchr(args.options, 'j'))
|
||||||
|
priority_jump = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!ast_supports_images(chan)) {
|
if (!ast_supports_images(chan)) {
|
||||||
/* Does not support transport */
|
/* Does not support transport */
|
||||||
|
if (priority_jump || option_priority_jumping)
|
||||||
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
|
ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
|
||||||
|
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT");
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = ast_send_image(chan, data);
|
res = ast_send_image(chan, args.filename);
|
||||||
|
|
||||||
|
if (!res)
|
||||||
|
pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "OK");
|
||||||
|
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user