aboutsummaryrefslogtreecommitdiffstats
path: root/app.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-17 20:04:10 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-02-17 20:04:10 +0000
commit4281545da55159af56a9200a2e3e19ba2b9c750d (patch)
tree86d226b36a870beee93cc75780efc71543be8b8b /app.c
parent9b334db0b459c1bc16e658d9b18c93564dbc915d (diff)
Add atxfer fix (bug #3592)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5045 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'app.c')
-rwxr-xr-xapp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/app.c b/app.c
index c1a02914d..ebda3f765 100755
--- a/app.c
+++ b/app.c
@@ -37,11 +37,20 @@
#define MAX_OTHER_FORMATS 10
+/*
+This function presents a dialtone and reads an extension into 'collect'
+which must be a pointer to a **pre-initilized** array of char having a
+size of 'size' suitable for writing to. It will collect no more than the smaller
+of 'maxlen' or 'size' minus the original strlen() of collect digits.
+*/
int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect, size_t size, int maxlen, int timeout)
{
struct tone_zone_sound *ts;
int res=0, x=0;
+ if(maxlen > size)
+ maxlen = size;
+
if(!timeout && chan->pbx)
timeout = chan->pbx->dtimeout;
else if(!timeout)
@@ -53,8 +62,7 @@ int ast_app_dtget(struct ast_channel *chan, const char *context, char *collect,
} else
ast_log(LOG_NOTICE,"Huh....? no dial for indications?\n");
- memset(collect, 0, size);
- for (x=0; strlen(collect) < size; ) {
+ for (x = strlen(collect); strlen(collect) < maxlen; ) {
res = ast_waitfordigit(chan, timeout);
if (!ast_ignore_pattern(context, collect))
ast_playtones_stop(chan);