@@ -0,0 +1,6400 @@
+--- libpri-1.2.4/Makefile
++++ libpri-1.2.4/Makefile
+@@ -27,6 +27,13 @@
+ # Uncomment if you want libpri to count number of Q921/Q931 sent/received
+ #LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
+
++# Uncomment if you want libpri to always keep layer 2 up
++#LAYER2ALWAYSUP=-DLAYER2ALWAYSUP
++
++# Uncomment if you want libpri to hangup a call to an NT (p2mp) port if one
++# device sends a RELEASE COMPLETE with cause 17
++#FASTBUSYONBUSY=-DFASTBUSYONBUSY
++
+ CC=gcc
+
+ OSARCH=$(shell uname -s)
+@@ -38,7 +45,7 @@
+ DYNAMIC_LIBRARY=libpri.so.1.0
+ STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o
+ DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo
+-CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING) $(LIBPRI_COUNTERS)
++CFLAGS=-Wall -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING) $(LIBPRI_COUNTERS) $(LAYER2ALWAYSUP) $(FASTBUSYONBUSY) -DRELAX_TRB
+ INSTALL_PREFIX=$(DESTDIR)
+ INSTALL_BASE=/usr
+ SOFLAGS = -Wl,-hlibpri.so.1.0
+--- libpri-1.2.4/README
++++ libpri-1.2.4/README
+@@ -1,6 +1,7 @@
+-libpri: An implementation of Primary Rate ISDN
+-
+-Written by Mark Spencer <markster@digium.com>
++libpri: An implementation of Primate Rate ISDN (and BRI ISDN)
++
++Written by Mark Spencer <markster@linux-support.net>
++Modified for BRI support by Klaus-Peter Junghanns <kpj@junghanns.net>
+
+ What is libpri?
+ ===============
+@@ -9,6 +10,7 @@
+ based on the Bellcore specification SR-NWT-002343 for National ISDN. As of
+ May 12, 2001, it has been tested work with NI-2, Nortel DMS-100, and
+ Lucent 5E Custom protocols on switches from Nortel and Lucent.
++The BRI and euroISDN modifications are based on ETS 300 102-1.
+
+ What is the license for libpri?
+ ===============================
+@@ -22,9 +24,8 @@
+ or the GPL of libpri.
+
+ If you wish to use libpri in an application for which the GPL is not
+-appropriate (e.g. a proprietary embedded system), licenses for libpri
+-under more flexible terms can be readily obtained through Digium, Inc.
+-at reasonable cost.
++appropriate (e.g. a proprietary embedded system), then you have to use
++a non-standard compliant version without BRI support.
+
+
+ How do I report bugs or contribute?
+--- libpri-1.2.4/TODO
++++ libpri-1.2.4/TODO
+@@ -2,9 +2,7 @@
+ -- D-Channel Backup
+ -- Test against 4e
+
+-Q.921:
+--- Support unnumbered information frames
+-
+ Q.931:
+--- Locking Shift IE
+--- Implement the 11 missing Q.931 timers
++-- Locking Shift IE (you did that already, didnt you??)
++-- Implement the 10 missing Q.931 timers
++-- more facilities
+--- libpri-1.2.4/libpri.h
++++ libpri-1.2.4/libpri.h
+@@ -5,6 +5,8 @@
+ *
+ * Copyright (C) 2001, Linux Support Services, Inc.
+ * All Rights Reserved.
++ * Copyright (C) 2003-2006 Junghanns.NET GmbH
++ * Klaus-Peter Junghanns <kpj@junghanns.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+@@ -26,8 +28,12 @@
+ #define _LIBPRI_H
+
+ /* Node types */
+-#define PRI_NETWORK 1
++#define PRI_NETWORK 1 /* PTP modes, default for PRI */
+ #define PRI_CPE 2
++#define BRI_NETWORK_PTMP 3 /* PTMP modes, default for BRI */
++#define BRI_CPE_PTMP 4
++#define BRI_NETWORK 5 /* PTP modes */
++#define BRI_CPE 6
+
+ /* Debugging */
+ #define PRI_DEBUG_Q921_RAW (1 << 0) /* Show raw HDLC frames */
+@@ -76,6 +82,12 @@
+ #define PRI_EVENT_NOTIFY 16 /* Notification received */
+ #define PRI_EVENT_PROGRESS 17 /* When we get CALL_PROCEEDING or PROGRESS */
+ #define PRI_EVENT_KEYPAD_DIGIT 18 /* When we receive during ACTIVE state */
++#define PRI_EVENT_HOLD_REQ 19 /* R */
++#define PRI_EVENT_RETRIEVE_REQ 20
++#define PRI_EVENT_SUSPEND_REQ 21 /* park */
++#define PRI_EVENT_RESUME_REQ 22 /* unpark */
++#define PRI_EVENT_DISPLAY_RECEIVED 23
++#define PRI_EVENT_FACILITY 24 /* Facility */
+
+ /* Simple states */
+ #define PRI_STATE_DOWN 0
+@@ -250,11 +262,17 @@
+ #define PRI_NSF_ATT_MULTIQUEST 0xF0
+ #define PRI_NSF_CALL_REDIRECTION_SERVICE 0xF7
+
++#ifdef RELAX_TRB
++#define PRI_RELAX_TRB
++#endif
++
++typedef struct q921_call q921_call;
+ typedef struct q931_call q931_call;
+
+ typedef struct pri_event_generic {
+ /* Events with no additional information fall in this category */
+ int e;
++ int tei;
+ } pri_event_generic;
+
+ typedef struct pri_event_error {
+@@ -273,18 +291,19 @@
+ int cref;
+ int progress;
+ int progressmask;
+- q931_call *call;
+ char useruserinfo[260]; /* User->User info */
++ q931_call *call;
+ } pri_event_ringing;
+
+ typedef struct pri_event_answer {
+ int e;
+ int channel;
++ int tei; /* belongs to this tei */
+ int cref;
+ int progress;
+ int progressmask;
+- q931_call *call;
+ char useruserinfo[260]; /* User->User info */
++ q931_call *call;
+ } pri_event_answer;
+
+ typedef struct pri_event_facname {
+@@ -302,32 +321,37 @@
+ int e;
+ int channel; /* Channel requested */
+ int callingpres; /* Presentation of Calling CallerID */
+- int callingplanani; /* Dialing plan of Calling entity ANI */
++ int callingpresuser; /* Presentation of Calling CallerID */
+ int callingplan; /* Dialing plan of Calling entity */
+- char callingani[256]; /* Calling ANI */
+- char callingnum[256]; /* Calling number */
++ int callingplanuser; /* Dialing plan of Calling entity */
++ int callingplanani; /* Dialing plan of Calling entity ANI */
++ char callingnum[256]; /* Calling number, network provided */
++ char callingani[256]; /* Calling number, user provided */
+ char callingname[256]; /* Calling name (if provided) */
+ int calledplan; /* Dialing plan of Called number */
+ int ani2; /* ANI II */
+ char callednum[256]; /* Called number */
+- char redirectingnum[256]; /* Redirecting number */
+- char redirectingname[256]; /* Redirecting name */
+- int redirectingreason; /* Reason for redirect */
++ char redirectingnum[256]; /* Redirecting number */
++ char redirectingname[256]; /* Redirecting name */
++ int redirectingreason; /* Reason for redirect */
+ int callingplanrdnis; /* Dialing plan of Redirecting Number */
+- char useruserinfo[260]; /* User->User info */
++ char useruserinfo[260]; /* User->User info */
+ int flexible; /* Are we flexible with our channel selection? */
+ int cref; /* Call Reference Number */
+ int ctype; /* Call type (see PRI_TRANS_CAP_* */
+- int layer1; /* User layer 1 */
++ int layer1; /* User layer 1 */
+ int complete; /* Have we seen "Complete" i.e. no more number? */
+ q931_call *call; /* Opaque call pointer */
+- char callingsubaddr[256]; /* Calling parties subaddress */
++ int tei; /* belongs to this tei */
++ char callingsubaddr[256]; /* Calling parties subaddress */
+ int progress;
+ int progressmask;
+ char origcalledname[256];
+ char origcallednum[256];
+ int callingplanorigcalled; /* Dialing plan of Originally Called Number */
+ int origredirectingreason;
++ char lowlayercompat[16];
++ char highlayercompat[4];
+ } pri_event_ring;
+
+ typedef struct pri_event_hangup {
+@@ -335,6 +359,8 @@
|