aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_agi.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-06-21 01:16:18 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-06-21 01:16:18 +0000
commit2d0f688cafaebbbc21901710ab13edcf292c4d61 (patch)
treeb444aa3127e9807ba76c0a7ba3ef2791adb97a81 /res/res_agi.c
parentb10a02101a8f084691e8fb8b7a104afe78c55eb1 (diff)
add AGI 'RECEIVE TEXT' command (bug #4525)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5950 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_agi.c')
-rwxr-xr-xres/res_agi.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index 275ccf6d5..9ae23dca3 100755
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -403,6 +403,23 @@ static int handle_recvchar(struct ast_channel *chan, AGI *agi, int argc, char *a
}
}
+static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+{
+ char *buf;
+
+ if (argc != 3)
+ return RESULT_SHOWUSAGE;
+ buf = ast_recvtext(chan,atoi(argv[2]));
+ if (buf) {
+ fdprintf(agi->fd, "200 result=1 (%s)\n", buf);
+ free(buf);
+ return RESULT_SUCCESS;
+ } else {
+ fdprintf(agi->fd, "200 result=-1\n");
+ return RESULT_FAILURE;
+ }
+}
+
static int handle_tddmode(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
{
int res,x;
@@ -1358,6 +1375,12 @@ static char usage_recvchar[] =
" if one is received, or 0 if the channel does not support text reception. Returns\n"
" -1 only on error/hangup.\n";
+static char usage_recvtext[] =
+" Usage: RECEIVE CHAR <timeout>\n"
+" Receives a string of text on a channel. Specify timeout to be the\n"
+" maximum time to wait for input in milliseconds, or 0 for infinite. Most channels\n"
+" do not support the reception of text. Returns -1 for failure or 1 for success, and the string in parentheses.\n";
+
static char usage_tddmode[] =
" Usage: TDD MODE <on|off>\n"
" Enable/Disable TDD transmission/reception on a channel. Returns 1 if\n"
@@ -1493,7 +1516,8 @@ static agi_command commands[MAX_COMMANDS] = {
{ { "get", "variable", NULL }, handle_getvariable, "Gets a channel variable", usage_getvariable },
{ { "hangup", NULL }, handle_hangup, "Hangup the current channel", usage_hangup },
{ { "noop", NULL }, handle_noop, "Does nothing", usage_noop },
- { { "receive", "char", NULL }, handle_recvchar, "Receives text from channels supporting it", usage_recvchar },
+ { { "receive", "char", NULL }, handle_recvchar, "Receives one character from channels supporting it", usage_recvchar },
+ { { "receive", "text", NULL }, handle_recvtext, "Receives text from channels supporting it", usage_recvtext },
{ { "record", "file", NULL }, handle_recordfile, "Records to a given file", usage_recordfile },
{ { "say", "alpha", NULL }, handle_sayalpha, "Says a given character string", usage_sayalpha },
{ { "say", "digits", NULL }, handle_saydigits, "Says a given digit string", usage_saydigits },