[asterisk-commits] tilghman: trunk r241364 - in /trunk: apps/ doc/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 19 16:41:39 CST 2010
Author: tilghman
Date: Tue Jan 19 16:41:36 2010
New Revision: 241364
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=241364
Log:
Enable SendText to send strings in encoded format.
See http://lists.digium.com/pipermail/asterisk-users/2010-January/243462.html
Modified:
trunk/apps/app_sendtext.c
trunk/doc/janitor-projects.txt
Modified: trunk/apps/app_sendtext.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_sendtext.c?view=diff&rev=241364&r1=241363&r2=241364
==============================================================================
--- trunk/apps/app_sendtext.c (original)
+++ trunk/apps/app_sendtext.c Tue Jan 19 16:41:36 2010
@@ -74,22 +74,21 @@
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 @@
}
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;
}
Modified: trunk/doc/janitor-projects.txt
URL: http://svnview.digium.com/svn/asterisk/trunk/doc/janitor-projects.txt?view=diff&rev=241364&r1=241363&r2=241364
==============================================================================
--- trunk/doc/janitor-projects.txt (original)
+++ trunk/doc/janitor-projects.txt Tue Jan 19 16:41:36 2010
@@ -24,3 +24,5 @@
-- Convert all usage of the signal(2) system API to the more portable sigaction(2) system API.
-- Find options and arguments in Asterisk which specify a time period in seconds or milliseconds and convert them to use the new ast_app_parse_timelen() function.
+
+ -- Find applications and functions in Asterisk that would benefit from being able to encode control characters and extended ASCII and embed calls to ast_get_encoded_char, ast_get_encoded_str, and ast_str_get_encoded_str.
More information about the asterisk-commits
mailing list