Sat Aug 6 00:39:34 2011

Asterisk developer's documentation


app_image.c File Reference

App to transmit an image. More...

#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"

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, void *data)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, }
static char * app = "SendImage"
static const struct ast_module_infoast_module_info = &__mod_info
static char * descrip
static char * synopsis = "Send an image file"


Detailed Description

App to transmit an image.

Author:
Mark Spencer <markster@digium.com>

Definition in file app_image.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 125 of file app_image.c.

static void __unreg_module ( void   )  [static]

Definition at line 125 of file app_image.c.

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 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT | AST_MODFLAG_BUILDSUM, .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 = "361d7bb937402d51e4658efb5b4d76e4" , .load = load_module, .unload = unload_module, } [static]

Definition at line 125 of file app_image.c.

char* app = "SendImage" [static]

Definition at line 47 of file app_image.c.

const struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 125 of file app_image.c.

char* descrip [static]

Definition at line 51 of file app_image.c.

char* synopsis = "Send an image file" [static]

Definition at line 49 of file app_image.c.


Generated on Sat Aug 6 00:39:34 2011 for Asterisk - the Open Source PBX by  doxygen 1.4.7