From 7035b963402a64116a509df9e90d94740ed4fccd Mon Sep 17 00:00:00 2001 From: kpfleming Date: Sat, 17 Dec 2005 02:52:18 +0000 Subject: allow userspace apps to extract version/echo canceller info add version/echo canceller info to ztcfg verbose output git-svn-id: http://svn.digium.com/svn/zaptel/trunk@872 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- ztcfg.c | 222 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 112 insertions(+), 110 deletions(-) (limited to 'ztcfg.c') diff --git a/ztcfg.c b/ztcfg.c index e5d0234..1c00231 100644 --- a/ztcfg.c +++ b/ztcfg.c @@ -1019,13 +1019,20 @@ static int rad_chanconfig(char *keyword, char *args) /* End Radio functions */ -static void printconfig() +static void printconfig(int fd) { int x,y; int ps; int configs=0; - printf("\nZaptel Configuration\n" - "======================\n\n"); + struct zt_versioninfo vi; + + if (ioctl(fd, ZT_GETVERSION, &vi)) + error("Unable to read Zaptel version information.\n"); + + printf("\nZaptel Version: %s\n" + "Echo Canceller: %s\n" + "Configuration\n" + "======================\n\n", vi.version, vi.echo_canceller); for (x=0;x> 16; + + if (cc[x].sigtype != current_state.sigtype) { + needupdate++; + if (verbose > 1) + printf("Changing signalling on channel %d from %s to %s\n", + cc[x].chan, sigtype_to_str(current_state.sigtype), + sigtype_to_str(cc[x].sigtype)); } - if (!cc[x].sigtype) - continue; - - if (!needupdate) { - memset(¤t_state, 0, sizeof(current_state)); - current_state.channo = cc[x].chan | ZT_GET_PARAMS_RETURN_MASTER; - if (ioctl(fd, ZT_GET_PARAMS, ¤t_state)) - needupdate = 1; + + if ((cc[x].deflaw != ZT_LAW_DEFAULT) && (cc[x].deflaw != current_state.curlaw)) { + needupdate++; + if (verbose > 1) + printf("Changing law on channel %d from %s to %s\n", + cc[x].chan, laws[current_state.curlaw], + laws[cc[x].deflaw]); } - - if (!needupdate) { - master = current_state.channo >> 16; - - if (cc[x].sigtype != current_state.sigtype) { - needupdate++; - if (verbose > 1) - printf("Changing signalling on channel %d from %s to %s\n", - cc[x].chan, sigtype_to_str(current_state.sigtype), - sigtype_to_str(cc[x].sigtype)); - } - - if ((cc[x].deflaw != ZT_LAW_DEFAULT) && (cc[x].deflaw != current_state.curlaw)) { - needupdate++; - if (verbose > 1) - printf("Changing law on channel %d from %s to %s\n", - cc[x].chan, laws[current_state.curlaw], - laws[cc[x].deflaw]); - } - - if (cc[x].master != master) { - needupdate++; - if (verbose > 1) - printf("Changing master of channel %d from %d to %d\n", - cc[x].chan, master, - cc[x].master); - } - - if (cc[x].idlebits != current_state.idlebits) { - needupdate++; - if (verbose > 1) - printf("Changing idle bits of channel %d from %d to %d\n", - cc[x].chan, current_state.idlebits, - cc[x].idlebits); - } + + if (cc[x].master != master) { + needupdate++; + if (verbose > 1) + printf("Changing master of channel %d from %d to %d\n", + cc[x].chan, master, + cc[x].master); } - - if (needupdate && ioctl(fd, ZT_CHANCONFIG, &cc[x])) { - fprintf(stderr, "ZT_CHANCONFIG failed on channel %d: %s (%d)\n", x, strerror(errno), errno); - if (errno == EINVAL) { - fprintf(stderr, "Did you forget that FXS interfaces are configured with FXO signalling\n" - "and that FXO interfaces use FXS signalling?\n"); - } - close(fd); - exit(1); + + if (cc[x].idlebits != current_state.idlebits) { + needupdate++; + if (verbose > 1) + printf("Changing idle bits of channel %d from %d to %d\n", + cc[x].chan, current_state.idlebits, + cc[x].idlebits); } } - for (x=0;x -1) { - if (ioctl(fd, ZT_DEFAULTZONE, &deftonezone)) { - fprintf(stderr, "ZT_DEFAULTZONE failed: %s (%d)\n", strerror(errno), errno); - close(fd); - exit(1); - } + if (tone_zone_register(fd, zonestoload[x])) + error("Unable to register tone zone '%s'\n", zonestoload[x]); + } + if (debug & DEBUG_APPLY) { + printf("Doing startup\n"); + fflush(stdout); + } + if (deftonezone > -1) { + if (ioctl(fd, ZT_DEFAULTZONE, &deftonezone)) { + fprintf(stderr, "ZT_DEFAULTZONE failed: %s (%d)\n", strerror(errno), errno); + close(fd); + exit(1); } - for (x=0;x