From 85d82e003f9dd3cfbc8733a537746750dbd0e5e0 Mon Sep 17 00:00:00 2001 From: markster Date: Wed, 19 Jun 2002 18:53:18 +0000 Subject: Version 0.2.0 from FTP git-svn-id: http://svn.digium.com/svn/zaptel/trunk@85 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- ztcfg.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'ztcfg.c') diff --git a/ztcfg.c b/ztcfg.c index 360654e..bc37ac8 100755 --- a/ztcfg.c +++ b/ztcfg.c @@ -332,13 +332,39 @@ int apply_channels(int chans[], char *argstr) return res; } +int parse_idle(int *i, char *s) +{ + char a,b,c,d; + if (s) { + if (sscanf(s, "%c%c%c%c", &a,&b,&c,&d) == 4) { + if (((a == '0') || (a == '1')) && ((b == '0') || (b == '1')) && ((c == '0') || (c == '1')) && ((d == '0') || (d == '1'))) { + *i = 0; + if (a == '1') + *i |= ZT_ABIT; + if (b == '1') + *i |= ZT_BBIT; + if (c == '1') + *i |= ZT_CBIT; + if (d == '1') + *i |= ZT_DBIT; + return 0; + } + } + } + error("CAS Signalling requires idle definition in the form ':xxxx' at the end of the channel definition, where xxxx represent the a, b, c, and d bits\n"); + return -1; +} + static int chanconfig(char *keyword, char *args) { int chans[ZT_MAX_CHANNELS]; int res; int x; int master=0; + char *idle; bzero(chans, sizeof(chans)); + strtok(args, ":"); + idle = strtok(NULL, ":"); res = apply_channels(chans, args); if (res <= 0) return -1; @@ -372,6 +398,11 @@ static int chanconfig(char *keyword, char *args) } else if (!strcasecmp(keyword, "fxoks")) { sig[x] = "FXO Kewlstart"; cc[x].sigtype = ZT_SIG_FXOKS; + } else if (!strcasecmp(keyword, "cas") || !strcasecmp(keyword, "user")) { + if (parse_idle(&cc[x].idlebits, idle)) + return -1; + sig[x] = "CAS / User"; + cc[x].sigtype = ZT_SIG_CAS; } else if (!strcasecmp(keyword, "unused")) { sig[x] = "Unused"; cc[x].sigtype = 0; @@ -539,6 +570,8 @@ static struct handler { { "indclear", chanconfig }, { "clear", chanconfig }, { "unused", chanconfig }, + { "cas", chanconfig }, + { "user", chanconfig }, { "alaw", setlaw }, { "mulaw", setlaw }, { "deflaw", setlaw }, -- cgit v1.2.3