From 954abd6c016492772dab9990f66857b969ec03dc Mon Sep 17 00:00:00 2001 From: markster Date: Fri, 7 Dec 2001 19:45:53 +0000 Subject: Version 0.1.4 from FTP git-svn-id: http://svn.digium.com/svn/zaptel/trunk@35 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- ztcfg.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 6 deletions(-) (limited to 'ztcfg.c') diff --git a/ztcfg.c b/ztcfg.c index 7153ce2..5b37dfb 100755 --- a/ztcfg.c +++ b/ztcfg.c @@ -89,6 +89,12 @@ static char *lbostr[] = { "-22.5db (CSU)" }; +static char *laws[] = { + "Default", + "Mu-law", + "A-law" +}; + static int error(char *fmt, ...) { int res; @@ -173,28 +179,49 @@ int spanconfig(char *keyword, char *args) if (!strcasecmp(realargs[3], "d4")) { lc[spans].lineconfig |= ZT_CONFIG_D4; lc[spans].lineconfig &= ~ZT_CONFIG_ESF; + lc[spans].lineconfig &= ~ZT_CONFIG_CCS; } else if (!strcasecmp(realargs[3], "esf")) { lc[spans].lineconfig |= ZT_CONFIG_ESF; lc[spans].lineconfig &= ~ZT_CONFIG_D4; + lc[spans].lineconfig &= ~ZT_CONFIG_CCS; + } else if (!strcasecmp(realargs[3], "ccs")) { + lc[spans].lineconfig |= ZT_CONFIG_CCS; + lc[spans].lineconfig &= ~(ZT_CONFIG_ESF | ZT_CONFIG_D4); + } else if (!strcasecmp(realargs[3], "cas")) { + lc[spans].lineconfig &= ~ZT_CONFIG_CCS; + lc[spans].lineconfig &= ~(ZT_CONFIG_ESF | ZT_CONFIG_D4); } else { - error("Framing must be one of 'd4' or 'esf', not '%s'\n", realargs[3]); + error("Framing(T1)/Signalling(E1) must be one of 'd4', 'esf', 'cas' or 'ccs', not '%s'\n", realargs[3]); return -1; } if (!strcasecmp(realargs[4], "ami")) { - lc[spans].lineconfig &= ~ZT_CONFIG_B8ZS; + lc[spans].lineconfig &= ~(ZT_CONFIG_B8ZS | ZT_CONFIG_HDB3); lc[spans].lineconfig |= ZT_CONFIG_AMI; } else if (!strcasecmp(realargs[4], "b8zs")) { lc[spans].lineconfig |= ZT_CONFIG_B8ZS; - lc[spans].lineconfig &= ~ZT_CONFIG_AMI; + lc[spans].lineconfig &= ~(ZT_CONFIG_AMI | ZT_CONFIG_HDB3); + } else if (!strcasecmp(realargs[4], "hdb3")) { + lc[spans].lineconfig |= ZT_CONFIG_HDB3; + lc[spans].lineconfig &= ~(ZT_CONFIG_AMI | ZT_CONFIG_B8ZS); } else { - error("Coding must be one of 'ami' or 'b8zs', not '%s'\n", realargs[4]); + error("Coding must be one of 'ami', 'b8zs' or 'hdb3', not '%s'\n", realargs[4]); return -1; } if (argc > 5) { if (!strcasecmp(realargs[5], "yellow")) lc[spans].lineconfig |= ZT_CONFIG_NOTOPEN; + else if (!strcasecmp(realargs[5], "crc4")) { + lc[spans].lineconfig |= ZT_CONFIG_CRC4; + } else { + error("Only valid fifth arguments are 'yellow' or 'crc4', not '%s'\n", realargs[5]); + return -1; + } + } + if (argc > 6) { + if (!strcasecmp(realargs[6], "yellow")) + lc[spans].lineconfig |= ZT_CONFIG_NOTOPEN; else { - error("Only valid fourth argument is 'yellow', not '%s'\n", realargs[5]); + error("Only valid sixth argument is 'yellow', not '%s'\n", realargs[6]); return -1; } } @@ -352,6 +379,34 @@ static int chanconfig(char *keyword, char *args) return 0; } +static int setlaw(char *keyword, char *args) +{ + int res; + int law; + int x; + int chans[ZT_MAX_CHANNELS]; + + bzero(chans, sizeof(chans)); + res = apply_channels(chans, args); + if (res <= 0) + return -1; + if (!strcasecmp(keyword, "alaw")) { + law = ZT_LAW_ALAW; + } else if (!strcasecmp(keyword, "mulaw")) { + law = ZT_LAW_MULAW; + } else if (!strcasecmp(keyword, "deflaw")) { + law = ZT_LAW_DEFAULT; + } else { + fprintf(stderr, "Huh??? Don't know about '%s' law\n", keyword); + return -1; + } + for (x=0;x= ZT_TONE_ZONE_MAX) { @@ -398,7 +453,7 @@ static void printconfig() for (x=1;x