aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_disa.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-11-29 02:14:13 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2002-11-29 02:14:13 +0000
commit69399315991bf7f9679e2d9b22f42415653cfc04 (patch)
treee3349bbc37c69394a11f4358e9af9f7a5d2a2329 /apps/app_disa.c
parent2d459a804c0512bbceafe63a934770c2aa3f5edd (diff)
Version 0.3.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@556 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_disa.c')
-rwxr-xr-xapps/app_disa.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/apps/app_disa.c b/apps/app_disa.c
index a105c9ed8..89d956deb 100755
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -116,12 +116,13 @@ static int disa_exec(struct ast_channel *chan, void *data)
int i,j,k,x;
struct localuser *u;
char tmp[256],arg2[256],exten[AST_MAX_EXTENSION],acctcode[20];
- unsigned char tone_block[640],sil_block[640];
+ unsigned char tone_block[640];
char *ourcontext,*ourcallerid;
struct ast_frame *f,wf;
struct timeval lastout, now, lastdigittime;
int res;
FILE *fp;
+ char *stringp=NULL;
if (ast_set_write_format(chan,AST_FORMAT_ULAW))
{
@@ -134,19 +135,18 @@ static int disa_exec(struct ast_channel *chan, void *data)
return -1;
}
lastout.tv_sec = lastout.tv_usec = 0;
- /* make block of silence */
- memset(sil_block,0x7f,sizeof(sil_block));
if (!data || !strlen((char *)data)) {
ast_log(LOG_WARNING, "disa requires an argument (passcode/passcode file)\n");
return -1;
}
strncpy(tmp, (char *)data, sizeof(tmp)-1);
- strtok(tmp, "|");
- ourcontext = strtok(NULL, "|");
+ stringp=tmp;
+ strsep(&stringp, "|");
+ ourcontext = strsep(&stringp, "|");
/* if context specified, save 2nd arg and parse third */
if (ourcontext) {
strcpy(arg2,ourcontext);
- ourcallerid = strtok(NULL,"|");
+ ourcallerid = strsep(&stringp,"|");
}
/* if context not specified, use "disa" */
else {
@@ -162,6 +162,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
}
i = k = x = 0; /* k is 0 for pswd entry, 1 for ext entry */
exten[0] = 0;
+ acctcode[0] = 0;
/* can we access DISA without password? */
if (!strcasecmp(tmp, "no-password"))
{
@@ -207,7 +208,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
wf.data = tone_block;
wf.datalen = f->datalen;
make_tone_block(tone_block, 350, 440, f->datalen, &x);
- wf.timelen = wf.datalen / 8;
+ wf.samples = wf.datalen;
ast_frfree(f);
if (ast_write(chan, &wf))
{
@@ -250,6 +251,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
tmp[0] = 0;
while(fgets(tmp,sizeof(tmp) - 1,fp))
{
+ char *stringp=NULL;
if (!tmp[0]) continue;
if (tmp[strlen(tmp) - 1] == '\n')
tmp[strlen(tmp) - 1] = 0;
@@ -257,10 +259,11 @@ static int disa_exec(struct ast_channel *chan, void *data)
/* skip comments */
if (tmp[0] == '#') continue;
if (tmp[0] == ';') continue;
- strtok(tmp, "|");
+ stringp=tmp;
+ strsep(&stringp, "|");
/* save 2nd arg as clid */
ourcallerid = arg2;
- ourcontext = strtok(NULL, "|");
+ ourcontext = strsep(&stringp, "|");
/* password must be in valid format (numeric) */
if (sscanf(tmp,"%d",&j) < 1) continue;
/* if we got it */
@@ -328,7 +331,7 @@ reorder:
wf.mallocd = 0;
wf.data = tone_block;
wf.datalen = f->datalen;
- wf.timelen = wf.datalen / 8;
+ wf.samples = wf.datalen;
if (k)
memset(tone_block, 0x7f, wf.datalen);
else