diff options
author | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-08-15 18:42:22 +0000 |
---|---|---|
committer | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-08-15 18:42:22 +0000 |
commit | 5fa04d49d299ca4dfb211a67e42f15e28a6eeaf6 (patch) | |
tree | fb3b97609c4a61ddaafd4939937f796dcc352821 /zaptel.c | |
parent | 5ef86be417c154b7679e4c1905036c760b74cd28 (diff) |
Add support for looping back a single channel
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1310 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rw-r--r-- | zaptel.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1031,7 +1031,7 @@ static void close_channel(struct zt_chan *chan) chan->txgain = defgain; chan->gainalloc = 0; chan->eventinidx = chan->eventoutidx = 0; - chan->flags &= ~(ZT_FLAG_LINEAR | ZT_FLAG_PPP | ZT_FLAG_SIGFREEZE); + chan->flags &= ~(ZT_FLAG_LOOPED | ZT_FLAG_LINEAR | ZT_FLAG_PPP | ZT_FLAG_SIGFREEZE); zt_set_law(chan,0); @@ -4371,6 +4371,16 @@ static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cm put_user(chan->rxsig, (int *)data); rv = 0; break; + case ZT_LOOPBACK: + get_user(j, (int *)data); + spin_lock_irqsave(&chan->lock, flags); + if (j) + chan->flags |= ZT_FLAG_LOOPED; + else + chan->flags &= ~ZT_FLAG_LOOPED; + spin_unlock_irqrestore(&chan->lock, flags); + rv = 0; + break; case ZT_HOOK: get_user(j,(int *)data); if (chan->flags & ZT_FLAG_CLEAR) @@ -5163,6 +5173,10 @@ out in the later versions, and is put back now. */ zt_init_tone_state(&ms->ts, ms->curtone); } } + } else if (ms->flags & ZT_FLAG_LOOPED) { + for (x = 0; x < bytes; x++) + txb[x] = ms->readchunk[x]; + bytes = 0; } else if (ms->flags & ZT_FLAG_HDLC) { for (x=0;x<bytes;x++) { /* Okay, if we're HDLC, then transmit a flag by default */ |