aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_disa.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-06-15 11:42:48 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-06-15 11:42:48 +0000
commitca49f9531185d946a8684fecd3b54a9f850c6d17 (patch)
treec57a0bed391a67adf03124c9b15d5371a8f58ade /apps/app_disa.c
parentb8582037c6fbab82ec596390a47a29162552b364 (diff)
Internationalize DISA and fix Voicemail when receiving messages and you're checking them too
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1092 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_disa.c')
-rwxr-xr-xapps/app_disa.c117
1 files changed, 62 insertions, 55 deletions
diff --git a/apps/app_disa.c b/apps/app_disa.c
index 1377adc73..cb43a45e8 100755
--- a/apps/app_disa.c
+++ b/apps/app_disa.c
@@ -7,6 +7,8 @@
*
* Jim Dixon <jim@lambdatel.com>
*
+ * Made only slightly more sane by Mark Spencer <markster@digium.com>
+ *
* This program is free software, distributed under the terms of
* the GNU General Public License
*/
@@ -179,7 +181,7 @@ static int disa_exec(struct ast_channel *chan, void *data)
{
ast_log(LOG_DEBUG,"DISA %s entry timeout on chan %s\n",
((k) ? "extension" : "password"),chan->name);
- goto reorder;
+ break;
}
if ((res = ast_waitfor(chan, -1) < 0)) {
ast_log(LOG_DEBUG, "Waitfor returned %d\n", res);
@@ -296,66 +298,71 @@ static int disa_exec(struct ast_channel *chan, void *data)
exten[i] = 0;
if (!k) continue; /* if getting password, continue doing it */
/* if this exists */
- if (ast_exists_extension(chan,ourcontext,exten,1, chan->callerid))
- {
- if (ourcallerid && *ourcallerid)
- {
- if (chan->callerid) free(chan->callerid);
- chan->callerid = strdup(ourcallerid);
- }
- strcpy(chan->exten,exten);
- strcpy(chan->context,ourcontext);
- strcpy(chan->accountcode,acctcode);
- chan->priority = 0;
- ast_cdr_init(chan->cdr,chan);
- LOCAL_USER_REMOVE(u);
- return 0;
- }
+
/* if can do some more, do it */
- if (ast_canmatch_extension(chan,ourcontext,exten,1, chan->callerid)) continue;
+ if (!ast_matchmore_extension(chan,ourcontext,exten,1, chan->callerid))
+ break;
+ }
+ }
+
+ if (k && ast_exists_extension(chan,ourcontext,exten,1, chan->callerid))
+ {
+ /* We're authenticated and have a valid extension */
+ if (ourcallerid && *ourcallerid)
+ {
+ if (chan->callerid) free(chan->callerid);
+ chan->callerid = strdup(ourcallerid);
}
+ strcpy(chan->exten,exten);
+ strcpy(chan->context,ourcontext);
+ strcpy(chan->accountcode,acctcode);
+ chan->priority = 0;
+ ast_cdr_init(chan->cdr,chan);
+ LOCAL_USER_REMOVE(u);
+ return 0;
+ }
+
reorder:
- /* something is invalid, give em reorder forever */
- x = 0;
- k = 0; /* k = 0 means busy tone, k = 1 means silence) */
- i = 0; /* Number of samples we've done */
- for(;;)
- {
- if (ast_waitfor(chan, -1) < 0)
- break;
- f = ast_read(chan);
- if (!f)
- break;
- if (f->frametype == AST_FRAME_VOICE) {
- wf.frametype = AST_FRAME_VOICE;
- wf.subclass = AST_FORMAT_ULAW;
- wf.offset = AST_FRIENDLY_OFFSET;
- wf.mallocd = 0;
- wf.data = tone_block;
- wf.datalen = f->datalen;
- wf.samples = wf.datalen;
- if (k)
- memset(tone_block, 0x7f, wf.datalen);
- else
- make_tone_block(tone_block,480.0, 620.0,wf.datalen, &x);
- i += wf.datalen / 8;
- if (i > 250) {
- i = 0;
- k = !k;
- }
- if (ast_write(chan, &wf))
- {
- ast_log(LOG_WARNING, "DISA Failed to write frame on %s\n",chan->name);
- LOCAL_USER_REMOVE(u);
- return -1;
- }
+ /* something is invalid, give em reorder forever */
+ x = 0;
+ k = 0; /* k = 0 means busy tone, k = 1 means silence) */
+ i = 0; /* Number of samples we've done */
+ for(;;)
+ {
+ if (ast_waitfor(chan, -1) < 0)
+ break;
+ f = ast_read(chan);
+ if (!f)
+ break;
+ if (f->frametype == AST_FRAME_VOICE) {
+ wf.frametype = AST_FRAME_VOICE;
+ wf.subclass = AST_FORMAT_ULAW;
+ wf.offset = AST_FRIENDLY_OFFSET;
+ wf.mallocd = 0;
+ wf.data = tone_block;
+ wf.datalen = f->datalen;
+ wf.samples = wf.datalen;
+ if (k)
+ memset(tone_block, 0x7f, wf.datalen);
+ else
+ make_tone_block(tone_block,480.0, 620.0,wf.datalen, &x);
+ i += wf.datalen / 8;
+ if (i > 250) {
+ i = 0;
+ k = !k;
+ }
+ if (ast_write(chan, &wf))
+ {
+ ast_log(LOG_WARNING, "DISA Failed to write frame on %s\n",chan->name);
+ LOCAL_USER_REMOVE(u);
+ return -1;
}
- ast_frfree(f);
}
- LOCAL_USER_REMOVE(u);
- return -1;
+ ast_frfree(f);
}
+ LOCAL_USER_REMOVE(u);
+ return -1;
}
int unload_module(void)
@@ -381,7 +388,7 @@ int usecount(void)
return res;
}
-char *key()
+char *key(void)
{
return ASTERISK_GPL_KEY;
}