blob: 8f6bddae3f24f044a7bed64d0bb7cd934f0d9725 [file] [log] [blame]
Matthew Fredricksond105e202010-02-16 22:07:04 +01001/* OpenBSC Abis input driver for DAHDI */
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +01002
Harald Welteba0db5b2011-02-04 21:33:14 +01003/* (C) 2008-2011 by Harald Welte <laforge@gnumonks.org>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +01004 * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
Matthew Fredricksond105e202010-02-16 22:07:04 +01005 * (C) 2010 by Digium and Matthew Fredrickson <creslin@digium.com>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +01006 *
7 * All Rights Reserved
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 *
23 */
24
25#include <stdio.h>
26#include <unistd.h>
27#include <stdlib.h>
28#include <errno.h>
29#include <string.h>
30#include <time.h>
31#include <sys/fcntl.h>
32#include <sys/types.h>
33#include <sys/socket.h>
34#include <sys/ioctl.h>
35#include <arpa/inet.h>
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -050036#include <dahdi/user.h>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010037
Harald Welte1dd68c32011-02-05 13:58:46 +010038#include <osmocore/select.h>
39#include <osmocore/msgb.h>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010040#include <openbsc/debug.h>
41#include <openbsc/gsm_data.h>
42#include <openbsc/abis_nm.h>
43#include <openbsc/abis_rsl.h>
44#include <openbsc/subchan_demux.h>
45#include <openbsc/e1_input.h>
Harald Welte1dd68c32011-02-05 13:58:46 +010046#include <osmocore/talloc.h>
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010047
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010048#include "lapd.h"
49
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010050#define TS1_ALLOC_SIZE 300
51
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010052static int handle_ts1_read(struct bsc_fd *bfd)
53{
54 struct e1inp_line *line = bfd->data;
55 unsigned int ts_nr = bfd->priv_nr;
56 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
57 struct e1inp_sign_link *link;
Matthew Fredricksonbc6649e2010-02-16 22:01:36 +010058 struct msgb *msg = msgb_alloc(TS1_ALLOC_SIZE, "DAHDI TS1");
Harald Welteba0db5b2011-02-04 21:33:14 +010059 lapd_mph_type prim;
60 unsigned int sapi, tei;
61 int ilen, ret;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010062
63 if (!msg)
64 return -ENOMEM;
65
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -050066 ret = read(bfd->fd, msg->data, TS1_ALLOC_SIZE - 16);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010067 if (ret < 0) {
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010068 perror("read ");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010069 }
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -050070 msgb_put(msg, ret - 2);
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010071 if (ret <= 3) {
72 perror("read ");
73 }
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010074
Harald Welteba0db5b2011-02-04 21:33:14 +010075 sapi = msg->data[0] >> 2;
76 tei = msg->data[1] >> 1;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -050077
Harald Welteba0db5b2011-02-04 21:33:14 +010078 DEBUGP(DMI, "<= len = %d, sapi(%d) tei(%d)", ret, sapi, tei);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +010079
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010080 uint8_t *idata = lapd_receive(msg->data, msg->len, &ilen, &prim, bfd);
81
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010082 msgb_pull(msg, 2);
83
Harald Welteba0db5b2011-02-04 21:33:14 +010084 DEBUGP(DMI, "prim %08x\n", prim);
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010085
Harald Welteba0db5b2011-02-04 21:33:14 +010086 switch (prim) {
87 case 0:
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010088 break;
Harald Welteba0db5b2011-02-04 21:33:14 +010089 case LAPD_MPH_ACTIVATE_IND:
90 DEBUGP(DMI, "MPH_ACTIVATE_IND: sapi(%d) tei(%d)\n", sapi, tei);
91 ret = e1inp_event(e1i_ts, EVT_E1_TEI_UP, tei, sapi);
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010092 break;
Harald Welteba0db5b2011-02-04 21:33:14 +010093 case LAPD_MPH_DEACTIVATE_IND:
94 DEBUGP(DMI, "MPH_DEACTIVATE_IND: sapi(%d) tei(%d)\n", sapi, tei);
95 ret = e1inp_event(e1i_ts, EVT_E1_TEI_DN, tei, sapi);
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +010096 break;
Harald Welteba0db5b2011-02-04 21:33:14 +010097 case LAPD_DL_DATA_IND:
98 case LAPD_DL_UNITDATA_IND:
Harald Welte1dd68c32011-02-05 13:58:46 +010099 if (prim == LAPD_DL_DATA_IND)
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500100 msg->l2h = msg->data + 2;
101 else
102 msg->l2h = msg->data + 1;
103 DEBUGP(DMI, "RX: %s\n", hexdump(msgb_l2(msg), ret));
Harald Welteba0db5b2011-02-04 21:33:14 +0100104 ret = e1inp_rx_ts(e1i_ts, msg, tei, sapi);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100105 break;
106 default:
Harald Welteba0db5b2011-02-04 21:33:14 +0100107 printf("ERROR: unknown prim\n");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100108 break;
109 }
Harald Welteba0db5b2011-02-04 21:33:14 +0100110
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500111 DEBUGP(DMI, "Returned ok\n");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100112 return ret;
113}
114
115static int ts_want_write(struct e1inp_ts *e1i_ts)
116{
Harald Welteba0db5b2011-02-04 21:33:14 +0100117 /* We never include the DAHDI B-Channel FD into the
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100118 * writeset, since it doesn't support poll() based
119 * write flow control */
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500120 if (e1i_ts->type == E1INP_TS_TYPE_TRAU) {
121 fprintf(stderr, "Trying to write TRAU ts\n");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100122 return 0;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500123 }
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100124
125 e1i_ts->driver.misdn.fd.when |= BSC_FD_WRITE;
126
127 return 0;
128}
129
130static void timeout_ts1_write(void *data)
131{
132 struct e1inp_ts *e1i_ts = (struct e1inp_ts *)data;
133
134 /* trigger write of ts1, due to tx delay timer */
135 ts_want_write(e1i_ts);
136}
137
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500138static void dahdi_write_msg(uint8_t *data, int len, void *cbdata)
139{
140 struct bsc_fd *bfd = cbdata;
141 int ret;
142
143 ret = write(bfd->fd, data, len + 2);
144
145 if (ret < 0)
146 fprintf(stderr, "%s write failed %d\n", __func__, ret);
147}
148
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100149static int handle_ts1_write(struct bsc_fd *bfd)
150{
151 struct e1inp_line *line = bfd->data;
152 unsigned int ts_nr = bfd->priv_nr;
153 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
154 struct e1inp_sign_link *sign_link;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100155 struct msgb *msg;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100156
157 bfd->when &= ~BSC_FD_WRITE;
158
159 /* get the next msg for this timeslot */
160 msg = e1inp_tx_ts(e1i_ts, &sign_link);
161 if (!msg) {
162 /* no message after tx delay timer */
163 return 0;
164 }
165
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +0100166 lapd_transmit(sign_link->tei, msg->data, msg->len, bfd);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100167 msgb_free(msg);
168
169 /* set tx delay timer for next event */
170 e1i_ts->sign.tx_timer.cb = timeout_ts1_write;
171 e1i_ts->sign.tx_timer.data = e1i_ts;
172 bsc_schedule_timer(&e1i_ts->sign.tx_timer, 0, 50000);
173
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500174 return 0;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100175}
176
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500177
178static int invertbits = 1;
179
180static u_int8_t flip_table[256];
181
182static void init_flip_bits(void)
183{
184 int i,k;
185
186 for (i = 0 ; i < 256 ; i++) {
187 u_int8_t sample = 0 ;
188 for (k = 0; k<8; k++) {
189 if ( i & 1 << k ) sample |= 0x80 >> k;
190 }
191 flip_table[i] = sample;
192 }
193}
194
195static u_int8_t * flip_buf_bits ( u_int8_t * buf , int len)
196{
197 int i;
creslin287cd8b86f2010-03-26 12:57:31 -0500198 u_int8_t * start = buf;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500199
200 for (i = 0 ; i < len; i++) {
201 buf[i] = flip_table[(u_int8_t)buf[i]];
202 }
203
204 return start;
205}
206
creslin287cd8b86f2010-03-26 12:57:31 -0500207#define D_BCHAN_TX_GRAN 160
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100208/* write to a B channel TS */
209static int handle_tsX_write(struct bsc_fd *bfd)
210{
211 struct e1inp_line *line = bfd->data;
212 unsigned int ts_nr = bfd->priv_nr;
213 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500214 u_int8_t tx_buf[D_BCHAN_TX_GRAN];
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100215 struct subch_mux *mx = &e1i_ts->trau.mux;
216 int ret;
217
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500218 ret = subchan_mux_out(mx, tx_buf, D_BCHAN_TX_GRAN);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100219
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500220 if (ret != D_BCHAN_TX_GRAN) {
221 fprintf(stderr, "Huh, got ret of %d\n", ret);
222 if (ret < 0)
223 return ret;
224 }
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100225
226 DEBUGP(DMIB, "BCHAN TX: %s\n",
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500227 hexdump(tx_buf, D_BCHAN_TX_GRAN));
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100228
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500229 if (invertbits) {
230 flip_buf_bits(tx_buf, ret);
231 }
232
233 ret = write(bfd->fd, tx_buf, ret);
234 if (ret < D_BCHAN_TX_GRAN)
Harald Welte1dd68c32011-02-05 13:58:46 +0100235 fprintf(stderr, "send returns %d instead of %d\n", ret,
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500236 D_BCHAN_TX_GRAN);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100237
238 return ret;
239}
240
creslin287cd8b86f2010-03-26 12:57:31 -0500241#define D_TSX_ALLOC_SIZE (D_BCHAN_TX_GRAN)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100242/* FIXME: read from a B channel TS */
243static int handle_tsX_read(struct bsc_fd *bfd)
244{
245 struct e1inp_line *line = bfd->data;
246 unsigned int ts_nr = bfd->priv_nr;
247 struct e1inp_ts *e1i_ts = &line->ts[ts_nr-1];
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500248 struct msgb *msg = msgb_alloc(D_TSX_ALLOC_SIZE, "DAHDI TSx");
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100249 int ret;
250
251 if (!msg)
252 return -ENOMEM;
253
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500254 ret = read(bfd->fd, msg->data, D_TSX_ALLOC_SIZE);
255 if (ret < 0 || ret != D_TSX_ALLOC_SIZE) {
256 fprintf(stderr, "read error %d %s\n", ret, strerror(errno));
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100257 return ret;
258 }
259
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500260 if (invertbits) {
261 flip_buf_bits(msg->data, ret);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100262 }
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500263
264 msgb_put(msg, ret);
265
266 msg->l2h = msg->data;
267 DEBUGP(DMIB, "BCHAN RX: %s\n",
268 hexdump(msgb_l2(msg), ret));
269 ret = e1inp_rx_ts(e1i_ts, msg, 0, 0);
270 /* physical layer indicates that data has been sent,
271 * we thus can send some more data */
creslin287cd8b86f2010-03-26 12:57:31 -0500272 ret = handle_tsX_write(bfd);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100273 msgb_free(msg);
274
275 return ret;
276}
277
278/* callback from select.c in case one of the fd's can be read/written */
279static int dahdi_fd_cb(struct bsc_fd *bfd, unsigned int what)
280{
281 struct e1inp_line *line = bfd->data;
282 unsigned int ts_nr = bfd->priv_nr;
283 unsigned int idx = ts_nr-1;
284 struct e1inp_ts *e1i_ts = &line->ts[idx];
285 int rc = 0;
286
287 switch (e1i_ts->type) {
288 case E1INP_TS_TYPE_SIGN:
289 if (what & BSC_FD_READ)
290 rc = handle_ts1_read(bfd);
291 if (what & BSC_FD_WRITE)
292 rc = handle_ts1_write(bfd);
293 break;
294 case E1INP_TS_TYPE_TRAU:
295 if (what & BSC_FD_READ)
296 rc = handle_tsX_read(bfd);
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500297 if (what & BSC_FD_WRITE)
298 rc = handle_tsX_write(bfd);
Harald Welteba0db5b2011-02-04 21:33:14 +0100299 /* We never include the DAHDI B-Channel FD into the
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100300 * writeset, since it doesn't support poll() based
301 * write flow control */
302 break;
303 default:
304 fprintf(stderr, "unknown E1 TS type %u\n", e1i_ts->type);
305 break;
306 }
307
308 return rc;
309}
310
Harald Welte1dd68c32011-02-05 13:58:46 +0100311static int dahdi_e1_line_update(struct e1inp_line *line);
312
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100313struct e1inp_driver dahdi_driver = {
314 .name = "DAHDI",
315 .want_write = ts_want_write,
Harald Welte1dd68c32011-02-05 13:58:46 +0100316 .line_update = &dahdi_e1_line_update,
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100317};
318
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500319void dahdi_set_bufinfo(int fd, int as_sigchan)
320{
321 struct dahdi_bufferinfo bi;
322 int x = 0;
323
324 if (ioctl(fd, DAHDI_GET_BUFINFO, &bi)) {
325 fprintf(stderr, "Error getting bufinfo\n");
326 exit(-1);
327 }
328
329 if (as_sigchan) {
330 bi.numbufs = 4;
331 bi.bufsize = 512;
332 } else {
creslin287cd8b86f2010-03-26 12:57:31 -0500333 bi.numbufs = 8;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500334 bi.bufsize = D_BCHAN_TX_GRAN;
creslin287cd8b86f2010-03-26 12:57:31 -0500335 bi.txbufpolicy = DAHDI_POLICY_WHEN_FULL;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500336 }
337
338 if (ioctl(fd, DAHDI_SET_BUFINFO, &bi)) {
339 fprintf(stderr, "Error setting bufinfo\n");
340 exit(-1);
341 }
342
343 if (!as_sigchan) {
344 if (ioctl(fd, DAHDI_AUDIOMODE, &x)) {
345 fprintf(stderr, "Error setting bufinfo\n");
346 exit(-1);
347 }
348 }
349
350}
351
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100352static int mi_e1_setup(struct e1inp_line *line, int release_l2)
353{
354 int ts, ret;
355
356 /* TS0 is CRC4, don't need any fd for it */
357 for (ts = 1; ts < NUM_E1_TS; ts++) {
358 unsigned int idx = ts-1;
359 char openstr[128];
360 struct e1inp_ts *e1i_ts = &line->ts[idx];
361 struct bsc_fd *bfd = &e1i_ts->driver.misdn.fd;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100362
363 bfd->data = line;
364 bfd->priv_nr = ts;
365 bfd->cb = dahdi_fd_cb;
366 snprintf(openstr, sizeof(openstr), "/dev/dahdi/%d", ts);
367
368 switch (e1i_ts->type) {
369 case E1INP_TS_TYPE_NONE:
370 continue;
371 break;
372 case E1INP_TS_TYPE_SIGN:
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500373 bfd->fd = open(openstr, O_RDWR | O_NONBLOCK);
374 if (bfd->fd == -1) {
375 fprintf(stderr, "%s could not open %s %s\n",
376 __func__, openstr, strerror(errno));
377 exit(-1);
378 }
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100379 bfd->when = BSC_FD_READ;
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500380 dahdi_set_bufinfo(bfd->fd, 1);
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100381 break;
382 case E1INP_TS_TYPE_TRAU:
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500383 bfd->fd = open(openstr, O_RDWR | O_NONBLOCK);
384 if (bfd->fd == -1) {
385 fprintf(stderr, "%s could not open %s %s\n",
386 __func__, openstr, strerror(errno));
387 exit(-1);
388 }
389 dahdi_set_bufinfo(bfd->fd, 0);
Harald Welteba0db5b2011-02-04 21:33:14 +0100390 /* We never include the DAHDI B-Channel FD into the
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100391 * writeset, since it doesn't support poll() based
392 * write flow control */
creslin287cd8b86f2010-03-26 12:57:31 -0500393 bfd->when = BSC_FD_READ;// | BSC_FD_WRITE;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100394 break;
395 }
396
397 if (bfd->fd < 0) {
398 fprintf(stderr, "%s could not open %s %s\n",
399 __func__, openstr, strerror(errno));
400 return bfd->fd;
401 }
402
403 ret = bsc_register_fd(bfd);
404 if (ret < 0) {
405 fprintf(stderr, "could not register FD: %s\n",
406 strerror(ret));
407 return ret;
408 }
409 }
410
411 return 0;
412}
413
Harald Welte1dd68c32011-02-05 13:58:46 +0100414static int dahdi_e1_line_update(struct e1inp_line *line)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100415{
Matthew Fredricksonb1cb8eb2010-02-17 19:25:39 +0100416 int ret;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100417
418 if (!line->driver) {
419 /* this must be the first update */
Matthew Fredricksonbc6649e2010-02-16 22:01:36 +0100420 line->driver = &dahdi_driver;
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100421 } else {
422 /* this is a subsequent update */
423 /* FIXME: first close all sockets */
424 fprintf(stderr, "incremental line updates not supported yet\n");
425 return 0;
426 }
427
Matthew Fredricksonbc6649e2010-02-16 22:01:36 +0100428 if (line->driver != &dahdi_driver)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100429 return -EINVAL;
430
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500431 init_flip_bits();
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100432
433 ret = mi_e1_setup(line, 1);
434 if (ret)
435 return ret;
436
Matthew Fredricksoncc2bc352010-03-15 12:22:37 -0500437 lapd_transmit_cb = dahdi_write_msg;
438
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100439 return 0;
440}
441
Harald Welte1dd68c32011-02-05 13:58:46 +0100442int e1inp_dahdi_init(void)
Matthew Fredricksonb5ddc182010-02-16 21:55:50 +0100443{
444 /* register the driver with the core */
445 e1inp_driver_register(&dahdi_driver);
446}