summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-14 23:47:31 +0000
committerkpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-12-14 23:47:31 +0000
commite82cf68ec969ba027f671b27261442b54b5f8737 (patch)
tree4a8a03d12bd400e69f53b7fce7f3075a41a407c2
parentef2eddaeb8ac4e25b283081911a36a642ce5f157 (diff)
(merging dtmf-twister branch plus a few fixes)
move DTMF/MF generation into tonezone.c (libtonezone) so that it can happen at runtime instead of compile time; this allows for DTMF/MF to be different on a zone-by-zone basis without requiring a recompile of Zaptel set DTMF 'twist' for Brazil (zone 'br') to 2dB git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3490 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--Makefile10
-rw-r--r--digits.h26
-rw-r--r--gendigits.c155
-rw-r--r--tonezone.c217
-rw-r--r--tonezone.h9
-rw-r--r--wcusb.c2
-rw-r--r--zaptel-base.c383
-rw-r--r--zaptel.h33
-rw-r--r--zonedata.c1472
9 files changed, 1281 insertions, 1026 deletions
diff --git a/Makefile b/Makefile
index 7291fee..3697153 100644
--- a/Makefile
+++ b/Makefile
@@ -311,9 +311,6 @@ zonedata.lo: zonedata.c
tonezone.lo: tonezone.c
$(CC) -c $(CFLAGS) -o $@ $^
-tones.h: gendigits
- ./gendigits > $@
-
tor2fw.h: tormenta2.rbt makefw
./makefw $< tor2fw > $@
@@ -323,10 +320,7 @@ radfw.h: pciradio.rbt makefw
makefw: makefw.c
$(HOSTCC) -o $@ $^
-gendigits: gendigits.c
- $(HOSTCC) -o $@ $^ -lm
-
-prereq: config.status tones.h tor2fw.h radfw.h version.h
+prereq: config.status tor2fw.h radfw.h version.h
zttool.o: zaptel.h
zttool.o: CFLAGS+=$(NEWT_INCLUDE)
@@ -399,8 +393,6 @@ zaptel.o: zaptel-base.o $(ZAPTEL_HPEC)
$(filter-out zaptel.o,$(BUILD_TOPDIR_MODULES:%=%.o)) zaptel-base.o: %.o: %.c zaptel.h
$(CC) $(KFLAGS) -o $@ -c $<
-
-zaptel.c: tones.h
endif
stackcheck: checkstack modules
diff --git a/digits.h b/digits.h
index 61e657c..eba09dd 100644
--- a/digits.h
+++ b/digits.h
@@ -1,5 +1,5 @@
/*
- * Zapata Telephony Telephony
+ * Zapata Telephony
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,25 +17,27 @@
*
* Use DTMF/MFv1 tables
*/
+
#ifndef _DIGITS_H
#define _DIGITS_H
-#define DEFAULT_DTMF_LENGTH 100 * 8
-#define DEFAULT_MFV1_LENGTH 60 * 8
-#define PAUSE_LENGTH 500 * 8
+#define DEFAULT_DTMF_LENGTH 100 * ZT_CHUNKSIZE
+#define DEFAULT_MFV1_LENGTH 60 * ZT_CHUNKSIZE
+#define PAUSE_LENGTH 500 * ZT_CHUNKSIZE
/* At the end of silence, the tone stops */
-static struct zt_tone dtmf_silence =
- { 0, 0, 0, 0, 0, 0, DEFAULT_DTMF_LENGTH, NULL };
+static struct zt_tone dtmf_silence = {
+ .tonesamples = DEFAULT_DTMF_LENGTH,
+};
/* At the end of silence, the tone stops */
-static struct zt_tone mfv1_silence =
- { 0, 0, 0, 0, 0, 0, DEFAULT_MFV1_LENGTH, NULL };
+static struct zt_tone mfv1_silence = {
+ .tonesamples = DEFAULT_MFV1_LENGTH,
+};
/* A pause in the dialing */
-static struct zt_tone tone_pause =
- { 0, 0, 0, 0, 0, 0, PAUSE_LENGTH, NULL };
-
-#include "tones.h"
+static struct zt_tone tone_pause = {
+ .tonesamples = PAUSE_LENGTH,
+};
#endif
diff --git a/gendigits.c b/gendigits.c
deleted file mode 100644
index 5ca0c51..0000000
--- a/gendigits.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Generate a header file for a particular
- single or double frequency */
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#define CLIP 32635
-#define BIAS 0x84
-
-/* Dial frequency tables */
-typedef struct
-{
-char chr; /* character representation */
-float f1; /* first freq */
-float f2; /* second freq */
-} ZAP_DIAL;
-
-ZAP_DIAL dtmf_dial[] = {
-{ '0',941.0,1336.0 },
-{ '1',697.0,1209.0 },
-{ '2',697.0,1336.0 },
-{ '3',697.0,1477.0 },
-{ '4',770.0,1209.0 },
-{ '5',770.0,1336.0 },
-{ '6',770.0,1477.0 },
-{ '7',852.0,1209.0 },
-{ '8',852.0,1336.0 },
-{ '9',852.0,1477.0 },
-{ '*',941.0,1209.0 },
-{ '#',941.0,1477.0 },
-{ 'A',697.0,1633.0 },
-{ 'B',770.0,1633.0 },
-{ 'C',852.0,1633.0 },
-{ 'D',941.0,1633.0 },
-{ 0,0,0 }
-} ;
-
-ZAP_DIAL mf_dial[] = {
-{ '0',1300.0,1500.0 },
-{ '1',700.0,900.0 },
-{ '2',700.0,1100.0 },
-{ '3',900.0,1100.0 },
-{ '4',700.0,1300.0 },
-{ '5',900.0,1300.0 },
-{ '6',1100.0,1300.0 },
-{ '7',700.0,1500.0 },
-{ '8',900.0,1500.0 },
-{ '9',1100.0,1500.0 },
-{ '*',1100.0,1700.0 }, /* KP */
-{ '#',1500.0,1700.0 }, /* ST */
-{ 'A',900.0,1700.0 }, /* ST' */
-{ 'B',1300.0,1700.0}, /* ST'' */
-{ 'C',700.0,1700.0}, /* ST''' */
-{ 0,0,0 }
-} ;
-
-unsigned char
-linear2ulaw(sample)
-short sample; {
- static int exp_lut[256] = {0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
- 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7};
- int sign, exponent, mantissa;
- unsigned char ulawbyte;
-
- /* Get the sample into sign-magnitude. */
- sign = (sample >> 8) & 0x80; /* set aside the sign */
- if (sign != 0) sample = -sample; /* get magnitude */
- if (sample > CLIP) sample = CLIP; /* clip the magnitude */
-
- /* Convert from 16 bit linear to ulaw. */
- sample = sample + BIAS;
- exponent = exp_lut[(sample >> 7) & 0xFF];
- mantissa = (sample >> (exponent + 3)) & 0x0F;
- ulawbyte = ~(sign | (exponent << 4) | mantissa);
-#ifdef ZEROTRAP
- if (ulawbyte == 0) ulawbyte = 0x02; /* optional CCITT trap */
-#endif
-
- return(ulawbyte);
-}
-
-int process(char *label, ZAP_DIAL z[], float low_tone_level, float high_tone_level)
-{
- char c;
- float gain;
- int fac1, init_v2_1, init_v3_1,
- fac2, init_v2_2, init_v3_2;
-
- while(z->chr) {
- c = z->chr;
- if (c == '*')
- c = 's';
- if (c == '#')
- c ='p';
- /* Bring it down 6 dbm */
- gain = pow(10.0, (low_tone_level - 3.14) / 20.0) * 65536.0 / 2.0;
- fac1 = 2.0 * cos(2.0 * M_PI * (z->f1 / 8000.0)) * 32768.0;
- init_v2_1 = sin(-4.0 * M_PI * (z->f1 / 8000.0)) * gain;
- init_v3_1 = sin(-2.0 * M_PI * (z->f1 / 8000.0)) * gain;
-
- gain = pow(10.0, (high_tone_level - 3.14) / 20.0) * 65536.0 / 2.0;
- fac2 = 2.0 * cos(2.0 * M_PI * (z->f2 / 8000.0)) * 32768.0;
- init_v2_2 = sin(-4.0 * M_PI * (z->f2 / 8000.0)) * gain;
- init_v3_2 = sin(-2.0 * M_PI * (z->f2 / 8000.0)) * gain;
-
- printf("\t /* %s_%c */ { %d, %d, %d, %d, %d, %d, DEFAULT_DTMF_LENGTH, &%s_silence }, \n", label, c,
- fac1, init_v2_1, init_v3_1,
- fac2, init_v2_2, init_v3_2,
- label);
-
- z++;
- }
- return 0;
-}
-
-/* The following are the levels for the low tones (LEVEL1) and the high tones
- (LEVEL2) of DTMF digits, in dBm0. If you need to adjust these levels, this
- is the place to do it */
-#define LEVEL_DTMF_LOW -10
-#define LEVEL_DTMF_HIGH -10
-
-/* The following is the level for the tones in MF digits, in dBm0. If you
- need to adjust this level, this is the place to do it */
-#define LEVEL_MF -10
-
-int main(int argc, char *argv[])
-{
- printf("/* DTMF and MF tones used by the Tormenta Driver, in static tables.\n"
- " Generated automatically from gendigits. Do not edit by hand. */\n");
- printf("static struct zt_tone dtmf_tones[16] = {\n");
- process("dtmf", dtmf_dial, LEVEL_DTMF_LOW, LEVEL_DTMF_HIGH);
- printf("};\n\n");
- printf("static struct zt_tone mfv1_tones[15] = {\n");
- process("mfv1", mf_dial, LEVEL_MF, LEVEL_MF);
- printf("};\n\n");
- printf("/* END tones.h */\n");
-
- return 0;
-}
diff --git a/tonezone.c b/tonezone.c
index deb1ac1..413498f 100644
--- a/tonezone.c
+++ b/tonezone.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
+
#include "tonezone.h"
#define DEFAULT_ZT_DEV "/dev/zap/ctl"
@@ -63,15 +64,15 @@ struct tone_zone *tone_zone_find_by_num(int id)
#define LEVEL -10
-static int build_tone(char *data, int size, struct tone_zone_sound *t, int *count)
+static int build_tone(void *data, int size, struct tone_zone_sound *t, int *count)
{
char *dup, *s;
struct zt_tone_def *td=NULL;
int firstnobang = -1;
int freq1, freq2, time;
- int used = 0;
int modulate = 0;
float gain;
+ int used = 0;
dup = strdup(t->data);
s = strtok(dup, ",");
while(s && strlen(s)) {
@@ -125,11 +126,11 @@ static int build_tone(char *data, int size, struct tone_zone_sound *t, int *coun
#if 0
printf("Using %d samples for %d and %d\n", time * 8, freq1, freq2);
#endif
- if (size < sizeof(struct zt_tone_def)) {
- fprintf(stderr, "Not enough space for samples\n");
+ if (size < sizeof(*td)) {
+ fprintf(stderr, "Not enough space for tones\n");
return -1;
}
- td = (struct zt_tone_def *)data;
+ td = data;
/* Bring it down -8 dbm */
gain = pow(10.0, (LEVEL - 3.14) / 20.0) * 65536.0 / 2.0;
@@ -144,9 +145,9 @@ static int build_tone(char *data, int size, struct tone_zone_sound *t, int *coun
td->modulate = modulate;
- data += (sizeof(struct zt_tone_def));
- used += (sizeof(struct zt_tone_def));
- size -= (sizeof(struct zt_tone_def));
+ data += sizeof(*td);
+ used += sizeof(*td);
+ size -= sizeof(*td);
td->tone = t->toneid;
if (time) {
/* We should move to the next tone */
@@ -157,7 +158,7 @@ static int build_tone(char *data, int size, struct tone_zone_sound *t, int *coun
td->next = *count;
td->samples = 8000;
}
- (*count)++;
+ *count += 1;
s = strtok(NULL, ",");
}
if (td && time) {
@@ -203,85 +204,187 @@ char *tone_zone_tone_name(int id)
}
#ifdef TONEZONE_DRIVER
-static void dump_tone_zone(void *data)
+static void dump_tone_zone(void *data, int size)
{
struct zt_tone_def_header *z;
struct zt_tone_def *td;
int x;
- int len=0;
+ int len = sizeof(*z);
+
z = data;
data += sizeof(*z);
printf("Header: %d tones, %d bytes of data, zone %d (%s)\n",
- z->count, z->size, z->zone, z->name);
- for (x=0;x < z->count; x++) {
+ z->count, size, z->zone, z->name);
+ for (x = 0; x < z->count; x++) {
td = data;
- printf("Tone Fragment %d: %d bytes, %s tone, next is %d, %d samples total\n",
- x, td->size, tone_name(td->tone), td->next, td->samples);
+ printf("Tone Fragment %d: tone is %d, next is %d, %d samples\n",
+ x, td->tone, td->next, td->samples);
data += sizeof(*td);
- data += td->size;
- len += td->size;
+ len += sizeof(*td);
}
printf("Total measured bytes of data: %d\n", len);
}
#endif
+/* Tone frequency tables */
+struct mf_tone {
+ int tone;
+ float f1; /* first freq */
+ float f2; /* second freq */
+};
+
+static struct mf_tone dtmf_dial[] = {
+ { ZT_TONE_DTMF_0, 941.0, 1336.0 },
+ { ZT_TONE_DTMF_1, 697.0, 1209.0 },
+ { ZT_TONE_DTMF_2, 697.0, 1336.0 },
+ { ZT_TONE_DTMF_3, 697.0, 1477.0 },
+ { ZT_TONE_DTMF_4, 770.0, 1209.0 },
+ { ZT_TONE_DTMF_5, 770.0, 1336.0 },
+ { ZT_TONE_DTMF_6, 770.0, 1477.0 },
+ { ZT_TONE_DTMF_7, 852.0, 1209.0 },
+ { ZT_TONE_DTMF_8, 852.0, 1336.0 },
+ { ZT_TONE_DTMF_9, 852.0, 1477.0 },
+ { ZT_TONE_DTMF_s, 941.0, 1209.0 },
+ { ZT_TONE_DTMF_p, 941.0, 1477.0 },
+ { ZT_TONE_DTMF_A, 697.0, 1633.0 },
+ { ZT_TONE_DTMF_B, 770.0, 1633.0 },
+ { ZT_TONE_DTMF_C, 852.0, 1633.0 },
+ { ZT_TONE_DTMF_D, 941.0, 1633.0 },
+ { 0, 0, 0 }
+};
+
+static struct mf_tone mf_dial[] = {
+ { ZT_TONE_MF_0, 1300.0, 1500.0 },
+ { ZT_TONE_MF_1, 700.0, 900.0 },
+ { ZT_TONE_MF_2, 700.0, 1100.0 },
+ { ZT_TONE_MF_3, 900.0, 1100.0 },
+ { ZT_TONE_MF_4, 700.0, 1300.0 },
+ { ZT_TONE_MF_5, 900.0, 1300.0 },
+ { ZT_TONE_MF_6, 1100.0, 1300.0 },
+ { ZT_TONE_MF_7, 700.0, 1500.0 },
+ { ZT_TONE_MF_8, 900.0, 1500.0 },
+ { ZT_TONE_MF_9, 1100.0, 1500.0 },
+ { ZT_TONE_MF_s, 1100.0, 1700.0 }, /* KP */
+ { ZT_TONE_MF_p, 1500.0, 1700.0 }, /* ST */
+ { ZT_TONE_MF_A, 900.0, 1700.0 }, /* ST' */
+ { ZT_TONE_MF_B, 1300.0, 1700.0 }, /* ST'' */
+ { ZT_TONE_MF_C, 700.0, 1700.0 }, /* ST''' */
+ { 0, 0, 0 }
+};
+
+static int build_mf_tones(void *data, int size, int *count, struct mf_tone *tone, int low_tone_level, int high_tone_level)
+{
+ struct zt_tone_def *td;
+ float gain;
+ int used = 0;
+
+ while (tone->tone) {
+ if (size < sizeof(*td)) {
+ fprintf(stderr, "Not enough space for samples\n");
+ return -1;
+ }
+ td = data;
+ data += sizeof(*td);
+ used += sizeof(*td);
+ size -= sizeof(*td);
+ td->tone = tone->tone;
+ *count += 1;
+
+ /* Bring it down 6 dBm */
+ gain = pow(10.0, (low_tone_level - 3.14) / 20.0) * 65536.0 / 2.0;
+ td->fac1 = 2.0 * cos(2.0 * M_PI * (tone->f1 / 8000.0)) * 32768.0;
+ td->init_v2_1 = sin(-4.0 * M_PI * (tone->f1 / 8000.0)) * gain;
+ td->init_v3_1 = sin(-2.0 * M_PI * (tone->f1 / 8000.0)) * gain;
+
+ gain = pow(10.0, (high_tone_level - 3.14) / 20.0) * 65536.0 / 2.0;
+ td->fac2 = 2.0 * cos(2.0 * M_PI * (tone->f2 / 8000.0)) * 32768.0;
+ td->init_v2_2 = sin(-4.0 * M_PI * (tone->f2 / 8000.0)) * gain;
+ td->init_v3_2 = sin(-2.0 * M_PI * (tone->f2 / 8000.0)) * gain;
+
+ tone++;
+ }
+
+ return used;
+}
+
int tone_zone_register_zone(int fd, struct tone_zone *z)
{
char buf[MAX_SIZE];
int res;
- int count=0;
+ int count = 0;
int x;
- int used = 0;
- int iopenedit = 0;
int space = MAX_SIZE;
- char *ptr = buf;
+ void *ptr = buf;
+ int iopenedit = 1;
struct zt_tone_def_header *h;
- if (fd < 0) {
- fd = open(DEFAULT_ZT_DEV, O_RDWR);
- iopenedit=1;
- if (fd < 0) {
- fprintf(stderr, "Unable to open %s and fd not provided\n", DEFAULT_ZT_DEV);
- return -1;
- }
- }
- h = (struct zt_tone_def_header *)ptr;
- ptr += sizeof(struct zt_tone_def_header);
- space -= sizeof(struct zt_tone_def_header);
- used += sizeof(struct zt_tone_def_header);
- /*
- * Fill in ring cadence
- */
- for (x=0;x<ZT_MAX_CADENCE;x++)
+
+ h = ptr;
+ ptr += sizeof(*h);
+ space -= sizeof(*h);
+ h->zone = z->zone;
+
+ strncpy(h->name, z->description, sizeof(h->name) - 1);
+
+ for (x = 0; x < ZT_MAX_CADENCE; x++)
h->ringcadence[x] = z->ringcadence[x];
- /* Put in an appropriate method for a kernel ioctl */
- for (x=0;x<ZT_TONE_MAX;x++) {
- if (strlen(z->tones[x].data)) {
- /* It's a real tone */
+
+ for (x = 0; x < ZT_TONE_MAX; x++) {
+ if (!strlen(z->tones[x].data))
+ continue;
+
#if 0
- printf("Tone: %d, string: %s\n", z->tones[x].toneid, z->tones[x].data);
+ printf("Tone: %d, string: %s\n", z->tones[x].toneid, z->tones[x].data);
#endif
- res = build_tone(ptr, space, &z->tones[x], &count);
- if (res < 0) {
- fprintf(stderr, "Tone not built.\n");
- if (iopenedit)
- close(fd);
- return -1;
- }
- ptr += res;
- used += res;
- space -= res;
+ if ((res = build_tone(ptr, space, &z->tones[x], &count)) < 0) {
+ fprintf(stderr, "Tone %d not built.\n", x);
+ return -1;
}
+ ptr += res;
+ space -= res;
}
+
+ if ((res = build_mf_tones(ptr, space, &count, dtmf_dial, z->dtmf_low_level, z->dtmf_high_level)) < 0) {
+ fprintf(stderr, "Could not build DTMF tones.\n");
+ return -1;
+ }
+ ptr += res;
+ space -= res;
+
+ if ((res = build_mf_tones(ptr, space, &count, mf_dial, z->mf_level, z->mf_level)) < 0) {
+ fprintf(stderr, "Could not build MF tones.\n");
+ return -1;
+ }
+ ptr += res;
+ space -= res;
+
h->count = count;
- h->zone = z->zone;
- strncpy(h->name, z->description, sizeof(h->name));
+
+ if (fd < 0) {
+ if ((fd = open(DEFAULT_ZT_DEV, O_RDWR)) < 0) {
+ fprintf(stderr, "Unable to open %s and fd not provided\n", DEFAULT_ZT_DEV);
+ return -1;
+ }
+ iopenedit = 1;
+ }
+
x = z->zone;
- ioctl(fd, ZT_FREEZONE, &x);
- res = ioctl(fd, ZT_LOADZONE, h);
- if (res)
+ if ((res = ioctl(fd, ZT_FREEZONE, &x))) {
+ fprintf(stderr, "ioctl(ZT_FREEZONE) failed: %s\n", strerror(errno));
+ return res;
+ }
+
+#if defined(TONEZONE_DRIVER)
+ dump_tone_zone(h, MAX_SIZE - space);
+#endif
+
+ if ((res = ioctl(fd, ZT_LOADZONE, h))) {
fprintf(stderr, "ioctl(ZT_LOADZONE) failed: %s\n", strerror(errno));
+ return res;
+ }
+
if (iopenedit)
close(fd);
+
return res;
}
diff --git a/tonezone.h b/tonezone.h
index 7ee4dd5..fba3e91 100644
--- a/tonezone.h
+++ b/tonezone.h
@@ -41,11 +41,16 @@ struct tone_zone_sound {
};
struct tone_zone {
- int zone; /* Zone number */
+ int zone; /* Zone number */
char country[10]; /* Country code */
- char description[40]; /* Description */
+ char description[40]; /* Description */
int ringcadence[ZT_MAX_CADENCE]; /* Ring cadence */
struct tone_zone_sound tones[ZT_TONE_MAX];
+ int dtmf_high_level; /* Power level of high frequency component
+ of DTMF, expressed in dBm0. */
+ int dtmf_low_level; /* Power level of low frequency component
+ of DTMF, expressed in dBm0. */
+ int mf_level; /* Power level of MF, expressed in dBm0. */
};
extern struct tone_zone builtin_zones[];
diff --git a/wcusb.c b/wcusb.c
index c2b5582..615d4c0 100644
--- a/wcusb.c
+++ b/wcusb.c
@@ -393,7 +393,7 @@ loop_start:
}
if (debug) printk("wcusb: got digit %d\n", d->scanned_event);
if (digit != 'z') {
- d->tone = zt_dtmf_tone(digit, 0);
+ d->tone = zt_dtmf_tone(&p->chan, digit);
if (!d->tone) {
printk("wcusb: Didn't get a tone structure\n");
goto func_end;
diff --git a/zaptel-base.c b/zaptel-base.c
index 278ae29..acd4743 100644
--- a/zaptel-base.c
+++ b/zaptel-base.c
@@ -45,6 +45,7 @@
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/version.h>
+#include <linux/ctype.h>
#include <linux/kmod.h>
#ifdef CONFIG_DEVFS_FS
#include <linux/devfs_fs_kernel.h>
@@ -302,8 +303,10 @@ of the next sample chunk's data (next time around the world).
#include "digits.h"
-static struct zt_tone *dtmf_tones_continuous = NULL;
-static struct zt_tone *mfv1_tones_continuous = NULL;
+static struct zt_dialparams global_dialparams = {
+ .dtmf_tonelen = DEFAULT_DTMF_LENGTH,
+ .mfv1_tonelen = DEFAULT_MFV1_LENGTH,
+};
static int zt_chan_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long data, int unit);
@@ -363,6 +366,10 @@ struct zt_zone {
of zt_tones to generate what we
want. Use NULL if the tone is
unavailable */
+ struct zt_tone dtmf[16]; /* DTMF tones for this zone, with desired length */
+ struct zt_tone dtmf_continuous[16]; /* DTMF tones for this zone, continuous play */
+ struct zt_tone mf[15]; /* MF tones for this zone, with desired length */
+ struct zt_tone mf_continuous[15]; /* MF tones for this zone, continuous play */
};
static struct zt_span *spans[ZT_MAX_SPANS];
@@ -1074,13 +1081,11 @@ static void close_channel(struct zt_chan *chan)
static int free_tone_zone(int num)
{
struct zt_zone *z;
- if ((num < 0) || (num >= ZT_TONE_ZONE_MAX))
- return -EINVAL;
- write_lock(&zone_lock);
+
z = tone_zones[num];
tone_zones[num] = NULL;
- write_unlock(&zone_lock);
kfree(z);
+
return 0;
}
@@ -1130,10 +1135,14 @@ static int start_tone(struct zt_chan *chan, int tone)
/* ZT_SENDTONE should never be used on a channel configured for pulse dialing */
chan->dialing = 1;
res = 0;
- if (chan->digitmode == DIGIT_MODE_DTMF)
- chan->curtone = dtmf_tones_continuous + (tone - ZT_TONE_DTMF_BASE);
- else if (chan->digitmode == DIGIT_MODE_MFV1 && tone != ZT_TONE_DTMF_MAX) /* No 'D' */
- chan->curtone = mfv1_tones_continuous + (tone - ZT_TONE_DTMF_BASE);
+ if ((chan->digitmode == DIGIT_MODE_DTMF) &&
+ (tone >= ZT_TONE_DTMF_BASE) &&
+ (tone <= ZT_TONE_DTMF_MAX))
+ chan->curtone = &chan->curzone->dtmf_continuous[tone - ZT_TONE_DTMF_BASE];
+ else if ((chan->digitmode == DIGIT_MODE_MFV1) &&
+ (tone >= ZT_TONE_MF_BASE) &&
+ (tone <= ZT_TONE_MF_MAX))
+ chan->curtone = &chan->curzone->mf_continuous[tone - ZT_TONE_MF_BASE];
else {
chan->dialing = 0;
res = -EINVAL;
@@ -2563,84 +2572,112 @@ static ssize_t zt_write(struct file *file, const char *usrbuf, size_t count, lof
/* No bigger than 32k for everything per tone zone */
#define MAX_SIZE 32768
-/* No more than 64 subtones */
-#define MAX_TONES 64
-
-static int
-ioctl_load_zone(unsigned long data)
+/* No more than 128 subtones */
+#define MAX_TONES 128
+
+/* The tones to be loaded can (will) be a mix of regular tones,
+ DTMF tones and MF tones. We need to load DTMF and MF tones
+ a bit differently than regular tones because their storage
+ format is much simpler (an array structure field of the zone
+ structure, rather an array of pointers).
+*/
+static int ioctl_load_zone(unsigned long data)
{
- struct zt_tone *samples[MAX_TONES];
- short next[MAX_TONES];
+ struct zt_tone *samples[MAX_TONES] = { NULL, };
+ short next[MAX_TONES] = { 0, };
struct zt_tone_def_header th;
- void *slab, *ptr;
- long size;
- struct zt_zone *z;
struct zt_tone_def td;
+ struct zt_zone *z;
struct zt_tone *t;
+ void *slab, *ptr;
int x;
- int space;
+ size_t space;
+ size_t size;
int res;
- /* XXX Unnecessary XXX */
- memset(samples, 0, sizeof(samples));
- /* XXX Unnecessary XXX */
- memset(next, 0, sizeof(next));
- if (copy_from_user(&th, (struct zt_tone_def_header *)data, sizeof(th)))
+ if (copy_from_user(&th, (struct zt_tone_def_header *) data, sizeof(th)))
return -EFAULT;
+
+ data += sizeof(th);
+
if ((th.count < 0) || (th.count > MAX_TONES)) {
printk("Too many tones included\n");
return -EINVAL;
}
- space = size = sizeof(struct zt_zone) +
- th.count * sizeof(struct zt_tone);
- if ((size > MAX_SIZE) || (size < 0))
+
+ space = size = sizeof(*z) + th.count * sizeof(*t);
+
+ if (size > MAX_SIZE)
return -E2BIG;
- ptr = slab = (char *)kmalloc(size, GFP_KERNEL);
- if (!slab)
+
+ if (!(z = ptr = slab = kmalloc(size, GFP_KERNEL)))
return -ENOMEM;
- /* Zero it out for simplicity */
+
memset(slab, 0, size);
- /* Grab the zone */
- z = (struct zt_zone *)slab;
+
+ ptr += sizeof(*z);
+ space -= sizeof(*z);
+
strncpy(z->name, th.name, sizeof(z->name) - 1);
- for (x=0;x<ZT_MAX_CADENCE;x++)
+
+ for (x = 0; x < ZT_MAX_CADENCE; x++)
z->ringcadence[x] = th.ringcadence[x];
- data += sizeof(struct zt_tone_def_header);
- ptr += sizeof(struct zt_zone);
- space -= sizeof(struct zt_zone);
- for (x=0;x<th.count;x++) {
- if (space < sizeof(struct zt_tone)) {
- /* Check space for zt_tone struct */
+
+ for (x = 0; x < th.count; x++) {
+ enum {
+ REGULAR_TONE,
+ DTMF_TONE,
+ MF_TONE,
+ } tone_type;
+
+ if (space < sizeof(*t)) {
kfree(slab);
printk("Insufficient tone zone space\n");
return -EINVAL;
}
- if (copy_from_user(&td, (struct zt_tone_def *)data, sizeof(struct zt_tone_def))) {
+
+ if (copy_from_user(&td, (struct zt_tone_def *) data, sizeof(td))) {
kfree(slab);
return -EFAULT;
}
- /* Index the current sample */
- samples[x] = t = (struct zt_tone *)ptr;
- /* Remember which sample is next */
- next[x] = td.next;
- /* Make sure the "next" one is sane */
- if ((next[x] >= th.count) || (next[x] < 0)) {
- printk("Invalid 'next' pointer: %d\n", next[x]);
- kfree(slab);
- return -EINVAL;
- }
- if (td.tone >= ZT_TONE_MAX) {
- printk("Too many tones defined\n");
- /* Make sure it's sane */
+
+ data += sizeof(td);
+
+ if ((td.tone >= 0) && (td.tone < ZT_TONE_MAX)) {
+ tone_type = REGULAR_TONE;
+
+ t = samples[x] = ptr;
+
+ space -= sizeof(*t);
+ ptr += sizeof(*t);
+
+ /* Remember which sample is next */
+ next[x] = td.next;
+
+ /* Make sure the "next" one is sane */
+ if ((next[x] >= th.count) || (next[x] < 0)) {
+ printk("Invalid 'next' pointer: %d\n", next[x]);
+ kfree(slab);
+ return -EINVAL;
+ }
+ } else if ((td.tone >= ZT_TONE_DTMF_BASE) &&
+ (td.tone <= ZT_TONE_DTMF_MAX)) {
+ tone_type = DTMF_TONE;
+
+ td.tone -= ZT_TONE_DTMF_BASE;
+ t = &z->dtmf[td.tone];
+ } else if ((td.tone >= ZT_TONE_MF_BASE) &&
+ (td.tone <= ZT_TONE_MF_MAX)) {
+ tone_type = MF_TONE;
+
+ td.tone -= ZT_TONE_MF_BASE;
+ t = &z->mf[td.tone];
+ } else {
+ printk("Invalid tone (%d) defined\n", td.tone);
kfree(slab);
return -EINVAL;
}
- /* Update pointers to account for zt_tone header */
- space -= sizeof(struct zt_tone);
- ptr += sizeof(struct zt_tone);
- data += sizeof(struct zt_tone_def);
- /* Fill in tonedata, datalen, and tonesamples fields */
- t->tonesamples = td.samples;
+
t->fac1 = td.fac1;
t->init_v2_1 = td.init_v2_1;
t->init_v3_1 = td.init_v3_1;
@@ -2648,18 +2685,39 @@ ioctl_load_zone(unsigned long data)
t->init_v2_2 = td.init_v2_2;
t->init_v3_2 = td.init_v3_2;
t->modulate = td.modulate;
- t->next = NULL; /* XXX Unnecessary XXX */
- if (!z->tones[td.tone])
- z->tones[td.tone] = t;
+
+ switch (tone_type) {
+ case REGULAR_TONE:
+ t->tonesamples = td.samples;
+ if (!z->tones[td.tone])
+ z->tones[td.tone] = t;
+ break;
+ case DTMF_TONE:
+ t->tonesamples = global_dialparams.dtmf_tonelen;
+ t->next = &dtmf_silence;
+ z->dtmf_continuous[td.tone] = *t;
+ z->dtmf_continuous[td.tone].next = &z->dtmf_continuous[td.tone];
+ break;
+ case MF_TONE:
+ t->tonesamples = global_dialparams.mfv1_tonelen;
+ t->next = &mfv1_silence;
+ /* Special case for K/P tone */
+ if (td.tone == 10)
+ t->tonesamples *= 5 / 3;
+ z->mf_continuous[td.tone] = *t;
+ z->mf_continuous[td.tone].next = &z->mf_continuous[td.tone];
+ break;
+ }
}
- for (x=0;x<th.count;x++)
- /* Set "next" pointers */
- samples[x]->next = samples[next[x]];
- /* Actually register zone */
- res = zt_register_tone_zone(th.zone, z);
- if (res)
+ for (x = 0; x < th.count; x++) {
+ if (samples[x] && next[x])
+ samples[x]->next = samples[next[x]];
+ }
+
+ if ((res = zt_register_tone_zone(th.zone, z)))
kfree(slab);
+
return res;
}
@@ -2674,15 +2732,22 @@ void zt_init_tone_state(struct zt_tone_state *ts, struct zt_tone *zt)
ts->modulate = zt->modulate;
}
-struct zt_tone *zt_dtmf_tone(char digit, int mf)
+struct zt_tone *zt_dtmf_tone(const struct zt_chan *chan, char digit)
{
struct zt_tone *z;
- if (!mf)
- z = dtmf_tones;
- else
- z = mfv1_tones;
- switch(digit) {
+ switch (chan->digitmode) {
+ case DIGIT_MODE_DTMF:
+ z = &chan->curzone->dtmf[0];
+ break;
+ case DIGIT_MODE_MFV1:
+ z = &chan->curzone->mf[0];
+ break;
+ default:
+ z = NULL;
+ }
+
+ switch (digit) {
case '0':
case '1':
case '2':
@@ -2693,7 +2758,7 @@ struct zt_tone *zt_dtmf_tone(char digit, int mf)
case '7':
case '8':
case '9':
- return z + (int)(digit - '0');
+ return z + (digit - '0');
case '*':
return z + 10;
case '#':
@@ -2703,66 +2768,48 @@ struct zt_tone *zt_dtmf_tone(char digit, int mf)
case 'C':
return z + (digit + 12 - 'A');
case 'D':
- if (!mf)
- return z + ( digit + 12 - 'A');
- return NULL;
- case 'a':
- case 'b':
- case 'c':
- return z + (digit + 12 - 'a');
- case 'd':
- if (!mf)
- return z + ( digit + 12 - 'a');
- return NULL;
+ if (chan->digitmode == DIGIT_MODE_MFV1)
+ return NULL;
+ else
+ return z + (digit + 12 - 'A');
case 'W':
- case 'w':
return &tone_pause;
}
+
return NULL;
}
static void __do_dtmf(struct zt_chan *chan)
{
char c;
+
/* Called with chan->lock held */
- while (strlen(chan->txdialbuf)) {
- c = chan->txdialbuf[0];
- /* Skooch */
+ while ((c = chan->txdialbuf[0])) {
memmove(chan->txdialbuf, chan->txdialbuf + 1, sizeof(chan->txdialbuf) - 1);
- switch(c) {
+ switch (c) {
case 'T':
- case 't':
chan->digitmode = DIGIT_MODE_DTMF;
chan->tonep = 0;
break;
case 'M':
- case 'm':
chan->digitmode = DIGIT_MODE_MFV1;
chan->tonep = 0;
break;
case 'P':
- case 'p':
chan->digitmode = DIGIT_MODE_PULSE;
chan->tonep = 0;
break;
default:
- if (chan->digitmode == DIGIT_MODE_PULSE)
- {
- if ((c >= '0') && (c <= '9') && (chan->txhooksig == ZT_TXSIG_OFFHOOK))
- {
- chan->pdialcount = c - '0';
- /* a '0' is ten pulses */
- if (!chan->pdialcount) chan->pdialcount = 10;
- zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK,
- ZT_TXSTATE_PULSEBREAK, chan->pulsebreaktime);
+ if ((c != 'W') && (chan->digitmode == DIGIT_MODE_PULSE)) {
+ if ((c >= '0') && (c <= '9') && (chan->txhooksig == ZT_TXSIG_OFFHOOK)) {
+ chan->pdialcount = (c == '0') ? 10 : c - '0';
+ zt_rbs_sethook(chan, ZT_TXSIG_ONHOOK, ZT_TXSTATE_PULSEBREAK,
+ chan->pulsebreaktime);
return;
}
} else {
- case 'w':
- case 'W':
- chan->curtone = zt_dtmf_tone(c, (chan->digitmode == DIGIT_MODE_MFV1));
+ chan->curtone = zt_dtmf_tone(chan, c);
chan->tonep = 0;
- /* All done */
if (chan->curtone) {
zt_init_tone_state(&chan->ts, chan->curtone);
return;
@@ -2770,6 +2817,7 @@ static void __do_dtmf(struct zt_chan *chan)
}
}
}
+
/* Notify userspace process if there is nothing left */
chan->dialing = 0;
__qevent(chan, ZT_EVENT_DIALCOMPLETE);
@@ -3567,43 +3615,70 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return res;
case ZT_DEFAULTZONE:
if (get_user(j,(int *)data))
- return -EFAULT; /* get conf # */
- if ((j < 0) || (j >= ZT_TONE_ZONE_MAX)) return (-EINVAL);
+ return -EFAULT;
+ if ((j < 0) || (j >= ZT_TONE_ZONE_MAX))
+ return -EINVAL;
write_lock(&zone_lock);
+ if (!tone_zones[j]) {
+ write_unlock(&zone_lock);
+ return -EINVAL;
+ }
default_zone = j;
write_unlock(&zone_lock);
- return 0;
+ break;
case ZT_LOADZONE:
return ioctl_load_zone(data);
case ZT_FREEZONE:
- get_user(j,(int *)data); /* get conf # */
- if ((j < 0) || (j >= ZT_TONE_ZONE_MAX)) return (-EINVAL);
+ get_user(j, (int *) data);
+ if ((j < 0) || (j >= ZT_TONE_ZONE_MAX))
+ return -EINVAL;
+ write_lock(&zone_lock);
+#if 0
+ if (j == default_zone) {
+ write_unlock(&zone_lock);
+ /* XXX: possibly a better return code here */
+ return -EINVAL;
+ }
+#endif
free_tone_zone(j);
- return 0;
+ write_unlock(&zone_lock);
+ break;
case ZT_SET_DIALPARAMS:
- if (copy_from_user(&tdp, (struct zt_dialparams *)data, sizeof(tdp)))
+ if (copy_from_user(&tdp, (struct zt_dialparams *) data, sizeof(tdp)))
return -EFAULT;
if ((tdp.dtmf_tonelen > 4000) || (tdp.dtmf_tonelen < 10))
return -EINVAL;
if ((tdp.mfv1_tonelen > 4000) || (tdp.mfv1_tonelen < 10))
return -EINVAL;
- for (i=0;i<16;i++)
- dtmf_tones[i].tonesamples = tdp.dtmf_tonelen * ZT_CHUNKSIZE;
+
+ global_dialparams = tdp;
+
+ /* update the lengths in all currently loaded zones */
+ write_lock(&zone_lock);
+ for (j = 0; j < sizeof(tone_zones) / sizeof(tone_zones[0]); j++) {
+ struct zt_zone *z = tone_zones[j];
+
+ if (!z)
+ continue;
+
+ for (i = 0; i < sizeof(z->dtmf) / sizeof(z->dtmf[0]); i++)
+ z->dtmf[i].tonesamples = tdp.dtmf_tonelen * ZT_CHUNKSIZE;
+
+ for (i = 0; i < sizeof(z->mf) / sizeof(z->mf[0]); i++)
+ z->mf[i].tonesamples = tdp.mfv1_tonelen * ZT_CHUNKSIZE;
+
+ /* Special case for K/P tone */
+ z->mf[10].tonesamples *= 5 / 3;
+ }
+ write_unlock(&zone_lock);
+
dtmf_silence.tonesamples = tdp.dtmf_tonelen * ZT_CHUNKSIZE;
- for (i=0;i<15;i++)
- mfv1_tones[i].tonesamples = tdp.mfv1_tonelen * ZT_CHUNKSIZE;
mfv1_silence.tonesamples = tdp.mfv1_tonelen * ZT_CHUNKSIZE;
- /* Special case for K/P tone */
- mfv1_tones[10].tonesamples = tdp.mfv1_tonelen * ZT_CHUNKSIZE * 5 / 3;
+
break;
case ZT_GET_DIALPARAMS:
- tdp.dtmf_tonelen = dtmf_tones[0].tonesamples / ZT_CHUNKSIZE;
- tdp.mfv1_tonelen = mfv1_tones[0].tonesamples / ZT_CHUNKSIZE;
- tdp.reserved[0] = 0;
- tdp.reserved[1] = 0;
- tdp.reserved[2] = 0;
- tdp.reserved[3] = 0;
- if (copy_to_user((struct zt_dialparams *)data, &tdp, sizeof(tdp)))
+ tdp = global_dialparams;
+ if (copy_to_user((struct zt_dialparams *) data, &tdp, sizeof(tdp)))
return -EFAULT;
break;
case ZT_GETVERSION:
@@ -3687,6 +3762,7 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign
unsigned long flags, flagso;
int i, j, k, rv;
int ret, c;
+ char *s;
if (!chan)
return -EINVAL;
@@ -3702,10 +3778,12 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign
if (copy_from_user(&stack.tdo, (struct zt_dialoperation *)data, sizeof(stack.tdo)))
return -EFAULT;
rv = 0;
- /* Force proper NULL termination */
+ /* Force proper NULL termination and uppercase entry */
stack.tdo.dialstr[ZT_MAX_DTMF_BUF - 1] = '\0';
+ for (s = stack.tdo.dialstr; *s; s++)
+ *s = toupper(*s);
spin_lock_irqsave(&chan->lock, flags);
- switch(stack.tdo.op) {
+ switch (stack.tdo.op) {
case ZT_DIAL_OP_CANCEL:
chan->curtone = NULL;
chan->dialing = 0;
@@ -3719,17 +3797,15 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign
__do_dtmf(chan);
break;
case ZT_DIAL_OP_APPEND:
- if (strlen(stack.tdo.dialstr) + strlen(chan->txdialbuf) >= ZT_MAX_DTMF_BUF)
- {
+ if (strlen(stack.tdo.dialstr) + strlen(chan->txdialbuf) >= (ZT_MAX_DTMF_BUF - 1)) {
rv = -EBUSY;
break;
- }
- strncpy(chan->txdialbuf + strlen(chan->txdialbuf), stack.tdo.dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf));
- if (!chan->dialing)
- {
+ }
+ strncpy(chan->txdialbuf + strlen(chan->txdialbuf), stack.tdo.dialstr, ZT_MAX_DTMF_BUF - strlen(chan->txdialbuf) - 1);
+ if (!chan->dialing) {
chan->dialing = 1;
__do_dtmf(chan);
- }
+ }
break;
default:
rv = -EINVAL;
@@ -7144,7 +7220,6 @@ static void __exit watchdog_cleanup(void)
static int __init zt_init(void) {
int res = 0;
- int i = 0;
#ifdef CONFIG_PROC_FS
proc_entries[0] = proc_mkdir("zaptel", NULL);
@@ -7178,26 +7253,6 @@ static int __init zt_init(void) {
}
#endif /* CONFIG_DEVFS_FS */
- if (!(dtmf_tones_continuous = kmalloc(sizeof(dtmf_tones), GFP_KERNEL))) {
- printk(KERN_ERR "Zaptel: THERE IS A CRISIS IN THE BATCAVE!"
- " Unable to allocate memory for continuous DTMF tones list!\n");
- return -ENOMEM;
- }
-
- if (!(mfv1_tones_continuous = kmalloc(sizeof(mfv1_tones), GFP_KERNEL))) {
- printk(KERN_ERR "Zaptel: THERE IS A CRISIS IN THE BATCAVE!"
- " Unable to allocate memory for continuous MFV1 tones list!\n");
- return -ENOMEM;
- }
-
- memcpy(dtmf_tones_continuous, dtmf_tones, sizeof(dtmf_tones));
- for (i = 0; i < (sizeof(dtmf_tones) / sizeof(dtmf_tones[0])); i++)
- dtmf_tones_continuous[i].next = dtmf_tones_continuous + i;
-
- memcpy(mfv1_tones_continuous, mfv1_tones, sizeof(mfv1_tones));
- for (i = 0; i < (sizeof(mfv1_tones) / sizeof(mfv1_tones[0])); i++)
- mfv1_tones_continuous[i].next = mfv1_tones_continuous + i;
-
printk(KERN_INFO "Zapata Telephony Interface Registered on major %d\n", ZT_MAJOR);
printk(KERN_INFO "Zaptel Version: %s\n", ZAPTEL_VERSION);
echo_can_init();
@@ -7224,16 +7279,6 @@ static void __exit zt_cleanup(void) {
kfree(tone_zones[x]);
}
- if (dtmf_tones_continuous) {
- kfree(dtmf_tones_continuous);
- dtmf_tones_continuous = NULL;
- }
-
- if (mfv1_tones_continuous) {
- kfree(mfv1_tones_continuous);
- mfv1_tones_continuous = NULL;
- }
-
#ifdef CONFIG_DEVFS_FS
devfs_unregister(timer);
devfs_unregister(transcode);
diff --git a/zaptel.h b/zaptel.h
index 1695171..fa959a5 100644
--- a/zaptel.h
+++ b/zaptel.h
@@ -518,7 +518,7 @@ struct zt_hwgain{
#define ZT_DEFAULTZONE _IOW (ZT_CODE, 24, int)
/*
- * Load a tone zone from a ZT_tone_def_header, see
+ * Load a tone zone from a zt_tone_def_header, see
* below...
*/
#define ZT_LOADZONE _IOW (ZT_CODE, 25, struct zt_tone_def_header)
@@ -765,10 +765,8 @@ struct zt_hwgain{
#define ZT_TONE_MAX 16
#define ZT_TONE_DTMF_BASE 64
+#define ZT_TONE_MF_BASE 80
-/*
- * These must be in the same order as the dtmf_tones array in tones.h
- */
enum {
ZT_TONE_DTMF_0 = ZT_TONE_DTMF_BASE,
ZT_TONE_DTMF_1,
@@ -790,6 +788,26 @@ enum {
#define ZT_TONE_DTMF_MAX ZT_TONE_DTMF_D
+enum {
+ ZT_TONE_MF_0 = ZT_TONE_MF_BASE,
+ ZT_TONE_MF_1,
+ ZT_TONE_MF_2,
+ ZT_TONE_MF_3,
+ ZT_TONE_MF_4,
+ ZT_TONE_MF_5,
+ ZT_TONE_MF_6,
+ ZT_TONE_MF_7,
+ ZT_TONE_MF_8,
+ ZT_TONE_MF_9,
+ ZT_TONE_MF_s,
+ ZT_TONE_MF_p,
+ ZT_TONE_MF_A,
+ ZT_TONE_MF_B,
+ ZT_TONE_MF_C,
+};
+
+#define ZT_TONE_MF_MAX ZT_TONE_MF_C
+
#define ZT_MAX_CADENCE 16
#define ZT_TONEDETECT_ON (1 << 0) /* Detect tones */
@@ -855,7 +873,7 @@ struct zt_tone_def_header {
int zone; /* Which zone we are loading */
int ringcadence[ZT_MAX_CADENCE]; /* Ring cadence in ms (0=on, 1=off, ends with 0 value) */
char name[40]; /* Informational name of zone */
- /* Immediately follow the ZT_tone_def_header by ZT_tone_def's */
+ /* Immediately follow the zt_tone_def_header by zt_tone_def's */
};
struct zt_tone_def { /* Structure for zone programming */
@@ -1675,9 +1693,8 @@ void zt_alarm_notify(struct zt_span *span);
/* Initialize a tone state */
void zt_init_tone_state(struct zt_tone_state *ts, struct zt_tone *zt);
-/* Get a given DTMF or MF tone struct, suitable for zt_tone_nextsample.
- Set 'mf' to 0 for DTMF or 1 for MFv1 */
-struct zt_tone *zt_dtmf_tone(char digit, int mf);
+/* Get a given DTMF or MF tone struct, suitable for zt_tone_nextsample. */
+struct zt_tone *zt_dtmf_tone(const struct zt_chan *chan, char digit);
/* Echo cancel a receive and transmit chunk for a given channel. This
should be called by the low-level driver as close to the interface
diff --git a/zonedata.c b/zonedata.c
index c6d812d..3962224 100644
--- a/zonedata.c
+++ b/zonedata.c
@@ -25,620 +25,866 @@
*/
#include "tonezone.h"
-struct tone_zone builtin_zones[] =
+struct tone_zone builtin_zones[] =
{
- { 0, "us", "United States / North America", { 2000, 4000 },
- {
- { ZT_TONE_DIALTONE, "350+440" },
- { ZT_TONE_BUSY, "480+620/500,0/500" },
- { ZT_TONE_RINGTONE, "440+480/2000,0/4000" },
- { ZT_TONE_CONGESTION, "480+620/250,0/250" },
- { ZT_TONE_CALLWAIT, "440/300,0/10000" },
- { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
- { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- },
- },
- { 1, "au", "Australia", { 400, 200, 400, 2000 },
- {
- { ZT_TONE_DIALTONE, "413+438" },
- { ZT_TONE_BUSY, "425/375,0/375" },
- { ZT_TONE_RINGTONE, "413+438/400,0/200,413+438/400,0/2000" },
- /* XXX Congestion: Should reduce by 10 db every other cadence XXX */
- { ZT_TONE_CONGESTION, "425/375,0/375,420/375,0/375" },
- { ZT_TONE_CALLWAIT, "425/100,0/200,425/200,0/4400" },
- { ZT_TONE_DIALRECALL, "413+428" },
- { ZT_TONE_RECORDTONE, "!425/1000,!0/15000,425/360,0/15000" },
- { ZT_TONE_INFO, "425/2500,0/500" },
- { ZT_TONE_STUTTER, "413+438/100,0/40" },
- },
- },
- { 2, "fr", "France", { 1500, 3500 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- /* Dialtone can also be 440+330 */
- { ZT_TONE_DIALTONE, "440" },
- { ZT_TONE_BUSY, "440/500,0/500" },
- { ZT_TONE_RINGTONE, "440/1500,0/3500" },
- /* CONGESTION - not specified */
- { ZT_TONE_CONGESTION, "440/250,0/250" },
- { ZT_TONE_CALLWAIT, "440/300,0/10000" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
- { ZT_TONE_STUTTER, "!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,440" },
- },
- },
- { 3, "nl", "Netherlands", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- /* Most of these 425's can also be 450's */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/250,0/250" },
- { ZT_TONE_CALLWAIT, "425/500,0/9500" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "425/500,0/50" },
- },
- },
- { 4, "uk", "United Kingdom", { 400, 200, 400, 2000 },
- {
- /* From British Telecom SIN350 v1.2 */
- { ZT_TONE_DIALTONE, "350+440" },
- { ZT_TONE_BUSY, "400/375,0/375" },
- { ZT_TONE_RINGTONE, "400+450/400,0/200,400+450/400,0/2000" },
- { ZT_TONE_CONGESTION, "400/400,0/350,400/225,0/525" },
- { ZT_TONE_CALLWAIT, "400/100,0/4000" },
- { ZT_TONE_DIALRECALL, "350+440" },
- { ZT_TONE_RECORDTONE, "1400/500,0/60000" },
- { ZT_TONE_INFO, "950/330,0/15,1400/330,0/15,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "350+440/750,440/750" },
- },
- },
- { 5, "fi", "Finland", { 1000, 4000 },
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/300,0/300" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/8000" },
- { ZT_TONE_DIALRECALL, "425/650,0/25" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "950/650,0/325,950/325,0/30,1400/1300,0/2600" },
- { ZT_TONE_STUTTER, "425/650,0/25" },
- },
- },
- { 6,"es","Spain", { 1500, 3000},
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/200,0/200" },
- { ZT_TONE_RINGTONE, "425/1500,0/3000" },
- { ZT_TONE_CONGESTION, "425/200,0/200,425/200,0/200,425/200,0/600" },
- { ZT_TONE_CALLWAIT, "425/175,0/175,425/175,0/3500" },
- { ZT_TONE_DIALRECALL, "!425/200,!0/200,!425/200,!0/200,!425/200,!0/200,425" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "950/330,0/1000" },
- { ZT_TONE_STUTTER, "425/500,0/50" },
- },
- },
- { 7,"jp","Japan", { 1000, 2000 },
- {
- { ZT_TONE_DIALTONE, "400" },
- { ZT_TONE_BUSY, "400/500,0/500" },
- { ZT_TONE_RINGTONE, "400+15/1000,0/2000" },
- { ZT_TONE_CONGESTION, "400/500,0/500" },
- { ZT_TONE_CALLWAIT, "400+16/500,0/8000" },
- { ZT_TONE_DIALRECALL, "!400/200,!0/200,!400/200,!0/200,!400/200,!0/200,400" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
- { ZT_TONE_STUTTER, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" },
- },
- },
- { 8,"no","Norway", { 1000, 4000 },
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "425/200,0/600,425/200,0/10000" },
- { ZT_TONE_DIALRECALL, "470/400,425/400" },
- { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
- { ZT_TONE_STUTTER, "470/400,425/400" },
- },
- },
- { 9, "at", "Austria", { 1000, 5000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "420" },
- { ZT_TONE_BUSY, "420/400,0/400" },
- { ZT_TONE_RINGTONE, "420/1000,0/5000" },
- { ZT_TONE_CONGESTION, "420/200,0/200" },
- { ZT_TONE_CALLWAIT, "420/40,0/1960" },
- { ZT_TONE_DIALRECALL, "420" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/80,0/14920" },
- { ZT_TONE_INFO, "950/330,1450/330,1850/330,0/1000" },
- { ZT_TONE_STUTTER, "380+420" },
- },
- },
- { 10, "nz", "New Zealand", { 400, 200, 400, 2000 },
- {
- { ZT_TONE_DIALTONE, "400" },
- { ZT_TONE_BUSY, "400/500,0/500" },
- { ZT_TONE_RINGTONE, "400+450/400,0/200,400+450/400,0/2000" },
- { ZT_TONE_CONGESTION, "400/250,0/250" },
- { ZT_TONE_CALLWAIT, "400/250,0/250,400/250,0/3250" },
- { ZT_TONE_DIALRECALL, "!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400" },
- { ZT_TONE_RECORDTONE, "1400/425,0/15000" },
- { ZT_TONE_INFO, "400/750,0/100,400/750,0/100,400/750,0/100,400/750,0/400" },
- { ZT_TONE_STUTTER, "!400/100!0/100,!400/100,!0/100,!400/100,!0/100,!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400" },
- },
- },
- { 11,"it","Italy", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425/200,0/200,425/600,0/1000" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "425/400,0/100,425/250,0/100,425/150,0/14000" },
- { ZT_TONE_DIALRECALL, "470/400,425/400" },
- { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
- { ZT_TONE_STUTTER, "470/400,425/400" },
- },
- },
- { 12, "us-old", "United States Circa 1950/ North America", { 2000, 4000 },
- {
- { ZT_TONE_DIALTONE, "600*120" },
- { ZT_TONE_BUSY, "500*100/500,0/500" },
- { ZT_TONE_RINGTONE, "420*40/2000,0/4000" },
- { ZT_TONE_CONGESTION, "500*100/250,0/250" },
- { ZT_TONE_CALLWAIT, "440/300,0/10000" },
- { ZT_TONE_DIALRECALL, "!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
- { ZT_TONE_STUTTER, "!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120" },
- },
- },
- { 13, "gr", "Greece", { 1000, 4000 },
- {
- { ZT_TONE_DIALTONE, "425/200,0/300,425/700,0/800" },
- { ZT_TONE_BUSY, "425/300,0/300" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/8000" },
- { ZT_TONE_DIALRECALL, "425/650,0/25" },
- { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
- { ZT_TONE_STUTTER, "425/650,0/25" },
- },
- },
- { 14, "tw", "Taiwan", { 1000, 4000 },
- {
- { ZT_TONE_DIALTONE, "350+440" },
- { ZT_TONE_BUSY, "480+620/500,0/500" },
- { ZT_TONE_RINGTONE, "440+480/1000,0/2000" },
- { ZT_TONE_CONGESTION, "480+620/250,0/250" },
- { ZT_TONE_CALLWAIT, "350+440/250,0/250,350+440/250,0/3250" },
- { ZT_TONE_DIALRECALL, "300/1500,0/500" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
- { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- },
- },
- { 15, "cl", "Chile", { 1000, 3000 },
- {
- { ZT_TONE_DIALTONE, "400" },
- { ZT_TONE_BUSY, "400/500,0/500" },
- { ZT_TONE_RINGTONE, "400/1000,0/3000" },
- { ZT_TONE_CONGESTION, "400/200,0/200" },
- { ZT_TONE_CALLWAIT, "400/250,0/8750" },
- { ZT_TONE_DIALRECALL, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/333,!1400/333,!1800/333,0" },
- { ZT_TONE_STUTTER, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" },
- },
- },
- { 16, "se", "Sweden", { 1000, 5000 },
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/250,0/250" },
- { ZT_TONE_RINGTONE, "425/1000,0/5000" },
- { ZT_TONE_CONGESTION, "425/250,0/750" },
- { ZT_TONE_CALLWAIT, "425/200,0/500,425/200,0/9100" },
- { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,"
- "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,"
- "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,"
- "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,"
- "!950/332,!0/24,!1400/332,!0/24,!1800/332,0" },
- /*{ ZT_TONE_STUTTER, "425/320,0/20" }, Real swedish standard, not used for now */
- { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- },
- },
- { 17, "be", "Belgium", { 1000, 3000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/3000" },
- { ZT_TONE_CONGESTION, "425/167,0/167" },
- { ZT_TONE_CALLWAIT, "1400/175,0/175,1400/175,0/3500" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "900/330,1400/330,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "425/1000,0/250" },
- },
- },
- { 18, "sg", "Singapore", { 400, 200, 400, 2000 },
- {
- /* Reference: http://www.ida.gov.sg/idaweb/doc/download/I397/ida_ts_pstn1_i4r2.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/750,0/750" },
- { ZT_TONE_RINGTONE, "425*24/400,0/200,425*24/400,0/2000" },
- { ZT_TONE_CONGESTION, "425/250,0/250" },
- { ZT_TONE_CALLWAIT, "425*24/300,0/200,425*24/300,0/3200" },
- /* DIALRECALL - not specified - use repeating Holding Tone A,B*/
- { ZT_TONE_DIALRECALL, "425*24/500,0/500,425/500,0/2500" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,425" },
- },
- },
- { 19, "il", "Israel", { 1000, 3000 },
- {
- { ZT_TONE_DIALTONE, "414" },
- { ZT_TONE_BUSY, "414/500,0/500" },
- { ZT_TONE_RINGTONE, "414/1000,0/3000" },
- { ZT_TONE_CONGESTION, "414/250,0/250" },
- { ZT_TONE_CALLWAIT, "414/100,0/100,414/100,0/100,414/600,0/3000" },
- { ZT_TONE_DIALRECALL, "!414/100,!0/100,!414/100,!0/100,!414/100,!0/100,414" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "1000/330,1400/330,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,414" },
- },
- },
- { 20, "br", "Brazil", { 1000, 4000 },
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/250,0/250" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/250,0/250,425/750,0/250" },
- { ZT_TONE_CALLWAIT, "425/50,0/1000" },
- { ZT_TONE_DIALRECALL, "350+440" },
- { ZT_TONE_RECORDTONE, "425/250,0/250" },
- { ZT_TONE_INFO, "950/330,1400/330,1800/330" },
- { ZT_TONE_STUTTER, "350+440" } },
- },
- { 21, "hu", "Hungary", { 1250, 3750 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/300,0/300" },
- { ZT_TONE_RINGTONE, "425/1250,0/3750" },
- { ZT_TONE_CONGESTION, "425/300,0/300" },
- { ZT_TONE_CALLWAIT, "425/40,0/1960" },
- { ZT_TONE_DIALRECALL, "425+450" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
- { ZT_TONE_STUTTER, "350+375+400" },
- },
- },
- { 22, "lt", "Lithuania", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/350,0/350" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
- /* STUTTER not specified */
- { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- },
- },
- { 23, "pl", "Poland", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/500,0/500" },
- { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,0" },
- /* STUTTER not specified */
- { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- },
- },
- { 24, "za", "South Africa", { 400, 200, 400, 2000 },
- {
- { ZT_TONE_DIALTONE, "400*33" },
- { ZT_TONE_BUSY, "400/500,0/500" },
- { ZT_TONE_RINGTONE, "400*33/400,0/200,400*33/400,0/2000" },
- { ZT_TONE_CONGESTION, "400/250,0/250" },
- { ZT_TONE_CALLWAIT, "400*33/250,0/250,400*33/250,0/250,400*33/250,0/250,400*33/250,0/250" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "350+440" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
- /* STUTTER not specified */
- { ZT_TONE_STUTTER, "!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,400*33" },
- },
- },
- { 25, "pt", "Portugal", { 1000, 5000 },
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/5000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "425/200,425/200,425/200,0/5000" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "425/1000,0/200" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
- /* STUTTER not specified */
- { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- },
- },
- { 26, "ee", "Estonia", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/300,0/300" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "950/650,0/325,950/325,0/30,1400/1300,0/2600" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "425/650,0/25" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "950/0,0/325,950/325,0/30,1400/1300,0/2600" },
- /* STUTTER not specified */
- { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- },
- },
- { 27, "mx", "Mexico", { 2000, 4000 },
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/250,0/250" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/250,0/250" },
- { ZT_TONE_CALLWAIT, "425/200,0/600,425/200,0/10000" },
- { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "950/330,0/30,1400/330,0/30,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- },
- },
- { 28, "in", "India", { 400, 200, 400, 2000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "400*25" },
- { ZT_TONE_BUSY, "400/750,0/750" },
- { ZT_TONE_RINGTONE, "400*25/400,0/200,400*25/400,0/2000" },
- { ZT_TONE_CONGESTION, "400/250,0/250" },
- { ZT_TONE_CALLWAIT, "400/200,0/100,400/200,0/7500" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- /* INFO - not specified */
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0/1000" },
- /* STUTTER - not specified */
- { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- },
- },
- { 29, "de", "Germany", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/480,0/480" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/240,0/240" },
- { ZT_TONE_CALLWAIT, "!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,0" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/80,0/15000" },
- { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "425+400" },
- },
- },
- { 30, "ch", "Switzerland", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "425/200,0/200,425/200,0/4000" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/80,0/15000" },
- { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "425+340/1100,0/1100" },
- },
- },
- { 31, "dk", "Denmark", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/200,0/200" },
- { ZT_TONE_CALLWAIT, "!425/200,!0/600,!425/200,!0/3000,!425/200,!0/200,!425/200,0" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/80,0/15000" },
- { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
- /* STUTTER - not specified */
- { ZT_TONE_STUTTER, "425/450,0/50" },
- },
- },
- { 32, "cz", "Czech Republic", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425/330,0/330,425/660,0/660" },
- { ZT_TONE_BUSY, "425/330,0/330" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/165,0/165" },
- { ZT_TONE_CALLWAIT, "425/330,0/9000" },
- /* DIALRECALL - not specified */
- { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/14000" },
- { ZT_TONE_INFO, "950/330,0/30,1400/330,0/30,1800/330,0/1000" },
- /* STUTTER - not specified */
- { ZT_TONE_STUTTER, "425/450,0/50" },
- },
- },
- { 33, "cn", "China", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "450" },
- { ZT_TONE_BUSY, "450/350,0/350" },
- { ZT_TONE_RINGTONE, "450/1000,0/4000" },
- { ZT_TONE_CONGESTION, "450/700,0/700" },
- { ZT_TONE_CALLWAIT, "450/400,0/4000" },
- { ZT_TONE_DIALRECALL, "450" },
- { ZT_TONE_RECORDTONE, "950/400,0/10000" },
- { ZT_TONE_INFO, "450/100,0/100,450/100,0/100,450/100,0/100,450/400,0/400" },
- /* STUTTER - not specified */
- { ZT_TONE_STUTTER, "450+425" },
- },
- },
- { 34, "ar", "Argentina", { 1000, 4500 },
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/300,0/300" },
- { ZT_TONE_RINGTONE, "425/1000,0/4500" },
- { ZT_TONE_CONGESTION, "425/200,0/300" },
- { ZT_TONE_CALLWAIT, "425/200,0/9000" },
- { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660" },
- { ZT_TONE_RECORDTONE, "1400/500,0/14000" },
- { ZT_TONE_INFO, "425/100,0/100" },
- { ZT_TONE_STUTTER, "425/450,0/50" },
- },
- },
- { 35, "my", "Malaysia", { 400, 200, 400, 2000 },
- {
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/400,0/200,425/400,0/2000" },
- { ZT_TONE_CONGESTION, "425/500,0/500" },
- { ZT_TONE_CALLWAIT, "425/100,0/4000" },
- { ZT_TONE_DIALRECALL, "350+440" },
- { ZT_TONE_RECORDTONE, "1400/500,0/60000" },
- { ZT_TONE_INFO, "950/330,0/15,1400/330,0/15,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "450+425" },
- },
- },
- { 36, "th", "Thailand", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "400*50" },
- { ZT_TONE_BUSY, "400/500,0/500" },
- { ZT_TONE_RINGTONE, "400/1000,0/4000" },
- { ZT_TONE_CONGESTION, "400/300,0/300" },
- { ZT_TONE_CALLWAIT, "1000/400,10000/400,1000/400" },
- /* DIALRECALL - not specified - use special dial tone instead. */
- { ZT_TONE_DIALRECALL, "400*50/400,0/100,400*50/400,0/100" },
- /* RECORDTONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- /* INFO - specified as an announcement - use tones instead. */
- { ZT_TONE_INFO, "950/330,1400/330,1800/330" },
- /* STUTTER - not specified */
- { ZT_TONE_STUTTER, "!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,400" },
- },
- },
- { 37, "bg", "Bulgaria", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/250,0/250" },
- { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" },
- { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- { ZT_TONE_RECORDTONE, "1400/425,0/15000" },
- { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "425/1500,0/100" },
- },
- },
- { 38, "ve", "Venezuela", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/500,0/500" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/250,0/250" },
- { ZT_TONE_CALLWAIT, "400+450/300,0/6000" },
- { ZT_TONE_DIALRECALL, "425" },
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- { ZT_TONE_INFO, "!950/330,!1440/330,!1800/330,0/1000" },
- /* STUTTER - not specified */
- { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- },
+ { .zone = 0,
+ .country = "us",
+ .description = "United States / North America",
+ .ringcadence = { 2000, 4000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "350+440" },
+ { ZT_TONE_BUSY, "480+620/500,0/500" },
+ { ZT_TONE_RINGTONE, "440+480/2000,0/4000" },
+ { ZT_TONE_CONGESTION, "480+620/250,0/250" },
+ { ZT_TONE_CALLWAIT, "440/300,0/10000" },
+ { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
+ { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 1,
+ .country = "au",
+ .description = "Australia",
+ .ringcadence = { 400, 200, 400, 2000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "413+438" },
+ { ZT_TONE_BUSY, "425/375,0/375" },
+ { ZT_TONE_RINGTONE, "413+438/400,0/200,413+438/400,0/2000" },
+ /* XXX Congestion: Should reduce by 10 db every other cadence XXX */
+ { ZT_TONE_CONGESTION, "425/375,0/375,420/375,0/375" },
+ { ZT_TONE_CALLWAIT, "425/100,0/200,425/200,0/4400" },
+ { ZT_TONE_DIALRECALL, "413+428" },
+ { ZT_TONE_RECORDTONE, "!425/1000,!0/15000,425/360,0/15000" },
+ { ZT_TONE_INFO, "425/2500,0/500" },
+ { ZT_TONE_STUTTER, "413+438/100,0/40" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 2,
+ .country = "fr",
+ .description = "France",
+ .ringcadence = { 1500, 3500 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ /* Dialtone can also be 440+330 */
+ { ZT_TONE_DIALTONE, "440" },
+ { ZT_TONE_BUSY, "440/500,0/500" },
+ { ZT_TONE_RINGTONE, "440/1500,0/3500" },
+ /* CONGESTION - not specified */
+ { ZT_TONE_CONGESTION, "440/250,0/250" },
+ { ZT_TONE_CALLWAIT, "440/300,0/10000" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
+ { ZT_TONE_STUTTER, "!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,!440/100,!0/100,440" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 3,
+ .country = "nl",
+ .description = "Netherlands",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ /* Most of these 425's can also be 450's */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/250,0/250" },
+ { ZT_TONE_CALLWAIT, "425/500,0/9500" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "425/500,0/50" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 4,
+ .country = "uk",
+ .description = "United Kingdom",
+ .ringcadence = { 400, 200, 400, 2000 },
+ .tones = {
+ /* From British Telecom SIN350 v1.2 */
+ { ZT_TONE_DIALTONE, "350+440" },
+ { ZT_TONE_BUSY, "400/375,0/375" },
+ { ZT_TONE_RINGTONE, "400+450/400,0/200,400+450/400,0/2000" },
+ { ZT_TONE_CONGESTION, "400/400,0/350,400/225,0/525" },
+ { ZT_TONE_CALLWAIT, "400/100,0/4000" },
+ { ZT_TONE_DIALRECALL, "350+440" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/60000" },
+ { ZT_TONE_INFO, "950/330,0/15,1400/330,0/15,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "350+440/750,440/750" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 5,
+ .country = "fi",
+ .description = "Finland",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/300,0/300" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/8000" },
+ { ZT_TONE_DIALRECALL, "425/650,0/25" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "950/650,0/325,950/325,0/30,1400/1300,0/2600" },
+ { ZT_TONE_STUTTER, "425/650,0/25" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 6,
+ .country = "es",
+ .description = "Spain",
+ .ringcadence = { 1500, 3000},
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/200,0/200" },
+ { ZT_TONE_RINGTONE, "425/1500,0/3000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200,425/200,0/200,425/200,0/600" },
+ { ZT_TONE_CALLWAIT, "425/175,0/175,425/175,0/3500" },
+ { ZT_TONE_DIALRECALL, "!425/200,!0/200,!425/200,!0/200,!425/200,!0/200,425" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "950/330,0/1000" },
+ { ZT_TONE_STUTTER, "425/500,0/50" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 7,
+ .country = "jp",
+ .description = "Japan",
+ .ringcadence = { 1000, 2000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "400" },
+ { ZT_TONE_BUSY, "400/500,0/500" },
+ { ZT_TONE_RINGTONE, "400+15/1000,0/2000" },
+ { ZT_TONE_CONGESTION, "400/500,0/500" },
+ { ZT_TONE_CALLWAIT, "400+16/500,0/8000" },
+ { ZT_TONE_DIALRECALL, "!400/200,!0/200,!400/200,!0/200,!400/200,!0/200,400" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
+ { ZT_TONE_STUTTER, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 8,
+ .country = "no",
+ .description = "Norway",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "425/200,0/600,425/200,0/10000" },
+ { ZT_TONE_DIALRECALL, "470/400,425/400" },
+ { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
+ { ZT_TONE_STUTTER, "470/400,425/400" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 9,
+ .country = "at",
+ .description = "Austria",
+ .ringcadence = { 1000, 5000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "420" },
+ { ZT_TONE_BUSY, "420/400,0/400" },
+ { ZT_TONE_RINGTONE, "420/1000,0/5000" },
+ { ZT_TONE_CONGESTION, "420/200,0/200" },
+ { ZT_TONE_CALLWAIT, "420/40,0/1960" },
+ { ZT_TONE_DIALRECALL, "420" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/80,0/14920" },
+ { ZT_TONE_INFO, "950/330,1450/330,1850/330,0/1000" },
+ { ZT_TONE_STUTTER, "380+420" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 10,
+ .country = "nz",
+ .description = "New Zealand",
+ .ringcadence = { 400, 200, 400, 2000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "400" },
+ { ZT_TONE_BUSY, "400/500,0/500" },
+ { ZT_TONE_RINGTONE, "400+450/400,0/200,400+450/400,0/2000" },
+ { ZT_TONE_CONGESTION, "400/250,0/250" },
+ { ZT_TONE_CALLWAIT, "400/250,0/250,400/250,0/3250" },
+ { ZT_TONE_DIALRECALL, "!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400" },
+ { ZT_TONE_RECORDTONE, "1400/425,0/15000" },
+ { ZT_TONE_INFO, "400/750,0/100,400/750,0/100,400/750,0/100,400/750,0/400" },
+ { ZT_TONE_STUTTER, "!400/100!0/100,!400/100,!0/100,!400/100,!0/100,!400/100!0/100,!400/100,!0/100,!400/100,!0/100,400" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 11,
+ .country = "it",
+ .description = "Italy",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425/200,0/200,425/600,0/1000" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "425/400,0/100,425/250,0/100,425/150,0/14000" },
+ { ZT_TONE_DIALRECALL, "470/400,425/400" },
+ { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
+ { ZT_TONE_STUTTER, "470/400,425/400" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 12,
+ .country = "us-old",
+ .description = "United States Circa 1950 / North America",
+ .ringcadence = { 2000, 4000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "600*120" },
+ { ZT_TONE_BUSY, "500*100/500,0/500" },
+ { ZT_TONE_RINGTONE, "420*40/2000,0/4000" },
+ { ZT_TONE_CONGESTION, "500*100/250,0/250" },
+ { ZT_TONE_CALLWAIT, "440/300,0/10000" },
+ { ZT_TONE_DIALRECALL, "!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
+ { ZT_TONE_STUTTER, "!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,!600*120/100,!0/100,600*120" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 13,
+ .country = "gr",
+ .description = "Greece",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425/200,0/300,425/700,0/800" },
+ { ZT_TONE_BUSY, "425/300,0/300" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/8000" },
+ { ZT_TONE_DIALRECALL, "425/650,0/25" },
+ { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
+ { ZT_TONE_STUTTER, "425/650,0/25" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 14,
+ .country = "tw",
+ .description = "Taiwan",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "350+440" },
+ { ZT_TONE_BUSY, "480+620/500,0/500" },
+ { ZT_TONE_RINGTONE, "440+480/1000,0/2000" },
+ { ZT_TONE_CONGESTION, "480+620/250,0/250" },
+ { ZT_TONE_CALLWAIT, "350+440/250,0/250,350+440/250,0/3250" },
+ { ZT_TONE_DIALRECALL, "300/1500,0/500" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
+ { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 15,
+ .country = "cl",
+ .description = "Chile",
+ .ringcadence = { 1000, 3000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "400" },
+ { ZT_TONE_BUSY, "400/500,0/500" },
+ { ZT_TONE_RINGTONE, "400/1000,0/3000" },
+ { ZT_TONE_CONGESTION, "400/200,0/200" },
+ { ZT_TONE_CALLWAIT, "400/250,0/8750" },
+ { ZT_TONE_DIALRECALL, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/333,!1400/333,!1800/333,0" },
+ { ZT_TONE_STUTTER, "!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,!400/100,!0/100,400" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 16,
+ .country = "se",
+ .description = "Sweden",
+ .ringcadence = { 1000, 5000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/250,0/250" },
+ { ZT_TONE_RINGTONE, "425/1000,0/5000" },
+ { ZT_TONE_CONGESTION, "425/250,0/750" },
+ { ZT_TONE_CALLWAIT, "425/200,0/500,425/200,0/9100" },
+ { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,"
+ "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,"
+ "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,"
+ "!950/332,!0/24,!1400/332,!0/24,!1800/332,!0/2024,"
+ "!950/332,!0/24,!1400/332,!0/24,!1800/332,0" },
+ /*{ ZT_TONE_STUTTER, "425/320,0/20" }, Real swedish standard, not used for now */
+ { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 17,
+ .country = "be",
+ .description = "Belgium",
+ .ringcadence = { 1000, 3000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/3000" },
+ { ZT_TONE_CONGESTION, "425/167,0/167" },
+ { ZT_TONE_CALLWAIT, "1400/175,0/175,1400/175,0/3500" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "900/330,1400/330,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "425/1000,0/250" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 18,
+ .country = "sg",
+ .description = "Singapore",
+ .ringcadence = { 400, 200, 400, 2000 },
+ .tones = {
+ /* Reference: http://www.ida.gov.sg/idaweb/doc/download/I397/ida_ts_pstn1_i4r2.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/750,0/750" },
+ { ZT_TONE_RINGTONE, "425*24/400,0/200,425*24/400,0/2000" },
+ { ZT_TONE_CONGESTION, "425/250,0/250" },
+ { ZT_TONE_CALLWAIT, "425*24/300,0/200,425*24/300,0/3200" },
+ /* DIALRECALL - not specified - use repeating Holding Tone A,B*/
+ { ZT_TONE_DIALRECALL, "425*24/500,0/500,425/500,0/2500" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,!425/200,!0/200,!425/600,!0/200,425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 19,
+ .country = "il",
+ .description = "Israel",
+ .ringcadence = { 1000, 3000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "414" },
+ { ZT_TONE_BUSY, "414/500,0/500" },
+ { ZT_TONE_RINGTONE, "414/1000,0/3000" },
+ { ZT_TONE_CONGESTION, "414/250,0/250" },
+ { ZT_TONE_CALLWAIT, "414/100,0/100,414/100,0/100,414/600,0/3000" },
+ { ZT_TONE_DIALRECALL, "!414/100,!0/100,!414/100,!0/100,!414/100,!0/100,414" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "1000/330,1400/330,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,!414/160,!0/160,414" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 20,
+ .country = "br",
+ .description = "Brazil",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/250,0/250" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/250,0/250,425/750,0/250" },
+ { ZT_TONE_CALLWAIT, "425/50,0/1000" },
+ { ZT_TONE_DIALRECALL, "350+440" },
+ { ZT_TONE_RECORDTONE, "425/250,0/250" },
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330" },
+ { ZT_TONE_STUTTER, "350+440" } },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -12,
+ .mf_level = -10,
+ },
+ { .zone = 21,
+ .country = "hu",
+ .description = "Hungary",
+ .ringcadence = { 1250, 3750 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/300,0/300" },
+ { ZT_TONE_RINGTONE, "425/1250,0/3750" },
+ { ZT_TONE_CONGESTION, "425/300,0/300" },
+ { ZT_TONE_CALLWAIT, "425/40,0/1960" },
+ { ZT_TONE_DIALRECALL, "425+450" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
+ { ZT_TONE_STUTTER, "350+375+400" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 22,
+ .country = "lt",
+ .description = "Lithuania",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/350,0/350" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
+ /* STUTTER not specified */
+ { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 23,
+ .country = "pl",
+ .description = "Poland",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/500,0/500" },
+ { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,0" },
+ /* STUTTER not specified */
+ { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 24,
+ .country = "za",
+ .description = "South Africa",
+ .ringcadence = { 400, 200, 400, 2000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "400*33" },
+ { ZT_TONE_BUSY, "400/500,0/500" },
+ { ZT_TONE_RINGTONE, "400*33/400,0/200,400*33/400,0/2000" },
+ { ZT_TONE_CONGESTION, "400/250,0/250" },
+ { ZT_TONE_CALLWAIT, "400*33/250,0/250,400*33/250,0/250,400*33/250,0/250,400*33/250,0/250" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "350+440" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,!950/330,!1400/330,!1800/330,!0/1000,0" },
+ /* STUTTER not specified */
+ { ZT_TONE_STUTTER, "!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,!400*33/100,!0/100,400*33" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 25,
+ .country = "pt",
+ .description = "Portugal",
+ .ringcadence = { 1000, 5000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/5000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "425/200,425/200,425/200,0/5000" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "425/1000,0/200" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
+ /* STUTTER not specified */
+ { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 26,
+ .country = "ee",
+ .description = "Estonia",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/300,0/300" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "950/650,0/325,950/325,0/30,1400/1300,0/2600" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "425/650,0/25" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "950/0,0/325,950/325,0/30,1400/1300,0/2600" },
+ /* STUTTER not specified */
+ { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 27,
+ .country = "mx",
+ .description = "Mexico",
+ .ringcadence = { 2000, 4000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/250,0/250" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/250,0/250" },
+ { ZT_TONE_CALLWAIT, "425/200,0/600,425/200,0/10000" },
+ { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "950/330,0/30,1400/330,0/30,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 28,
+ .country = "in",
+ .description = "India",
+ .ringcadence = { 400, 200, 400, 2000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "400*25" },
+ { ZT_TONE_BUSY, "400/750,0/750" },
+ { ZT_TONE_RINGTONE, "400*25/400,0/200,400*25/400,0/2000" },
+ { ZT_TONE_CONGESTION, "400/250,0/250" },
+ { ZT_TONE_CALLWAIT, "400/200,0/100,400/200,0/7500" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ /* INFO - not specified */
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0/1000" },
+ /* STUTTER - not specified */
+ { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 29,
+ .country = "de",
+ .description = "Germany",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/480,0/480" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/240,0/240" },
+ { ZT_TONE_CALLWAIT, "!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,!0/5000,!425/200,!0/200,!425/200,0" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/80,0/15000" },
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "425+400" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 30,
+ .country = "ch",
+ .description = "Switzerland",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "425/200,0/200,425/200,0/4000" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/80,0/15000" },
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "425+340/1100,0/1100" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 31,
+ .country = "dk",
+ .description = "Denmark",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/200,0/200" },
+ { ZT_TONE_CALLWAIT, "!425/200,!0/600,!425/200,!0/3000,!425/200,!0/200,!425/200,0" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/80,0/15000" },
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
+ /* STUTTER - not specified */
+ { ZT_TONE_STUTTER, "425/450,0/50" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 32,
+ .country = "cz",
+ .description = "Czech Republic",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425/330,0/330,425/660,0/660" },
+ { ZT_TONE_BUSY, "425/330,0/330" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/165,0/165" },
+ { ZT_TONE_CALLWAIT, "425/330,0/9000" },
+ /* DIALRECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/14000" },
+ { ZT_TONE_INFO, "950/330,0/30,1400/330,0/30,1800/330,0/1000" },
+ /* STUTTER - not specified */
+ { ZT_TONE_STUTTER, "425/450,0/50" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 33,
+ .country = "cn",
+ .description = "China",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "450" },
+ { ZT_TONE_BUSY, "450/350,0/350" },
+ { ZT_TONE_RINGTONE, "450/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "450/700,0/700" },
+ { ZT_TONE_CALLWAIT, "450/400,0/4000" },
+ { ZT_TONE_DIALRECALL, "450" },
+ { ZT_TONE_RECORDTONE, "950/400,0/10000" },
+ { ZT_TONE_INFO, "450/100,0/100,450/100,0/100,450/100,0/100,450/400,0/400" },
+ /* STUTTER - not specified */
+ { ZT_TONE_STUTTER, "450+425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 34,
+ .country = "ar",
+ .description = "Argentina",
+ .ringcadence = { 1000, 4500 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/300,0/300" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4500" },
+ { ZT_TONE_CONGESTION, "425/200,0/300" },
+ { ZT_TONE_CALLWAIT, "425/200,0/9000" },
+ { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425/330,0/330,425/660,0/660" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/14000" },
+ { ZT_TONE_INFO, "425/100,0/100" },
+ { ZT_TONE_STUTTER, "425/450,0/50" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 35,
+ .country = "my",
+ .description = "Malaysia",
+ .ringcadence = { 400, 200, 400, 2000 },
+ .tones = {
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/400,0/200,425/400,0/2000" },
+ { ZT_TONE_CONGESTION, "425/500,0/500" },
+ { ZT_TONE_CALLWAIT, "425/100,0/4000" },
+ { ZT_TONE_DIALRECALL, "350+440" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/60000" },
+ { ZT_TONE_INFO, "950/330,0/15,1400/330,0/15,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "450+425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 36,
+ .country = "th",
+ .description = "Thailand",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "400*50" },
+ { ZT_TONE_BUSY, "400/500,0/500" },
+ { ZT_TONE_RINGTONE, "400/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "400/300,0/300" },
+ { ZT_TONE_CALLWAIT, "1000/400,10000/400,1000/400" },
+ /* DIALRECALL - not specified - use special dial tone instead. */
+ { ZT_TONE_DIALRECALL, "400*50/400,0/100,400*50/400,0/100" },
+ /* RECORDTONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ /* INFO - specified as an announcement - use tones instead. */
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330" },
+ /* STUTTER - not specified */
+ { ZT_TONE_STUTTER, "!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,!400/200,!0/200,!400/600,!0/200,400" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 37,
+ .country = "bg",
+ .description = "Bulgaria",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/250,0/250" },
+ { ZT_TONE_CALLWAIT, "425/150,0/150,425/150,0/4000" },
+ { ZT_TONE_DIALRECALL, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ { ZT_TONE_RECORDTONE, "1400/425,0/15000" },
+ { ZT_TONE_INFO, "950/330,1400/330,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "425/1500,0/100" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = 38,
+ .country = "ve",
+ .description = "Venezuela",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/500,0/500" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/250,0/250" },
+ { ZT_TONE_CALLWAIT, "400+450/300,0/6000" },
+ { ZT_TONE_DIALRECALL, "425" },
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ { ZT_TONE_INFO, "!950/330,!1440/330,!1800/330,0/1000" },
+ /* STUTTER - not specified */
+ { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
},
- { 39, "ph", "Philippines", { 1000, 4000 },
- {
- /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "480+620/500,0/500" },
- { ZT_TONE_RINGTONE, "425+480/1000,0/4000" },
- { ZT_TONE_CONGESTION, "480+620/250,0/250" },
- { ZT_TONE_CALLWAIT, "440/300,0/10000" },
- /* DIAL RECALL - not specified */
- { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- /* RECORD TONE - not specified */
- { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
- /* INFO TONE - not specified */
- { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
- /* STUTTER TONE - not specified */
- { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
- },
+ { .zone = 39,
+ .country = "ph",
+ .description = "Philippines",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* Reference: http://www.itu.int/ITU-T/inr/forms/files/tones-0203.pdf */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "480+620/500,0/500" },
+ { ZT_TONE_RINGTONE, "425+480/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "480+620/250,0/250" },
+ { ZT_TONE_CALLWAIT, "440/300,0/10000" },
+ /* DIAL RECALL - not specified */
+ { ZT_TONE_DIALRECALL, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ /* RECORD TONE - not specified */
+ { ZT_TONE_RECORDTONE, "1400/500,0/15000" },
+ /* INFO TONE - not specified */
+ { ZT_TONE_INFO, "!950/330,!1400/330,!1800/330,0" },
+ /* STUTTER TONE - not specified */
+ { ZT_TONE_STUTTER, "!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
},
- { 40, "ru", "Russian Federation", { 1000, 4000 },
- {
- /* References:
- http://www.minsvyaz.ru/site.shtml?id=1806
- http://www.aboutphone.info/lib/gost/45-223-2001.html */
- { ZT_TONE_DIALTONE, "425" },
- { ZT_TONE_BUSY, "425/350,0/350" },
- { ZT_TONE_RINGTONE, "425/1000,0/4000" },
- { ZT_TONE_CONGESTION, "425/175,0/175" },
- { ZT_TONE_CALLWAIT, "425/200,0/5000" },
- { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
- { ZT_TONE_INFO, "950/330,1440/330,1800/330,0/1000" },
- { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
- },
- },
- { -1 }
+ { .zone = 40,
+ .country = "ru",
+ .description = "Russian Federation",
+ .ringcadence = { 1000, 4000 },
+ .tones = {
+ /* References:
+ http://www.minsvyaz.ru/site.shtml?id=1806
+ http://www.aboutphone.info/lib/gost/45-223-2001.html */
+ { ZT_TONE_DIALTONE, "425" },
+ { ZT_TONE_BUSY, "425/350,0/350" },
+ { ZT_TONE_RINGTONE, "425/1000,0/4000" },
+ { ZT_TONE_CONGESTION, "425/175,0/175" },
+ { ZT_TONE_CALLWAIT, "425/200,0/5000" },
+ { ZT_TONE_RECORDTONE, "1400/400,0/15000" },
+ { ZT_TONE_INFO, "950/330,1440/330,1800/330,0/1000" },
+ { ZT_TONE_STUTTER, "!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,!425/100,!0/100,425" },
+ },
+ .dtmf_high_level = -10,
+ .dtmf_low_level = -10,
+ .mf_level = -10,
+ },
+ { .zone = -1 }
};