2
* Asterisk -- A telephony toolkit for Linux.
4
* App to transmit a text message
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/lock.h>
15
#include <asterisk/file.h>
16
#include <asterisk/logger.h>
17
#include <asterisk/channel.h>
18
#include <asterisk/channel_pvt.h>
19
#include <asterisk/pbx.h>
20
#include <asterisk/module.h>
21
#include <asterisk/translate.h>
22
#include <asterisk/image.h>
26
static char *tdesc = "Send Text Applications";
28
static char *app = "SendText";
30
static char *synopsis = "Send a Text Message";
32
static char *descrip =
33
" SendText(text): Sends text to client. If the client\n"
34
"does not support text transport, and there exists a step with\n"
35
"priority n + 101, then execution will continue at that step.\n"
36
"Otherwise, execution will continue at the next priority level.\n"
37
"SendText only returns 0 if the text was sent correctly or if\n"
38
"the channel does not support text transport, and -1 otherwise.\n";
44
static int sendtext_exec(struct ast_channel *chan, void *data)
48
if (!data || !strlen((char *)data)) {
49
ast_log(LOG_WARNING, "SendText requires an argument (text)\n");
53
ast_mutex_lock(&chan->lock);
54
if (!chan->pvt->send_text) {
55
ast_mutex_unlock(&chan->lock);
56
/* Does not support transport */
57
if (ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
58
chan->priority += 100;
62
ast_mutex_unlock(&chan->lock);
63
res = ast_sendtext(chan, (char *)data);
68
int unload_module(void)
70
STANDARD_HANGUP_LOCALUSERS;
71
return ast_unregister_application(app);
76
return ast_register_application(app, sendtext_exec, synopsis, descrip);
79
char *description(void)
87
STANDARD_USECOUNT(res);
93
return ASTERISK_GPL_KEY;