2
* Asterisk -- A telephony toolkit for Linux.
4
* App to transmit a URL
6
* Copyright (C) 1999, Mark Spencer
8
* Mark Spencer <markster@linux-support.net>
10
* This program is free software, distributed under the terms of
11
* the GNU General Public License
14
#include <asterisk/file.h>
15
#include <asterisk/logger.h>
16
#include <asterisk/channel.h>
17
#include <asterisk/pbx.h>
18
#include <asterisk/module.h>
19
#include <asterisk/translate.h>
20
#include <asterisk/image.h>
25
static char *tdesc = "Send URL Applications";
27
static char *app = "SendURL";
29
static char *synopsis = "Send a URL";
31
static char *descrip =
32
" SendURL(URL[|option]): Requests client go to URL. If the client\n"
33
"does not support html transport, and there exists a step with\n"
34
"priority n + 101, then execution will continue at that step.\n"
35
"Otherwise, execution will continue at the next priority level.\n"
36
"SendURL only returns 0 if the URL was sent correctly or if\n"
37
"the channel does not support HTML transport, and -1 otherwise.\n"
38
"If the option 'wait' is specified, execution will wait for an\n"
39
"acknowledgement that the URL has been loaded before continuing\n"
40
"and will return -1 if the peer is unable to load the URL\n";
46
static int sendurl_exec(struct ast_channel *chan, void *data)
54
if (!data || !strlen((char *)data)) {
55
ast_log(LOG_WARNING, "SendURL requires an argument (URL)\n");
58
strncpy(tmp, (char *)data, sizeof(tmp)-1);
60
options = strtok(NULL, "|");
61
if (options && !strcasecmp(options, "wait"))
64
if (!ast_channel_supports_html(chan)) {
65
/* Does not support transport */
66
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
67
chan->priority += 100;
71
res = ast_channel_sendurl(chan, tmp);
75
/* Wait for an event */
76
res = ast_waitfor(chan, -1);
84
if (f->frametype == AST_FRAME_HTML) {
86
case AST_HTML_LDCOMPLETE:
91
case AST_HTML_NOSUPPORT:
92
/* Does not support transport */
93
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
94
chan->priority += 100;
99
ast_log(LOG_WARNING, "Don't know what to do with HTML subclass %d\n", f->subclass);
107
LOCAL_USER_REMOVE(u);
111
int unload_module(void)
113
STANDARD_HANGUP_LOCALUSERS;
114
return ast_unregister_application(app);
117
int load_module(void)
119
return ast_register_application(app, sendurl_exec, synopsis, descrip);
122
char *description(void)
130
STANDARD_USECOUNT(res);
136
return ASTERISK_GPL_KEY;