summaryrefslogtreecommitdiff
path: root/dahdi_cfg.c
diff options
context:
space:
mode:
authorMatthew Fredrickson <creslin@digium.com>2008-08-24 05:54:11 +0000
committerMatthew Fredrickson <creslin@digium.com>2008-08-24 05:54:11 +0000
commit4c29c0da523afa8ee35c153937daf7fe4ebcd5c6 (patch)
tree447099477b5c6791d055d5423da1632f70f16c2f /dahdi_cfg.c
parent4eb7c55b89987c494b2113f6da8653db77ef26b8 (diff)
Add support for 56 KB HDLC as well as selectable rate in system.conf
git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@4818 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'dahdi_cfg.c')
-rw-r--r--dahdi_cfg.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/dahdi_cfg.c b/dahdi_cfg.c
index 2c57d1b..1bc1499 100644
--- a/dahdi_cfg.c
+++ b/dahdi_cfg.c
@@ -86,6 +86,8 @@ static const char *sig[DAHDI_MAX_CHANNELS]; /* Signalling */
static int slineno[DAHDI_MAX_CHANNELS]; /* Line number where signalling specified */
+static int fiftysixkhdlc[DAHDI_MAX_CHANNELS];
+
static int spans=0;
static int fo_real = 1;
@@ -646,6 +648,49 @@ static int setlaw(char *keyword, char *args)
return 0;
}
+static int setfiftysixkhdlc(char *keyword, char *args)
+{
+ int res;
+
+ res = apply_channels(fiftysixkhdlc, args);
+ if (res <= 0)
+ return -1;
+
+ return 0;
+}
+
+static void apply_fiftysix(void)
+{
+ int x;
+ int rate;
+ int chanfd;
+
+ for (x = 1; x < DAHDI_MAX_CHANNELS; x++) {
+ chanfd = open("/dev/dahdi/channel", O_RDWR);
+ if (chanfd == -1) {
+ fprintf(stderr, "Couldn't open /dev/zap/channel\n");
+ exit(-1);
+ }
+
+ if (ioctl(chanfd, DAHDI_SPECIFY, &x)) {
+ continue;
+ }
+
+ if (fiftysixkhdlc[x]) {
+ printf("Setting channel %d to 56K mode (only valid on HDLC channels)\n", x);
+ rate = 56;
+ } else {
+ rate = 64;
+ }
+
+ if (ioctl(chanfd, DAHDI_HDLC_RATE, &rate)) {
+ fprintf(stderr, "Error setting HDLC rate\n");
+ exit(-1);
+ }
+ close(chanfd);
+ }
+}
+
static int setechocan(char *keyword, char *args)
{
int res;
@@ -1310,6 +1355,7 @@ static struct handler {
{ "channel", rad_chanconfig },
{ "channels", rad_chanconfig },
{ "echocanceller", setechocan },
+ { "56k", setfiftysixkhdlc },
};
static char *readline()
@@ -1586,5 +1632,6 @@ finish:
fprintf(stderr, "\n%d error(s) detected\n\n", errcnt);
exit(1);
}
+ apply_fiftysix();
exit(0);
}