Compare commits

..

22 Commits

Author SHA1 Message Date
Matthew Fredrickson
11206c4ddf git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.2@1165 2fbb986a-6c06-0410-b554-c9c1f0a7f128 2009-10-08 19:58:50 +00:00
Matthew Fredrickson
30a3abe6c5 Update .version file and Changelog correctly this time...
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.2@1164 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-08 19:56:28 +00:00
Matthew Fredrickson
eb34562959 This fix is more like the fix that was used to resolve the issue for the PRI case
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.2@1144 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-29 15:32:23 +00:00
Matthew Fredrickson
fd30b495b6 Changes for 1.4.10.2
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.2@1143 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-28 19:07:01 +00:00
Matthew Fredrickson
48f28055e4 git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.2@1142 2fbb986a-6c06-0410-b554-c9c1f0a7f128 2009-09-28 18:52:56 +00:00
Shaun Ruffell
7659b102d4 Limiting last entry to 80 columns
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.1@936 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-07-02 19:15:01 +00:00
Shaun Ruffell
b0180e3283 Update the .version file to 1.4.10.1
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.1@935 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-07-02 19:09:43 +00:00
Matthew Fredrickson
b6d92b91b4 git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.1@929 2fbb986a-6c06-0410-b554-c9c1f0a7f128 2009-06-30 15:43:39 +00:00
Matthew Fredrickson
fe23002233 ------------------------------------------------------------------------
r859 | mattf | 2009-06-09 14:47:05 -0500 (Tue, 09 Jun 2009) | 19 lines

There are two changes in this commit that are bug fixes for various Q.921 issues found in internal testing.

Both were exposed/introduced by the TBR4 compliance patch for bug #12861, in changing how retransmissions and in how
the transmission queue was maintained.  TX-RX message flow and acknowledgement was severely restricted,
since the patch changed the behavior so that pending untransmitted frames would not actually be send until
the next RR was received in normal circumstances, or REJ when a reject frame was received.  On busy links,
this can severly limit the amount of useful traffic that is sent, and can slow down message transmission.

Until someone can point out where in Q.921 it is mandated for us to wait for RR frames to start sending
untransmitted messages, the first change is to allow us to send untransmitted frames when we receive new
I frames as well, with updated N(R).

The other bug fixed is a situation caused by the restricted traffic flow, if an outside process tries to send
an I-frame asynchronous to an RR frame, when the transmit window was previously closed and then opened up but 
an RR has not been received yet.  A bug was found with the integration of the old transmit code with the new reject 
handling code which caused the new frame to be sent immediately, regardless if there were any pending untransmitted 
I-frames in the queue to be sent and causing an out of order I-frame to be sent to the other side.  This bug is 
also fixed in this patch.

------------------------------------------------------------------------


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.1@928 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-30 15:37:25 +00:00
Matthew Fredrickson
09eb3b1453 git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10.1@927 2fbb986a-6c06-0410-b554-c9c1f0a7f128 2009-06-30 15:34:46 +00:00
Matthew Fredrickson
a12412eec8 Importing files for 1.4.10 release.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10@761 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-18 21:27:42 +00:00
Matthew Fredrickson
d681c61357 Creating tag for the release of libpri-1.4.10
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10@760 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-18 21:26:56 +00:00
Matthew Fredrickson
26ced75a26 Importing files for 1.4.10 release.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10@758 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-18 21:26:07 +00:00
Matthew Fredrickson
9757b33103 Creating tag for the release of libpri-1.4.10
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.10@757 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-18 21:25:41 +00:00
Richard Mudgett
f9d5aa3c3a Comment changes and some string content corrections.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@726 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-02 19:33:38 +00:00
Richard Mudgett
88551af7ef Comment changes to note what ISDN message type causes the event.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@715 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-03-26 16:01:45 +00:00
Richard Mudgett
29ded17c0b Added pSS1InfoElement comments in qsig_cf_callrerouting().
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@711 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-03-19 01:39:21 +00:00
Richard Mudgett
bbaeec9513 Use the correct branch integrated property when generating the version string.
Update the make_version file to the latest Asterisk version with the
appropriate libpri required chage.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@705 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-03-13 01:05:54 +00:00
Joshua Colp
48fc219865 Make sure we only have 4 octects on unrestricted 64k data calls.
(closes issue #14507)
Reported by: jsmith
Patches:
      64k-data.patch uploaded by jsmith (license 15)
Tested by: jsmith
(closes issue #13118)
Reported by: radpeter


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@701 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-03-04 20:31:20 +00:00
Leif Madsen
9ecdbed001 Fix a small spelling error.
(closes issue #14375)
Reported by: jeremy1

git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@687 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-02-02 20:18:03 +00:00
Matthew Fredrickson
3d91cd5e30 A couple of last BRI fixes in libpri... don't discard pending iframes when we call the q921_dchannel_up routine, since we need to be able to send the ones that were queued up while the D-channel went down and is being reactivated. Also fix some buggy logic in the frame transmission decision code.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@680 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-01-27 23:22:06 +00:00
Matthew Fredrickson
a30eeee9a8 Change behavior so that we do not send I-frames when link is down, but instead queue them up until the link comes up and send them out then.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@675 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-01-22 21:48:41 +00:00
9 changed files with 261 additions and 124 deletions

View File

@@ -1 +1 @@
1.4.9
1.4.10.2

View File

@@ -1,3 +1,97 @@
2009-10-08 Matthew Fredrickson <creslin@digium.com>
* libpri 1.4.10.2 released. A bug was found which was introduced
during the PTMP rewrite, which causes timers to not be cleared
before being set in certain situations. This can cause the
scheduler to be completely filled, as well as improper Q.921 link
operation.
2009-04-18 Matthew Fredrickson <creslin@digium.com>
* libpri 1.4.10.1 released. Includes a fix for a regression found in
the last few revisions of libpri, but fixed in revision 859 of
branches/1.4. The summary is as follows:
* q921.c: There are two changes in this commit that are bug fixes for
various Q.921 issues found in internal testing.
Both were exposed/introduced by the TBR4 compliance patch for bug
#12861, in changing how retransmissions and in how the transmission
queue was maintained. TX-RX message flow and acknowledgement was
severely restricted, since the patch changed the behavior so that
pending untransmitted frames would not actually be send until the
next RR was received in normal circumstances, or REJ when a reject
frame was received. On busy links, this can severly limit the
amount of useful traffic that is sent, and can slow down message
transmission.
Until someone can point out where in Q.921 it is mandated for us to
wait for RR frames to start sending untransmitted messages, the
first change is to allow us to send untransmitted frames when we
receive new I frames as well, with updated N(R).
The other bug fixed is a situation caused by the restricted traffic
flow, if an outside process tries to send an I-frame asynchronous to
an RR frame, when the transmit window was previously closed and then
opened up but an RR has not been received yet. A bug was found with
the integration of the old transmit code with the new reject
handling code which caused the new frame to be sent immediately,
regardless if there were any pending untransmitted I-frames in the
queue to be sent and causing an out of order I-frame to be sent to
the other side. This bug is also fixed in this patch.
2009-04-18 Matthew Fredrickson <creslin@digium.com>
* libpri 1.4.10 released.
2009-04-02 19:33 +0000 [r726] Richard Mudgett <rmudgett@digium.com>
* pri_facility.c: Comment changes and some string content
corrections.
2009-03-26 16:01 +0000 [r715] Richard Mudgett <rmudgett@digium.com>
* libpri.h: Comment changes to note what ISDN message type causes
the event.
2009-03-19 01:39 +0000 [r711] Richard Mudgett <rmudgett@digium.com>
* pri_facility.c: Added pSS1InfoElement comments in
qsig_cf_callrerouting().
2009-03-13 01:05 +0000 [r705] Richard Mudgett <rmudgett@digium.com>
* build_tools/make_version: Use the correct branch integrated
property when generating the version string. Update the
make_version file to the latest Asterisk version with the
appropriate libpri required chage.
2009-03-04 20:31 +0000 [r701] Joshua Colp <jcolp@digium.com>
* q931.c: Make sure we only have 4 octects on unrestricted 64k data
calls. (closes issue #14507) Reported by: jsmith Patches:
64k-data.patch uploaded by jsmith (license 15) Tested by: jsmith
(closes issue #13118) Reported by: radpeter
2009-02-02 20:18 +0000 [r687] Leif Madsen <lmadsen@digium.com>
* libpri.h: Fix a small spelling error. (closes issue #14375)
Reported by: jeremy1
2009-01-27 23:22 +0000 [r680] Matthew Fredrickson <creslin@digium.com>
* q921.c: A couple of last BRI fixes in libpri... don't discard
pending iframes when we call the q921_dchannel_up routine, since
we need to be able to send the ones that were queued up while the
D-channel went down and is being reactivated. Also fix some buggy
logic in the frame transmission decision code.
2009-01-22 21:48 +0000 [r675] Matthew Fredrickson <creslin@digium.com>
* q921.c: Change behavior so that we do not send I-frames when link
is down, but instead queue them up until the link comes up and
send them out then.
2009-01-09 Matthew Fredrickson <creslin@digium.com>
* libpri 1.4.9 released.

View File

@@ -1,7 +1,7 @@
#!/bin/sh
if [ -f ${1}/.version ]; then
cat ${1}/.version
cat ${1}/.version
elif [ -d .svn ]; then
PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/libpri/::' | sed -e 's:/: :g'`
BRANCH=0
@@ -10,63 +10,70 @@ elif [ -d .svn ]; then
REV=`svnversion -c ${1} | cut -d: -f2`
BASE=`LANG=C svn pg svnmerge-integrated ${1} | cut -d: -f1`
INTEGRATED=`LANG=C svn pg automerge-propname ${1}`
if [ -z "${INTEGRATED}" ] ; then
INTEGRATED=svnmerge-integrated
fi
if [ "${PARTS}" = "trunk" ] ; then
echo SVN-trunk-r${REV}
exit 0
fi
BASE=`LANG=C svn pg ${INTEGRATED} ${1} | cut -d: -f1`
if [ "${PARTS}" = "trunk" ] ; then
echo SVN-trunk-r${REV}
exit 0
fi
for PART in $PARTS ; do
if [ ${TAG} != 0 ] ; then
if [ "${PART}" = "autotag_for_be" ] ; then
continue
fi
if [ "${PART}" = "autotag_for_sx00i" ] ; then
continue
fi
RESULT="${PART}"
break
fi
if [ ${BRANCH} != 0 ] ; then
if [ -z ${RESULT} ] ; then
RESULT="${PART}"
else
RESULT="${RESULT}-${PART}"
if [ ${TAG} != 0 ] ; then
if [ "${PART}" = "autotag_for_be" ] ; then
continue
fi
if [ "${PART}" = "autotag_for_sx00i" ] ; then
continue
fi
RESULT="${PART}"
break
fi
break
fi
if [ ${TEAM} != 0 ] ; then
if [ -z ${RESULT} ] ; then
RESULT="${PART}"
else
RESULT="${RESULT}-${PART}"
if [ ${BRANCH} != 0 ] ; then
if [ -z "${RESULT}" ] ; then
RESULT="${PART}"
else
RESULT="${RESULT}-${PART}"
fi
break
fi
continue
fi
if [ "${PART}" = "branches" ] ; then
BRANCH=1
RESULT="branch"
continue
fi
if [ ${TEAM} != 0 ] ; then
if [ -z "${RESULT}" ] ; then
RESULT="${PART}"
else
RESULT="${RESULT}-${PART}"
fi
continue
fi
if [ "${PART}" = "tags" ] ; then
TAG=1
continue
fi
if [ "${PART}" = "branches" ] ; then
BRANCH=1
RESULT="branch"
continue
fi
if [ "${PART}" = "team" ] ; then
TEAM=1
continue
fi
if [ "${PART}" = "tags" ] ; then
TAG=1
continue
fi
if [ "${PART}" = "team" ] ; then
TEAM=1
continue
fi
done
if [ ${TAG} != 0 ] ; then
echo ${RESULT}
echo ${RESULT}
else
echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}
echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}
fi
else
echo "UNKNOWN__and_probably_unsupported"
fi

View File

@@ -64,23 +64,23 @@
/* PRI D-Channel Events */
#define PRI_EVENT_DCHAN_UP 1 /* D-channel is up */
#define PRI_EVENT_DCHAN_DOWN 2 /* D-channel is down */
#define PRI_EVENT_DCHAN_DOWN 2 /* D-channel is down */
#define PRI_EVENT_RESTART 3 /* B-channel is restarted */
#define PRI_EVENT_CONFIG_ERR 4 /* Configuration Error Detected */
#define PRI_EVENT_RING 5 /* Incoming call */
#define PRI_EVENT_HANGUP 6 /* Call got hung up */
#define PRI_EVENT_RINGING 7 /* Call is ringing (alerting) */
#define PRI_EVENT_ANSWER 8 /* Call has been answered */
#define PRI_EVENT_RING 5 /* Incoming call (SETUP) */
#define PRI_EVENT_HANGUP 6 /* Call got hung up (RELEASE/RELEASE_COMPLETE/other) */
#define PRI_EVENT_RINGING 7 /* Call is ringing (ALERTING) */
#define PRI_EVENT_ANSWER 8 /* Call has been answered (CONNECT) */
#define PRI_EVENT_HANGUP_ACK 9 /* Call hangup has been acknowledged */
#define PRI_EVENT_RESTART_ACK 10 /* Restart complete on a given channel */
#define PRI_EVENT_RESTART_ACK 10 /* Restart complete on a given channel (RESTART_ACKNOWLEDGE) */
#define PRI_EVENT_FACNAME 11 /* Caller*ID Name received on Facility */
#define PRI_EVENT_INFO_RECEIVED 12 /* Additional info (keypad) received */
#define PRI_EVENT_PROCEEDING 13 /* When we get CALL_PROCEEDING or PROGRESS */
#define PRI_EVENT_INFO_RECEIVED 12 /* Additional info (digits) received (INFORMATION) */
#define PRI_EVENT_PROCEEDING 13 /* When we get CALL_PROCEEDING */
#define PRI_EVENT_SETUP_ACK 14 /* When we get SETUP_ACKNOWLEDGE */
#define PRI_EVENT_HANGUP_REQ 15 /* Requesting the higher layer to hangup */
#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_HANGUP_REQ 15 /* Requesting the higher layer to hangup (DISCONNECT) */
#define PRI_EVENT_NOTIFY 16 /* Notification received (NOTIFY) */
#define PRI_EVENT_PROGRESS 17 /* When we get PROGRESS */
#define PRI_EVENT_KEYPAD_DIGIT 18 /* When we receive during ACTIVE state (INFORMATION) */
/* Simple states */
#define PRI_STATE_DOWN 0
@@ -595,7 +595,7 @@ int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);
/* Set a call has a call indpendent signalling connection (i.e. no bchan) */
int pri_sr_set_connection_call_independent(struct pri_sr *req);
/* Send an MWI indication to a remote location. If activate is non zero, activates, if zero, decativates */
/* Send an MWI indication to a remote location. If activate is non zero, activates, if zero, deactivates */
int pri_mwi_activate(struct pri *pri, q931_call *c, char *caller, int callerplan, char *callername, int callerpres, char *called, int calledplan);
/* Send an MWI deactivate request to a remote location */

2
pri.c
View File

@@ -280,7 +280,7 @@ int pri_restart(struct pri *pri)
{
/* Restart Q.921 layer */
if (pri) {
q921_reset(pri);
q921_reset(pri, 1);
q921_start(pri, pri->localtype == PRI_CPE);
}
return 0;

View File

@@ -1289,15 +1289,15 @@ int qsig_cf_callrerouting(struct pri *pri, q931_call *c, const char* dest, const
/* pSS1InfoElement */
ASN1_ADD_SIMPLE(comp, (ASN1_APPLICATION | ASN1_TAG_0 ), buffer, i);
ASN1_PUSH(compstk, compsp, comp);
buffer[i++] = (0x04); /* add BC */
buffer[i++] = (0x03);
buffer[i++] = (0x80);
buffer[i++] = (0x90);
buffer[i++] = (0xa3);
buffer[i++] = (0x95);
buffer[i++] = (0x32);
buffer[i++] = (0x01);
buffer[i++] = (0x81);
buffer[i++] = (0x04); /* Bearer Capability IE */
buffer[i++] = (0x03); /* len */
buffer[i++] = (0x80); /* ETSI Standard, Speech */
buffer[i++] = (0x90); /* circuit mode, 64kbit/s */
buffer[i++] = (0xa3); /* level1 protocol, a-law */
buffer[i++] = (0x95); /* locking shift to codeset 5 (national use) */
buffer[i++] = (0x32); /* Unknown ie */
buffer[i++] = (0x01); /* Unknown ie len */
buffer[i++] = (0x81); /* Unknown ie body */
ASN1_FIXUP(compstk, compsp, buffer, i);
/* lastReroutingNr [1]*/
@@ -1425,7 +1425,6 @@ int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
/* Channel 1 */
buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS);
/* Interpretation component */
ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer, i);
ASN1_PUSH(compstk, compsp, comp);
@@ -1433,6 +1432,7 @@ int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0);
ASN1_FIXUP(compstk, compsp, buffer, i);
/* Interpretation component */
ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer, i, 2); /* reject - to get feedback from QSIG switch */
ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i);
@@ -1447,15 +1447,22 @@ int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
ASN1_ADD_SIMPLE(comp, (ASN1_SEQUENCE | ASN1_CONSTRUCTOR), buffer, i);
ASN1_PUSH(compstk, compsp, comp);
buffer[i++] = (0x0a);
buffer[i++] = (0x01);
buffer[i++] = (0x00);
buffer[i++] = (0x81);
buffer[i++] = (0x00);
buffer[i++] = (0x0a);
buffer[i++] = (0x01);
buffer[i++] = (0x01);
buffer[i++] = (0x0a);/* Enumeration endDesignation */
buffer[i++] = (0x01);/* Len */
buffer[i++] = (0x00);/* primaryEnd */
buffer[i++] = (0x81);/* redirectionNumber = presentationRestricted */
buffer[i++] = (0x00);/* Len */
buffer[i++] = (0x0a);/* Enumeration callStatus */
buffer[i++] = (0x01);/* Len */
buffer[i++] = (0x01);/* alerting */
/*
* Where does this element come from? It is not in Q.SIG ECMA-178.
* We send this but we will not accept it.
* This seems to be a cut and paste error from eect_initiate_transfer().
*/
ASN1_ADD_WORDCOMP(comp, ASN1_INTEGER, buffer, i, call_reference);
ASN1_FIXUP(compstk, compsp, buffer, i);
ASN1_FIXUP(compstk, compsp, buffer, i);
@@ -1480,7 +1487,6 @@ int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
compsp = 0;
buffer2[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS);
/* Interpretation component */
ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer2, i);
ASN1_PUSH(compstk, compsp, comp);
@@ -1488,6 +1494,7 @@ int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer2, i, 0);
ASN1_FIXUP(compstk, compsp, buffer2, i);
/* Interpretation component */
ASN1_ADD_BYTECOMP(comp, COMP_TYPE_INTERPRETATION, buffer2, i, 2); /* reject */
ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer2, i);
@@ -1502,15 +1509,22 @@ int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
ASN1_ADD_SIMPLE(comp, (ASN1_SEQUENCE | ASN1_CONSTRUCTOR), buffer2, i);
ASN1_PUSH(compstk, compsp, comp);
buffer2[i++] = (0x0a);
buffer2[i++] = (0x01);
buffer2[i++] = (0x01);
buffer2[i++] = (0x81);
buffer2[i++] = (0x00);
buffer2[i++] = (0x0a);
buffer2[i++] = (0x01);
buffer2[i++] = (0x01);
buffer2[i++] = (0x0a);/* Enumeration endDesignation */
buffer2[i++] = (0x01);/* Len */
buffer2[i++] = (0x01);/* secondaryEnd */
buffer2[i++] = (0x81);/* redirectionNumber = presentationRestricted */
buffer2[i++] = (0x00);/* Len */
buffer2[i++] = (0x0a);/* Enumeration callStatus */
buffer2[i++] = (0x01);/* Len */
buffer2[i++] = (0x01);/* alerting */
/*
* Where does this element come from? It is not in Q.SIG ECMA-178.
* We send this but we will not accept it.
* This seems to be a cut and paste error from eect_initiate_transfer().
*/
ASN1_ADD_WORDCOMP(comp, ASN1_INTEGER, buffer2, i, call_reference);
ASN1_FIXUP(compstk, compsp, buffer2, i);
ASN1_FIXUP(compstk, compsp, buffer2, i);
@@ -2267,7 +2281,7 @@ int rose_reject_decode(struct pri *pri, q931_call *call, q931_ie *ie, unsigned c
return 0;
} else {
pri_message(pri, "Unable to handle return result on switchtype %d!\n", pri->switchtype);
pri_message(pri, "Unable to handle reject on switchtype %d!\n", pri->switchtype);
return -1;
}
@@ -2330,8 +2344,7 @@ int rose_return_error_decode(struct pri *pri, q931_call *call, q931_ie *ie, unsi
return 0;
} else {
pri_message(pri, "Unable to handle return result on switchtype %d!\n", pri->switchtype);
return -1;
pri_message(pri, "Unable to handle return error on switchtype %d!\n", pri->switchtype);
}
} while(0);

View File

@@ -186,7 +186,7 @@ extern void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx
/* Bring up the D-channel */
extern void q921_start(struct pri *pri, int now);
extern void q921_reset(struct pri *pri);
extern void q921_reset(struct pri *pri, int reset_iqueue);
extern pri_event *q921_receive(struct pri *pri, q921_h *h, int len);

81
q921.c
View File

@@ -268,12 +268,31 @@ static void reschedule_t203(struct pri *pri)
pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri);
}
static void q921_send_queued_iframes(struct pri *pri)
{
struct q921_frame *f;
f = pri->txqueue;
while(f && (pri->windowlen < pri->window)) {
if (!f->transmitted) {
/* Send it now... */
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "-- Finally transmitting %d, since window opened up (%d)\n", f->h.n_s, pri->windowlen);
f->transmitted++;
pri->windowlen++;
f->h.n_r = pri->v_r;
f->h.p_f = 0;
q921_transmit(pri, (q921_h *)(&f->h), f->len);
}
f = f->next;
}
}
static pri_event *q921_ack_rx(struct pri *pri, int ack, int send_untransmitted_frames)
{
int x;
int cnt=0;
pri_event *ev;
struct q921_frame *f;
/* Make sure the ACK was within our window */
for (x=pri->v_a; (x != pri->v_s) && (x != ack); Q921_INC(x));
if (x != ack) {
@@ -309,20 +328,7 @@ static pri_event *q921_ack_rx(struct pri *pri, int ack, int send_untransmitted_f
if (!pri->busy && send_untransmitted_frames) {
pri->retrans = 0;
/* Search for something to send */
f = pri->txqueue;
while(f && (pri->windowlen < pri->window)) {
if (!f->transmitted) {
/* Send it now... */
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "-- Finally transmitting %d, since window opened up (%d)\n", f->h.n_s, pri->windowlen);
f->transmitted++;
pri->windowlen++;
f->h.n_r = pri->v_r;
f->h.p_f = 0;
q921_transmit(pri, (q921_h *)(&f->h), f->len);
}
f = f->next;
}
q921_send_queued_iframes(pri);
}
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "-- Waiting for acknowledge, restarting T200 counter\n");
@@ -515,11 +521,9 @@ int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr)
pri->txqueue = f;
/* Immediately transmit unless we're in a recovery state, or the window
size is too big */
if (!pri->retrans && !pri->busy) {
if ((pri->q921_state == Q921_LINK_CONNECTION_ESTABLISHED) && (!pri->retrans && !pri->busy)) {
if (pri->windowlen < pri->window) {
pri->windowlen++;
q921_transmit(pri, (q921_h *)(&f->h), f->len);
f->transmitted++;
q921_send_queued_iframes(pri);
} else {
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "Delaying transmission of %d, window is %d/%d long\n",
@@ -532,9 +536,14 @@ int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr)
pri_schedule_del(pri, pri->t203_timer);
pri->t203_timer = 0;
}
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "Starting T_200 timer\n");
reschedule_t200(pri);
/* Check this so that we don't try to send frames while multi frame mode is down */
if (pri->q921_state == Q921_LINK_CONNECTION_ESTABLISHED) {
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "Starting T_200 timer\n");
reschedule_t200(pri);
}
} else {
pri_error(pri, "!! Out of memory for Q.921 transmit\n");
return -1;
@@ -572,7 +581,7 @@ static pri_event *q921_handle_iframe(struct pri *pri, q921_i *i, int len)
Q921_INC(pri->v_r);
/* Handle their ACK */
pri->sentrej = 0;
ev = q921_ack_rx(pri, i->n_r, 0);
ev = q921_ack_rx(pri, i->n_r, 1);
if (ev)
return ev;
if (i->p_f) {
@@ -776,9 +785,12 @@ void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx)
static pri_event *q921_dchannel_up(struct pri *pri)
{
/* Reset counters, etc */
q921_reset(pri);
if (pri->tei == Q921_TEI_PRI) {
q921_reset(pri, 1);
} else {
q921_reset(pri, 0);
}
/* Stop any SABME retransmissions */
if (pri->sabme_timer) {
pri_schedule_del(pri, pri->sabme_timer);
@@ -799,6 +811,8 @@ static pri_event *q921_dchannel_up(struct pri *pri)
/* Notify Layer 3 */
q931_dl_indication(pri, PRI_EVENT_DCHAN_UP);
q921_send_queued_iframes(pri);
/* Report event that D-Channel is now up */
pri->ev.gen.e = PRI_EVENT_DCHAN_UP;
return &pri->ev;
@@ -807,7 +821,7 @@ static pri_event *q921_dchannel_up(struct pri *pri)
static pri_event *q921_dchannel_down(struct pri *pri)
{
/* Reset counters, reset sabme timer etc */
q921_reset(pri);
q921_reset(pri, 1);
/* Notify Layer 3 */
q931_dl_indication(pri, PRI_EVENT_DCHAN_DOWN);
@@ -817,10 +831,12 @@ static pri_event *q921_dchannel_down(struct pri *pri)
return &pri->ev;
}
void q921_reset(struct pri *pri)
void q921_reset(struct pri *pri, int reset_iqueue)
{
/* Having gotten a SABME we MUST reset our entire state */
pri->v_s = 0;
if (reset_iqueue)
pri->v_s = 0;
pri->v_a = 0;
pri->v_r = 0;
pri->v_na = 0;
@@ -845,7 +861,8 @@ void q921_reset(struct pri *pri)
pri->sentrej = 0;
/* Discard anything waiting to go out */
q921_discard_retransmissions(pri);
if (reset_iqueue)
q921_discard_retransmissions(pri);
}
static void q921_tei_release_and_reacquire(struct pri *master)
@@ -1248,14 +1265,14 @@ static void q921_restart(struct pri *pri, int now)
return;
}
/* Reset our interface */
q921_reset(pri);
q921_reset(pri, 1);
/* Do the SABME XXX Maybe we should implement T_WAIT? XXX */
q921_send_sabme(pri, now);
}
void q921_start(struct pri *pri, int isCPE)
{
q921_reset(pri);
q921_reset(pri, 1);
if ((pri->sapi == Q921_SAPI_LAYER2_MANAGEMENT) && (pri->tei == Q921_TEI_GROUP)) {
pri->q921_state = Q921_DOWN;
if (isCPE)

6
q931.c
View File

@@ -825,6 +825,12 @@ static FUNC_SEND(transmit_bearer_capability)
/* Apparently EuroISDN switches don't seem to like user layer 2/3 */
return 4;
}
if ((tc & PRI_TRANS_CAP_DIGITAL) && (call->transmoderate == TRANS_MODE_64_CIRCUIT)) {
/* Unrestricted digital 64k data calls don't use user layer 2/3 */
return 4;
}
if (call->transmoderate != TRANS_MODE_PACKET) {
/* If you have an AT&T 4ESS, you don't send any more info */
if ((pri->switchtype != PRI_SWITCH_ATT4ESS) && (call->userl1 > -1)) {