aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-19 22:41:36 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-19 22:41:36 +0000
commitb17f470e282e1db7efcacfe6cd5a768321e7b96f (patch)
treed61df9d82d91d602f575f115f1824ebf7608bdf1 /apps
parent1e43690cb1c3ae0b8e6f49d659803ff8c5719e7d (diff)
Enable SendText to send strings in encoded format.
See http://lists.digium.com/pipermail/asterisk-users/2010-January/243462.html git-svn-id: http://svn.digium.com/svn/asterisk/trunk@241364 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_sendtext.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/apps/app_sendtext.c b/apps/app_sendtext.c
index 100358ecf..99dbeea7e 100644
--- a/apps/app_sendtext.c
+++ b/apps/app_sendtext.c
@@ -74,22 +74,21 @@ static const char * const app = "SendText";
static int sendtext_exec(struct ast_channel *chan, const char *data)
{
- int res = 0;
char *status = "UNSUPPORTED";
- char *parse = NULL;
- AST_DECLARE_APP_ARGS(args,
- AST_APP_ARG(text);
- );
+ struct ast_str *str;
/* NOT ast_strlen_zero, because some protocols (e.g. SIP) MUST be able to
* send a zero-length message. */
if (!data) {
ast_log(LOG_WARNING, "SendText requires an argument (text)\n");
return -1;
- } else
- parse = ast_strdupa(data);
-
- AST_STANDARD_APP_ARGS(args, parse);
+ }
+
+ if (!(str = ast_str_alloca(strlen(data) + 1))) {
+ return -1;
+ }
+
+ ast_str_get_encoded_str(&str, -1, data);
ast_channel_lock(chan);
if (!chan->tech->send_text) {
@@ -100,9 +99,9 @@ static int sendtext_exec(struct ast_channel *chan, const char *data)
}
status = "FAILURE";
ast_channel_unlock(chan);
- res = ast_sendtext(chan, args.text);
- if (!res)
+ if (!ast_sendtext(chan, ast_str_buffer(str))) {
status = "SUCCESS";
+ }
pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status);
return 0;
}