summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-06-15 14:28:58 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-06-15 14:28:58 +0000
commit7383423691bf485c47a65f61f1f631c493bd0d29 (patch)
tree8ac6441e4b40f778922d51f93a1b94c922606c4f
parent5f81cffe360284f13af48946348ad871873eef22 (diff)
Muted DTMF PCM (from FXS modules) could "leak" to the next channel.
(From xpp r5796). git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@4352 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--xpp/xbus-pcm.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/xpp/xbus-pcm.c b/xpp/xbus-pcm.c
index 6155f35..644f1b9 100644
--- a/xpp/xbus-pcm.c
+++ b/xpp/xbus-pcm.c
@@ -858,34 +858,36 @@ void generic_card_pcm_tospan(xbus_t *xbus, xpd_t *xpd, xpacket_t *pack)
{
byte *pcm;
xpp_line_t pcm_mask;
+ xpp_line_t pcm_mute;
unsigned long flags;
int i;
pcm = RPACKET_FIELD(pack, GLOBAL, PCM_READ, pcm);
pcm_mask = RPACKET_FIELD(pack, GLOBAL, PCM_READ, lines);
spin_lock_irqsave(&xpd->lock, flags);
+ pcm_mute = xpd->mute_dtmf | xpd->silence_pcm;
if(!SPAN_REGISTERED(xpd))
goto out;
for (i = 0; i < xpd->channels; i++) {
volatile u_char *r = xpd->span.chans[i].readchunk;
-
- if(!IS_SET(xpd->wanted_pcm_mask, i)) {
- if(IS_SET(xpd->silence_pcm, i)) {
- memset((u_char *)r, 0x7F, ZT_CHUNKSIZE); // SILENCE
+ bool got_data = IS_SET(pcm_mask, i);
+
+ if(IS_SET(xpd->wanted_pcm_mask, i)) {
+ /* Must fill zaptel buffers */
+ if(got_data && !IS_SET(pcm_mute, i)) {
+ /* We have and want real data */
+ // memset((u_char *)r, 0x5A, ZT_CHUNKSIZE); // DEBUG
+ // fill_beep((u_char *)r, 1, 1); // DEBUG: BEEP
+ memcpy((u_char *)r, pcm, ZT_CHUNKSIZE);
+ } else {
+ /* Inject SILENCE */
+ memset((u_char *)r, 0x7F, ZT_CHUNKSIZE);
memset(xpd->ec_chunk2[i], 0x7F, ZT_CHUNKSIZE);
memset(xpd->ec_chunk1[i], 0x7F, ZT_CHUNKSIZE);
}
- continue;
}
- pcm_mask &= ~xpd->mute_dtmf;
- if(IS_SET(pcm_mask, i)) {
- // memset((u_char *)r, 0x5A, ZT_CHUNKSIZE); // DEBUG
- // fill_beep((u_char *)r, 1, 1); // DEBUG: BEEP
- memcpy((u_char *)r, pcm, ZT_CHUNKSIZE);
+ if(got_data)
pcm += ZT_CHUNKSIZE;
- } else {
- memset((u_char *)r, 0x7F, ZT_CHUNKSIZE); // SILENCE
- }
}
out:
XPD_COUNTER(xpd, PCM_READ)++;