[Asterisk-cvs] asterisk/apps app_image.c,1.13,1.14
russell
russell
Sun Nov 6 14:28:46 CST 2005
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv4281/apps
Modified Files:
app_image.c
Log Message:
issue #5626
Index: app_image.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_image.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- app_image.c 6 Nov 2005 15:09:46 -0000 1.13
+++ app_image.c 6 Nov 2005 19:19:59 -0000 1.14
@@ -38,6 +38,8 @@
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/image.h"
+#include "asterisk/app.h"
+#include "asterisk/options.h"
static char *tdesc = "Image Transmission Application";
@@ -46,12 +48,14 @@
static char *synopsis = "Send an image file";
static char *descrip =
-" SendImage(filename): Sends an image on a channel. If the 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(filename): Sends an image on a channel. \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;
@@ -61,22 +65,46 @@
{
int res = 0;
struct localuser *u;
+ char *parse;
+ int priority_jump = 0;
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(filename);
+ AST_APP_ARG(options);
+ );
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "SendImage requires an argument (filename)\n");
+ LOCAL_USER_ADD(u);
+
+ if (!(parse = ast_strdupa(data))) {
+ ast_log(LOG_WARNING, "Memory Error!\n");
+ LOCAL_USER_REMOVE(u);
return -1;
}
- LOCAL_USER_ADD(u);
+ 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)) {
/* Does not support transport */
- ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
+ if (priority_jump || option_priority_jumping)
+ ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
+ pbx_builtin_setvar_helper(chan, "SENDIMAGESTATUS", "NOSUPPORT");
LOCAL_USER_REMOVE(u);
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);
More information about the svn-commits
mailing list