summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2002-11-29 02:14:13 +0000
committerMark Spencer <markster@digium.com>2002-11-29 02:14:13 +0000
commitd4cce257b289c2da19e8f757455b9ef116d00e9d (patch)
treee3349bbc37c69394a11f4358e9af9f7a5d2a2329 /apps
parent55dc769bc3483555408f923e4291891b07a4ca72 (diff)
Version 0.3.0 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rwxr-xr-xapps/app_disa.c23
-rwxr-xr-xapps/app_festival.c2
-rwxr-xr-xapps/app_mp3.c2
3 files changed, 15 insertions, 12 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
diff --git a/apps/app_festival.c b/apps/app_festival.c
index d45988c99..1e88fff8e 100755
--- a/apps/app_festival.c
+++ b/apps/app_festival.c
@@ -211,7 +211,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
myf.f.frametype = AST_FRAME_VOICE;
myf.f.subclass = AST_FORMAT_SLINEAR;
myf.f.datalen = res;
- myf.f.timelen = res / 16;
+ myf.f.samples = res / 2;
myf.f.mallocd = 0;
myf.f.offset = AST_FRIENDLY_OFFSET;
myf.f.src = __PRETTY_FUNCTION__;
diff --git a/apps/app_mp3.c b/apps/app_mp3.c
index 5ef5f9bb0..e99415d53 100755
--- a/apps/app_mp3.c
+++ b/apps/app_mp3.c
@@ -164,7 +164,7 @@ static int mp3_exec(struct ast_channel *chan, void *data)
myf.f.frametype = AST_FRAME_VOICE;
myf.f.subclass = AST_FORMAT_SLINEAR;
myf.f.datalen = res;
- myf.f.timelen = res / 16;
+ myf.f.samples = res / 2;
myf.f.mallocd = 0;
myf.f.offset = AST_FRIENDLY_OFFSET;
myf.f.src = __PRETTY_FUNCTION__;