summaryrefslogtreecommitdiff
path: root/ztcfg.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-06-19 18:53:18 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2002-06-19 18:53:18 +0000
commit85d82e003f9dd3cfbc8733a537746750dbd0e5e0 (patch)
tree8a8aa2ffbf957fd4a2b6a170c4bab456b0c586d6 /ztcfg.c
parentc63dd8597671fa41afb9fe9a1909ace27c6c447c (diff)
Version 0.2.0 from FTP
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@85 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'ztcfg.c')
-rwxr-xr-xztcfg.c33
1 files changed, 33 insertions, 0 deletions
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 },