summaryrefslogtreecommitdiff
path: root/kernel/zaptel-base.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-04-04 23:12:04 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-04-04 23:12:04 +0000
commita96f0549dfc13f64ae578a08ee7695d2b381aa9e (patch)
treedc3211af4aa2731577f37b35ad73e350cb52c419 /kernel/zaptel-base.c
parente3f6352360841ca1d148a8c458ab77a88c972499 (diff)
Allow continuous MFR2 transmission continuously
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4141 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/zaptel-base.c')
-rw-r--r--kernel/zaptel-base.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/kernel/zaptel-base.c b/kernel/zaptel-base.c
index 2bc0ec5..dbf4520 100644
--- a/kernel/zaptel-base.c
+++ b/kernel/zaptel-base.c
@@ -378,6 +378,8 @@ struct zt_zone {
struct zt_tone mfr1[15]; /* MFR1 tones for this zone, with desired length */
struct zt_tone mfr2_fwd[15]; /* MFR2 FWD tones for this zone, with desired length */
struct zt_tone mfr2_rev[15]; /* MFR2 REV tones for this zone, with desired length */
+ struct zt_tone mfr2_fwd_continuous[16]; /* MFR2 FWD tones for this zone, continuous play */
+ struct zt_tone mfr2_rev_continuous[16]; /* MFR2 REV tones for this zone, continuous play */
};
static struct zt_span *spans[ZT_MAX_SPANS];
@@ -1195,6 +1197,48 @@ static int start_tone(struct zt_chan *chan, int tone)
} else {
res = -EINVAL;
}
+ } else if (chan->digitmode == DIGIT_MODE_MFR2_FWD) {
+ if ((tone >= ZT_TONE_MFR2_FWD_BASE) && (tone <= ZT_TONE_MFR2_FWD_MAX)) {
+ chan->dialing = 1;
+ res = 0;
+ tone -= ZT_TONE_MFR2_FWD_BASE;
+ if (chan->curzone) {
+ /* Have a tone zone */
+ if (chan->curzone->mfr2_fwd_continuous[tone].tonesamples) {
+ chan->curtone = &chan->curzone->mfr2_fwd_continuous[tone];
+ res = 0;
+ } else {
+ /* Indicate that zone is loaded but no such tone exists */
+ res = -ENOSYS;
+ }
+ } else {
+ /* Note that no tone zone exists at the moment */
+ res = -ENODATA;
+ }
+ } else {
+ res = -EINVAL;
+ }
+ } else if (chan->digitmode == DIGIT_MODE_MFR2_REV) {
+ if ((tone >= ZT_TONE_MFR2_REV_BASE) && (tone <= ZT_TONE_MFR2_REV_MAX)) {
+ chan->dialing = 1;
+ res = 0;
+ tone -= ZT_TONE_MFR2_REV_BASE;
+ if (chan->curzone) {
+ /* Have a tone zone */
+ if (chan->curzone->mfr2_rev_continuous[tone].tonesamples) {
+ chan->curtone = &chan->curzone->mfr2_rev_continuous[tone];
+ res = 0;
+ } else {
+ /* Indicate that zone is loaded but no such tone exists */
+ res = -ENOSYS;
+ }
+ } else {
+ /* Note that no tone zone exists at the moment */
+ res = -ENODATA;
+ }
+ } else {
+ res = -EINVAL;
+ }
} else {
chan->dialing = 0;
res = -EINVAL;
@@ -2797,9 +2841,16 @@ static int ioctl_load_zone(unsigned long data)
t->next = &mfr1_silence;
break;
case MFR2_FWD_TONE:
+ t->tonesamples = global_dialparams.mfr2_tonelen;
+ t->next = &dtmf_silence;
+ z->mfr2_fwd_continuous[td.tone] = *t;
+ z->mfr2_fwd_continuous[td.tone].next = &z->mfr2_fwd_continuous[td.tone];
+ break;
case MFR2_REV_TONE:
t->tonesamples = global_dialparams.mfr2_tonelen;
t->next = &dtmf_silence;
+ z->mfr2_rev_continuous[td.tone] = *t;
+ z->mfr2_rev_continuous[td.tone].next = &z->mfr2_rev_continuous[td.tone];
break;
}
}