#include "asterisk.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/channel.h"
Go to the source code of this file.
Enumerations | |
enum | { OPTION_WAIT = (1 << 0) } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | load_module (void) |
static int | sendurl_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 , .description = "Send URL Applications" , .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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } |
static char * | app = "SendURL" |
static struct ast_app_option | app_opts [128] = { [ 'w' ] = { .flag = OPTION_WAIT },} |
static struct ast_module_info * | ast_module_info = &__mod_info |
static char * | descrip |
enum { ... } | option_flags |
static char * | synopsis = "Send a URL" |
Definition in file app_url.c.
anonymous enum |
static int load_module | ( | void | ) | [static] |
Definition at line 144 of file app_url.c.
References ast_register_application, and sendurl_exec().
00145 { 00146 return ast_register_application(app, sendurl_exec, synopsis, descrip); 00147 }
static int sendurl_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 64 of file app_url.c.
References AST_APP_ARG, ast_app_parse_options(), ast_channel_sendurl(), ast_channel_supports_html(), AST_DECLARE_APP_ARGS, AST_FRAME_HTML, ast_frfree, AST_HTML_LDCOMPLETE, AST_HTML_NOSUPPORT, ast_log(), ast_read(), AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_waitfor(), chan, f, ast_flags::flags, LOG_WARNING, OPTION_WAIT, pbx_builtin_setvar_helper(), status, and url.
Referenced by load_module().
00065 { 00066 int res = 0; 00067 char *tmp; 00068 struct ast_frame *f; 00069 char *status = "FAILURE"; 00070 char *opts[0]; 00071 struct ast_flags flags; 00072 AST_DECLARE_APP_ARGS(args, 00073 AST_APP_ARG(url); 00074 AST_APP_ARG(options); 00075 ); 00076 00077 if (ast_strlen_zero(data)) { 00078 ast_log(LOG_WARNING, "SendURL requires an argument (URL)\n"); 00079 pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", status); 00080 return -1; 00081 } 00082 00083 tmp = ast_strdupa(data); 00084 00085 AST_STANDARD_APP_ARGS(args, tmp); 00086 if (args.argc == 2) 00087 ast_app_parse_options(app_opts, &flags, opts, args.options); 00088 00089 if (!ast_channel_supports_html(chan)) { 00090 /* Does not support transport */ 00091 pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", "UNSUPPORTED"); 00092 return 0; 00093 } 00094 res = ast_channel_sendurl(chan, args.url); 00095 if (res == -1) { 00096 pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", "FAILURE"); 00097 return res; 00098 } 00099 status = "SUCCESS"; 00100 if (ast_test_flag(&flags, OPTION_WAIT)) { 00101 for(;;) { 00102 /* Wait for an event */ 00103 res = ast_waitfor(chan, -1); 00104 if (res < 0) 00105 break; 00106 f = ast_read(chan); 00107 if (!f) { 00108 res = -1; 00109 status = "FAILURE"; 00110 break; 00111 } 00112 if (f->frametype == AST_FRAME_HTML) { 00113 switch(f->subclass) { 00114 case AST_HTML_LDCOMPLETE: 00115 res = 0; 00116 ast_frfree(f); 00117 status = "NOLOAD"; 00118 goto out; 00119 break; 00120 case AST_HTML_NOSUPPORT: 00121 /* Does not support transport */ 00122 status = "UNSUPPORTED"; 00123 res = 0; 00124 ast_frfree(f); 00125 goto out; 00126 break; 00127 default: 00128 ast_log(LOG_WARNING, "Don't know what to do with HTML subclass %d\n", f->subclass); 00129 }; 00130 } 00131 ast_frfree(f); 00132 } 00133 } 00134 out: 00135 pbx_builtin_setvar_helper(chan, "SENDURLSTATUS", status); 00136 return res; 00137 }
static int unload_module | ( | void | ) | [static] |
Definition at line 139 of file app_url.c.
References ast_unregister_application().
00140 { 00141 return ast_unregister_application(app); 00142 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Send URL Applications" , .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 = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static] |
struct ast_app_option app_opts[128] = { [ 'w' ] = { .flag = OPTION_WAIT },} [static] |
struct ast_module_info* ast_module_info = &__mod_info [static] |
enum { ... } option_flags |