From 5de5efa71b183106b059157e4024d1e7bb434857 Mon Sep 17 00:00:00 2001 From: markster Date: Thu, 30 Oct 2003 23:17:02 +0000 Subject: Add DACS functionality to zaptel for cross connecting channels git-svn-id: http://svn.digium.com/svn/zaptel/trunk@262 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- ztcfg.c | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'ztcfg.c') diff --git a/ztcfg.c b/ztcfg.c index 583c4ce..3b100e7 100755 --- a/ztcfg.c +++ b/ztcfg.c @@ -355,17 +355,32 @@ int parse_idle(int *i, char *s) return -1; } +static int parse_channel(char *channel, int *startchan) +{ + if (!channel || (sscanf(channel, "%i", startchan) != 1) || + (*startchan < 1)) { + error("DACS requires a starting channel in the form ':x' where x is the channel\n"); + return -1; + } + return 0; +} + static int chanconfig(char *keyword, char *args) { int chans[ZT_MAX_CHANNELS]; - int res; + int res = 0; int x; int master=0; + int dacschan = 0; char *idle; bzero(chans, sizeof(chans)); strtok(args, ":"); idle = strtok(NULL, ":"); - res = apply_channels(chans, args); + if (!strcasecmp(keyword, "dacs")) { + res = parse_channel(idle, &dacschan); + } + if (!res) + res = apply_channels(chans, args); if (res <= 0) return -1; for (x=1;x