diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-08-27 22:53:56 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-08-27 22:53:56 +0000 |
commit | 6caedb28655f449dda5ac754d40b507db0e83a53 (patch) | |
tree | 54daedd92306521743468c0eb7914727dfa2f7e4 /channel.c | |
parent | 803efeaeb29e81ad3af270c154834c597907dae9 (diff) |
Fix generator for VAD as well as for automatically syncing to incoming signal if present (bug #2312)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3668 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rwxr-xr-x | channel.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1,4 +1,4 @@ - /* +/* * Asterisk -- A telephony toolkit for Linux. * * Channel Management @@ -1359,12 +1359,16 @@ struct ast_frame *ast_read(struct ast_channel *chan) } /* Run any generator sitting on the line */ - if (f && (f->frametype == AST_FRAME_VOICE) && chan->generatordata && !chan->timingfunc) { + if (f && (f->frametype == AST_FRAME_VOICE) && chan->generatordata) { /* Mask generator data temporarily and apply. If there is a timing function, it will be calling the generator instead */ void *tmp; int res; int (*generate)(struct ast_channel *chan, void *tmp, int datalen, int samples); + if (chan->timingfunc) { + ast_log(LOG_DEBUG, "Generator got voice, switching to phase locked mode\n"); + ast_settimeout(chan, 0, NULL, NULL); + } tmp = chan->generatordata; chan->generatordata = NULL; generate = chan->generator->generate; @@ -1374,6 +1378,11 @@ struct ast_frame *ast_read(struct ast_channel *chan) ast_log(LOG_DEBUG, "Auto-deactivating generator\n"); ast_deactivate_generator(chan); } + } else if (f && (f->frametype == AST_FRAME_CNG)) { + if (chan->generator && !chan->timingfunc && (chan->timingfd > -1)) { + ast_log(LOG_DEBUG, "Generator got CNG, switching to zap timed mode\n"); + ast_settimeout(chan, 160, generator_force, chan); + } } if (chan->fin & 0x80000000) ast_frame_dump(chan->name, f, "<<"); |