Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
182e49bb99 | ||
|
|
954bdb25aa |
87
ChangeLog
87
ChangeLog
@@ -1,90 +1,3 @@
|
||||
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.
|
||||
|
||||
2009-01-09 17:58 +0000 [r656] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q921.c: Add additional case where T200 expires greater than N200
|
||||
times and we need to release and reacquire the TEI.
|
||||
|
||||
2008-12-23 21:38 +0000 [r653] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q921.c, q931.c: Add some additional debug for Q.921 MDL messages
|
||||
as well as fix a bug in RESTART messages on BRI
|
||||
|
||||
2008-11-22 Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* libpri 1.4.8 released.
|
||||
|
||||
2008-11-22 00:34 +0000 [r645] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q921.c: Fix a number of Q.921 bugs, found doing TBR4 compliance
|
||||
testing, thanks to Tzafrir, Xorcom, and co. (#12861). Thanks!
|
||||
|
||||
2008-10-17 16:13 +0000 [r636] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* pri.c, pri_internal.h, pri_q931.h, q931.c, pri_facility.c,
|
||||
pri_facility.h, libpri.h: Merging in additional Q.SIG features in
|
||||
#13454. Includes Q.SIG physical/logical channel mapping support,
|
||||
extended coding of Q.SIG name operations (calling name), and call
|
||||
rerouting support via added dialplan application.
|
||||
|
||||
2008-08-06 18:20 +0000 [r616] Jason Parker <jparker@digium.com>
|
||||
|
||||
* Makefile: Make install paths use libdir, like libss7
|
||||
|
||||
2008-08-05 Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* libpri 1.4.7 released.
|
||||
|
||||
25
Makefile
25
Makefile
@@ -46,7 +46,6 @@ DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo v
|
||||
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS)
|
||||
INSTALL_PREFIX=$(DESTDIR)
|
||||
INSTALL_BASE=/usr
|
||||
libdir?=$(INSTALL_BASE)/lib
|
||||
SOFLAGS:=-Wl,-h$(DYNAMIC_LIBRARY)
|
||||
LDCONFIG = /sbin/ldconfig
|
||||
ifneq (,$(findstring X$(OSARCH)X, XLinuxX XGNU/kFreeBSDX))
|
||||
@@ -97,27 +96,27 @@ update:
|
||||
fi
|
||||
|
||||
install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
|
||||
mkdir -p $(INSTALL_PREFIX)$(libdir)
|
||||
mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/lib
|
||||
mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/include
|
||||
ifneq (${OSARCH},SunOS)
|
||||
install -m 644 libpri.h $(INSTALL_PREFIX)$(INSTALL_BASE)/include
|
||||
install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)$(libdir)
|
||||
if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then /sbin/restorecon -v $(INSTALL_PREFIX)$(libdir)/$(DYNAMIC_LIBRARY); fi
|
||||
( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf libpri.so.$(SONAME) libpri.so)
|
||||
install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)$(libdir)
|
||||
if test $$(id -u) = 0; then $(LDCONFIG) $(LDCONFIG_FLAGS) $(INSTALL_PREFIX)$(libdir); fi
|
||||
install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib
|
||||
if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then /sbin/restorecon -v $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/$(DYNAMIC_LIBRARY); fi
|
||||
( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.$(SONAME) libpri.so)
|
||||
install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib
|
||||
if test $$(id -u) = 0; then $(LDCONFIG) $(LDCONFIG_FLAGS) $(INSTALL_PREFIX)$(INSTALL_BASE)/lib; fi
|
||||
else
|
||||
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include -m 644 libpri.h
|
||||
install -f $(INSTALL_PREFIX)$(libdir) -m 755 $(DYNAMIC_LIBRARY)
|
||||
( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf libpri.so.$(SONAME) libpri.so)
|
||||
install -f $(INSTALL_PREFIX)$(libdir) -m 644 $(STATIC_LIBRARY)
|
||||
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib -m 755 $(DYNAMIC_LIBRARY)
|
||||
( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.$(SONAME) libpri.so)
|
||||
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib -m 644 $(STATIC_LIBRARY)
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
@echo "Removing Libpri"
|
||||
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so.$(SONAME)
|
||||
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so
|
||||
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.a
|
||||
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.so.$(SONAME)
|
||||
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.so
|
||||
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.a
|
||||
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include/libpri.h
|
||||
|
||||
pritest: pritest.o
|
||||
|
||||
@@ -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,70 +10,63 @@ elif [ -d .svn ]; then
|
||||
|
||||
REV=`svnversion -c ${1} | cut -d: -f2`
|
||||
|
||||
INTEGRATED=`LANG=C svn pg automerge-propname ${1}`
|
||||
if [ -z "${INTEGRATED}" ] ; then
|
||||
INTEGRATED=svnmerge-integrated
|
||||
fi
|
||||
BASE=`LANG=C svn pg svnmerge-integrated ${1} | cut -d: -f1`
|
||||
|
||||
BASE=`LANG=C svn pg ${INTEGRATED} ${1} | cut -d: -f1`
|
||||
|
||||
if [ "${PARTS}" = "trunk" ] ; then
|
||||
echo SVN-trunk-r${REV}
|
||||
exit 0
|
||||
fi
|
||||
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 [ ${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}"
|
||||
fi
|
||||
break
|
||||
if [ ${BRANCH} != 0 ] ; then
|
||||
if [ -z ${RESULT} ] ; then
|
||||
RESULT="${PART}"
|
||||
else
|
||||
RESULT="${RESULT}-${PART}"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
|
||||
if [ ${TEAM} != 0 ] ; then
|
||||
if [ -z "${RESULT}" ] ; then
|
||||
RESULT="${PART}"
|
||||
else
|
||||
RESULT="${RESULT}-${PART}"
|
||||
fi
|
||||
continue
|
||||
if [ ${TEAM} != 0 ] ; then
|
||||
if [ -z ${RESULT} ] ; then
|
||||
RESULT="${PART}"
|
||||
else
|
||||
RESULT="${RESULT}-${PART}"
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "branches" ] ; then
|
||||
BRANCH=1
|
||||
RESULT="branch"
|
||||
continue
|
||||
fi
|
||||
if [ "${PART}" = "branches" ] ; then
|
||||
BRANCH=1
|
||||
RESULT="branch"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "tags" ] ; then
|
||||
TAG=1
|
||||
continue
|
||||
fi
|
||||
if [ "${PART}" = "tags" ] ; then
|
||||
TAG=1
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${PART}" = "team" ] ; then
|
||||
TEAM=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
|
||||
|
||||
37
libpri.h
37
libpri.h
@@ -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 (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_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_HANGUP_ACK 9 /* Call hangup has been acknowledged */
|
||||
#define PRI_EVENT_RESTART_ACK 10 /* Restart complete on a given channel (RESTART_ACKNOWLEDGE) */
|
||||
#define PRI_EVENT_RESTART_ACK 10 /* Restart complete on a given channel */
|
||||
#define PRI_EVENT_FACNAME 11 /* Caller*ID Name received on Facility */
|
||||
#define PRI_EVENT_INFO_RECEIVED 12 /* Additional info (digits) received (INFORMATION) */
|
||||
#define PRI_EVENT_PROCEEDING 13 /* When we get CALL_PROCEEDING */
|
||||
#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_SETUP_ACK 14 /* When we get SETUP_ACKNOWLEDGE */
|
||||
#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) */
|
||||
#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 */
|
||||
|
||||
/* 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, deactivates */
|
||||
/* Send an MWI indication to a remote location. If activate is non zero, activates, if zero, decativates */
|
||||
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 */
|
||||
@@ -615,10 +615,6 @@ void pri_set_error(void (*__pri_error)(struct pri *pri, char *));
|
||||
#define PRI_SET_OVERLAPDIAL
|
||||
void pri_set_overlapdial(struct pri *pri,int state);
|
||||
|
||||
/* QSIG logical channel mapping option, do not skip channel 16 */
|
||||
#define PRI_SET_CHAN_MAPPING_LOGICAL
|
||||
void pri_set_chan_mapping_logical(struct pri *pri, int state);
|
||||
|
||||
#define PRI_DUMP_INFO_STR
|
||||
char *pri_dump_info_str(struct pri *pri);
|
||||
|
||||
@@ -626,12 +622,9 @@ char *pri_dump_info_str(struct pri *pri);
|
||||
int pri_fd(struct pri *pri);
|
||||
|
||||
#define PRI_PROGRESS
|
||||
/* Send progress */
|
||||
/* Send call proceeding */
|
||||
int pri_progress(struct pri *pri, q931_call *c, int channel, int info);
|
||||
|
||||
/* Send progress with cause IE */
|
||||
int pri_progress_with_cause(struct pri *pri, q931_call *c, int channel, int info, int cause);
|
||||
|
||||
#define PRI_PROCEEDING_FULL
|
||||
/* Send call proceeding */
|
||||
int pri_proceeding(struct pri *pri, q931_call *c, int channel, int info);
|
||||
@@ -654,8 +647,6 @@ void pri_enslave(struct pri *master, struct pri *slave);
|
||||
/* Send notification */
|
||||
int pri_notify(struct pri *pri, q931_call *c, int channel, int info);
|
||||
|
||||
int pri_callrerouting_facility(struct pri *pri, q931_call *call, const char *dest, const char* original, const char* reason);
|
||||
|
||||
/* Get/Set PRI Timers */
|
||||
#define PRI_GETSET_TIMERS
|
||||
int pri_set_timer(struct pri *pri, int timer, int value);
|
||||
|
||||
25
pri.c
25
pri.c
@@ -483,19 +483,10 @@ int pri_proceeding(struct pri *pri, q931_call *call, int channel, int info)
|
||||
return q931_call_proceeding(pri, call, channel, info);
|
||||
}
|
||||
|
||||
int pri_progress_with_cause(struct pri *pri, q931_call *call, int channel, int info, int cause)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
|
||||
return q931_call_progress_with_cause(pri, call, channel, info, cause);
|
||||
}
|
||||
|
||||
int pri_progress(struct pri *pri, q931_call *call, int channel, int info)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
|
||||
return q931_call_progress(pri, call, channel, info);
|
||||
}
|
||||
|
||||
@@ -514,15 +505,6 @@ int pri_keypad_facility(struct pri *pri, q931_call *call, char *digits)
|
||||
return q931_keypad_facility(pri, call, digits);
|
||||
}
|
||||
|
||||
|
||||
int pri_callrerouting_facility(struct pri *pri, q931_call *call, const char *dest, const char* original, const char* reason)
|
||||
{
|
||||
if (!pri || !call)
|
||||
return -1;
|
||||
|
||||
return qsig_cf_callrerouting(pri, call, dest, original, reason);
|
||||
}
|
||||
|
||||
int pri_notify(struct pri *pri, q931_call *call, int channel, int info)
|
||||
{
|
||||
if (!pri || !call)
|
||||
@@ -805,12 +787,6 @@ void pri_set_overlapdial(struct pri *pri,int state)
|
||||
pri->overlapdial = state;
|
||||
}
|
||||
|
||||
void pri_set_chan_mapping_logical(struct pri *pri, int state)
|
||||
{
|
||||
if (pri->switchtype == PRI_SWITCH_QSIG)
|
||||
pri->chan_mapping_logical = state;
|
||||
}
|
||||
|
||||
void pri_set_inbanddisconnect(struct pri *pri, unsigned int enable)
|
||||
{
|
||||
pri->acceptinbanddisconnect = (enable != 0);
|
||||
@@ -854,7 +830,6 @@ char *pri_dump_info_str(struct pri *pri)
|
||||
len += sprintf(buf + len, "Retrans: %d\n", pri->retrans);
|
||||
len += sprintf(buf + len, "Busy: %d\n", pri->busy);
|
||||
len += sprintf(buf + len, "Overlap Dial: %d\n", pri->overlapdial);
|
||||
len += sprintf(buf + len, "Logical Channel Mapping: %d\n", pri->chan_mapping_logical);
|
||||
len += sprintf(buf + len, "T200 Timer: %d\n", pri->timers[PRI_TIMER_T200]);
|
||||
len += sprintf(buf + len, "T203 Timer: %d\n", pri->timers[PRI_TIMER_T203]);
|
||||
len += sprintf(buf + len, "T305 Timer: %d\n", pri->timers[PRI_TIMER_T305]);
|
||||
|
||||
316
pri_facility.c
316
pri_facility.c
@@ -1186,198 +1186,6 @@ int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
|
||||
}
|
||||
/* End EECT */
|
||||
|
||||
/* QSIG CF CallRerouting */
|
||||
int qsig_cf_callrerouting(struct pri *pri, q931_call *c, const char* dest, const char* original, const char* reason)
|
||||
{
|
||||
/*CallRerouting ::= OPERATION
|
||||
-- Sent from the Served User PINX to the Rerouting PINX
|
||||
ARGUMENT SEQUENCE
|
||||
{ reroutingReason DiversionReason,
|
||||
originalReroutingReason [0] IMPLICIT DiversionReason OPTIONAL,
|
||||
calledAddress Address,
|
||||
diversionCounter INTEGER (1..15),
|
||||
pSS1InfoElement PSS1InformationElement,
|
||||
-- The basic call information elements Bearer capability, High layer compatibility, Low
|
||||
-- layer compatibity, Progress indicator and Party category can be embedded in the
|
||||
-- pSS1InfoElement in accordance with 6.5.3.1.5
|
||||
lastReroutingNr [1] PresentedNumberUnscreened,
|
||||
subscriptionOption [2] IMPLICIT SubscriptionOption,
|
||||
|
||||
callingPartySubaddress [3] PartySubaddress OPTIONAL,
|
||||
|
||||
callingNumber [4] PresentedNumberScreened,
|
||||
|
||||
callingName [5] Name OPTIONAL,
|
||||
originalCalledNr [6] PresentedNumberUnscreened OPTIONAL,
|
||||
redirectingName [7] Name OPTIONAL,
|
||||
originalCalledName [8] Name OPTIONAL,
|
||||
extension CHOICE {
|
||||
[9] IMPLICIT Extension ,
|
||||
[10] IMPLICIT SEQUENCE OF Extension } OPTIONAL }
|
||||
*/
|
||||
|
||||
int i = 0, j;
|
||||
int res = 0;
|
||||
unsigned char buffer[255] = "";
|
||||
int len = 253;
|
||||
struct rose_component *comp = NULL, *compstk[10];
|
||||
int compsp = 0;
|
||||
static unsigned char op_tag[] = {
|
||||
0x13,
|
||||
};
|
||||
|
||||
buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_EXTENSIONS);
|
||||
/* Interpretation component */
|
||||
|
||||
ASN1_ADD_SIMPLE(comp, COMP_TYPE_NFE, buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0), buffer, i, 0);
|
||||
ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0);
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
|
||||
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);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, get_invokeid(pri));
|
||||
|
||||
res = asn1_string_encode(ASN1_INTEGER, &buffer[i], sizeof(buffer)-i, sizeof(op_tag), op_tag, sizeof(op_tag));
|
||||
if (res < 0)
|
||||
return -1;
|
||||
i += res;
|
||||
|
||||
/* call rerouting argument */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONSTRUCTOR | ASN1_SEQUENCE), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
|
||||
/* reroutingReason DiversionReason */
|
||||
|
||||
if (reason) {
|
||||
if (!strcasecmp(reason, "cfu"))
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 1); /* cfu */
|
||||
else if (!strcasecmp(reason, "cfb"))
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 2); /* cfb */
|
||||
else if (!strcasecmp(reason, "cfnr"))
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 3); /* cfnr */
|
||||
} else {
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 0); /* unknown */
|
||||
}
|
||||
|
||||
|
||||
/* calledAddress Address */
|
||||
/* explicit sequence tag for Address */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONSTRUCTOR | ASN1_SEQUENCE), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
/* implicit choice public party number tag */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
/* type of public party number = unknown */
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 0);
|
||||
/* NumberDigits of public party number */
|
||||
j = asn1_string_encode(ASN1_NUMERICSTRING, &buffer[i], len - i, 20, (char*)dest, strlen(dest));
|
||||
if (j < 0)
|
||||
return -1;
|
||||
|
||||
i += j;
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
|
||||
/* diversionCounter INTEGER (1..15) */
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_INTEGER, buffer, i, 1);
|
||||
|
||||
/* pSS1InfoElement */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_APPLICATION | ASN1_TAG_0 ), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
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]*/
|
||||
/* implicit optional lastReroutingNr tag */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
|
||||
/* implicit choice presented number unscreened tag */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
|
||||
/* implicit choice public party number tag */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
/* type of public party number = unknown */
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 0);
|
||||
j = asn1_string_encode(ASN1_NUMERICSTRING, &buffer[i], len - i, 20, original?(char*)original:c->callednum, original?strlen(original):strlen(c->callednum));
|
||||
if (j < 0)
|
||||
return -1;
|
||||
|
||||
i += j;
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
|
||||
/* subscriptionOption [2]*/
|
||||
/* implicit optional lastReroutingNr tag */
|
||||
ASN1_ADD_BYTECOMP(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_2), buffer, i, 0); /* noNotification */
|
||||
|
||||
/* callingNumber [4]*/
|
||||
/* implicit optional callingNumber tag */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_4), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
|
||||
/* implicit choice presented number screened tag */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_0), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
|
||||
/* implicit choice presentationAllowedAddress tag */
|
||||
ASN1_ADD_SIMPLE(comp, (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1), buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
/* type of public party number = subscriber number */
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 4);
|
||||
j = asn1_string_encode(ASN1_NUMERICSTRING, &buffer[i], len - i, 20, c->callernum, strlen(c->callernum));
|
||||
if (j < 0)
|
||||
return -1;
|
||||
|
||||
i += j;
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
|
||||
/* Screeening Indicator network provided */
|
||||
ASN1_ADD_BYTECOMP(comp, ASN1_ENUMERATED, buffer, i, 3);
|
||||
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
|
||||
/**/
|
||||
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
|
||||
res = pri_call_apdu_queue(c, Q931_FACILITY, buffer, i, NULL, NULL);
|
||||
if (res) {
|
||||
pri_message(pri, "Could not queue ADPU in facility message\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Remember that if we queue a facility IE for a facility message we
|
||||
* have to explicitly send the facility message ourselves */
|
||||
|
||||
res = q931_facility(c->pri, c);
|
||||
if (res) {
|
||||
pri_message(pri, "Could not schedule facility message for call %d\n", c->cr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* End QSIG CC-CallRerouting */
|
||||
|
||||
static int anfpr_pathreplacement_respond(struct pri *pri, q931_call *call, q931_ie *ie)
|
||||
{
|
||||
int res;
|
||||
@@ -1407,7 +1215,7 @@ static int anfpr_pathreplacement_respond(struct pri *pri, q931_call *call, q931_
|
||||
return 0;
|
||||
}
|
||||
/* AFN-PR */
|
||||
int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
|
||||
extern int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
|
||||
{
|
||||
/* Did all the tests to see if we're on the same PRI and
|
||||
* are on a compatible switchtype */
|
||||
@@ -1425,6 +1233,7 @@ 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);
|
||||
@@ -1432,7 +1241,6 @@ 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,22 +1255,15 @@ 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);/* 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().
|
||||
*/
|
||||
buffer[i++] = (0x0a);
|
||||
buffer[i++] = (0x01);
|
||||
buffer[i++] = (0x00);
|
||||
buffer[i++] = (0x81);
|
||||
buffer[i++] = (0x00);
|
||||
buffer[i++] = (0x0a);
|
||||
buffer[i++] = (0x01);
|
||||
buffer[i++] = (0x01);
|
||||
ASN1_ADD_WORDCOMP(comp, ASN1_INTEGER, buffer, i, call_reference);
|
||||
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
ASN1_FIXUP(compstk, compsp, buffer, i);
|
||||
|
||||
@@ -1487,6 +1288,7 @@ 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);
|
||||
@@ -1494,7 +1296,6 @@ 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);
|
||||
@@ -1509,22 +1310,15 @@ 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);/* 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().
|
||||
*/
|
||||
buffer2[i++] = (0x0a);
|
||||
buffer2[i++] = (0x01);
|
||||
buffer2[i++] = (0x01);
|
||||
buffer2[i++] = (0x81);
|
||||
buffer2[i++] = (0x00);
|
||||
buffer2[i++] = (0x0a);
|
||||
buffer2[i++] = (0x01);
|
||||
buffer2[i++] = (0x01);
|
||||
ASN1_ADD_WORDCOMP(comp, ASN1_INTEGER, buffer2, i, call_reference);
|
||||
|
||||
ASN1_FIXUP(compstk, compsp, buffer2, i);
|
||||
ASN1_FIXUP(compstk, compsp, buffer2, i);
|
||||
|
||||
@@ -1754,47 +1548,6 @@ static int aoc_aoce_charging_unit_encode(struct pri *pri, q931_call *c, long cha
|
||||
}
|
||||
/* End AOC */
|
||||
|
||||
static int rose_calling_name_decode(struct pri *pri, q931_call *call, struct rose_component *choice, int len)
|
||||
{
|
||||
int i = 0;
|
||||
struct rose_component *comp = NULL;
|
||||
unsigned char *vdata = choice->data;
|
||||
int characterSet = 1;
|
||||
switch (choice->type) {
|
||||
case ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE:
|
||||
memcpy(call->callername, choice->data, choice->len);
|
||||
call->callername[choice->len] = 0;
|
||||
if (pri->debug & PRI_DEBUG_APDU)
|
||||
pri_message(pri, " Received simple calling name '%s'\n", call->callername);
|
||||
return 0;
|
||||
|
||||
case ROSE_NAME_PRESENTATION_ALLOWED_EXTENDED:
|
||||
do {
|
||||
GET_COMPONENT(comp, i, vdata, len);
|
||||
CHECK_COMPONENT(comp, ASN1_OCTETSTRING, "Don't know what to do if nameData is of type 0x%x\n");
|
||||
memcpy(call->callername, comp->data, comp->len);
|
||||
call->callername[comp->len] = 0;
|
||||
NEXT_COMPONENT(comp, i);
|
||||
|
||||
GET_COMPONENT(comp, i, vdata, len);
|
||||
CHECK_COMPONENT(comp, ASN1_INTEGER, "Don't know what to do if CharacterSet is of type 0x%x\n");
|
||||
ASN1_GET_INTEGER(comp, characterSet);
|
||||
}
|
||||
while (0);
|
||||
|
||||
if (pri->debug & PRI_DEBUG_APDU)
|
||||
pri_message(pri, " Received extended calling name '%s', characterset %d\n", call->callername, characterSet);
|
||||
return 0;
|
||||
case ROSE_NAME_PRESENTATION_RESTRICTED_SIMPLE:
|
||||
case ROSE_NAME_PRESENTATION_RESTRICTED_EXTENDED:
|
||||
case ROSE_NAME_PRESENTATION_RESTRICTED_NULL:
|
||||
case ROSE_NAME_NOT_AVAIL:
|
||||
default:
|
||||
if (pri->debug & PRI_DEBUG_APDU)
|
||||
pri_message(pri, "Do not handle argument of type 0x%X\n", choice->type);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/* ===== Call Transfer Supplementary Service (ECMA-178) ===== */
|
||||
|
||||
static int rose_party_number_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value)
|
||||
@@ -2281,7 +2034,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 reject on switchtype %d!\n", pri->switchtype);
|
||||
pri_message(pri, "Unable to handle return result on switchtype %d!\n", pri->switchtype);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2344,7 +2097,8 @@ 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 error on switchtype %d!\n", pri->switchtype);
|
||||
pri_message(pri, "Unable to handle return result on switchtype %d!\n", pri->switchtype);
|
||||
return -1;
|
||||
}
|
||||
|
||||
} while(0);
|
||||
@@ -2404,12 +2158,6 @@ int rose_return_result_decode(struct pri *pri, q931_call *call, q931_ie *ie, uns
|
||||
pri_message(pri, "Could not parse invoke of type 0x%x!\n", invokeidvalue);
|
||||
return -1;
|
||||
}
|
||||
} else if (pri->switchtype == PRI_SWITCH_QSIG) {
|
||||
switch (invokeidvalue) {
|
||||
case 0x13:
|
||||
if (pri->debug & PRI_DEBUG_APDU) pri_message(pri, "Successfully completed QSIG CF callRerouting!\n");
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
pri_message(pri, "Unable to handle return result on switchtype %d!\n", pri->switchtype);
|
||||
return -1;
|
||||
@@ -2461,7 +2209,19 @@ int rose_invoke_decode(struct pri *pri, q931_call *call, q931_ie *ie, unsigned c
|
||||
case SS_CNID_CALLINGNAME:
|
||||
if (pri->debug & PRI_DEBUG_APDU)
|
||||
pri_message(pri, " Handle Name display operation\n");
|
||||
return rose_calling_name_decode(pri, call, comp, len-i);
|
||||
switch (comp->type) {
|
||||
case ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE:
|
||||
memcpy(call->callername, comp->data, comp->len);
|
||||
call->callername[comp->len] = 0;
|
||||
if (pri->debug & PRI_DEBUG_APDU)
|
||||
pri_message(pri, " Received caller name '%s'\n", call->callername);
|
||||
return 0;
|
||||
default:
|
||||
if (pri->debug & PRI_DEBUG_APDU)
|
||||
pri_message(pri, "Do not handle argument of type 0x%X\n", comp->type);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
case ROSE_CALL_TRANSFER_IDENTIFY:
|
||||
if (pri->debug & PRI_DEBUG_APDU)
|
||||
pri_message(pri, "ROSE %i: CallTransferIdentify - not handled!\n", operation_tag);
|
||||
@@ -2507,10 +2267,8 @@ int rose_invoke_decode(struct pri *pri, q931_call *call, q931_ie *ie, unsigned c
|
||||
dump_apdu (pri, (u_int8_t *)comp, comp->len + 2);
|
||||
return -1;
|
||||
case ROSE_DIVERTING_LEG_INFORMATION2:
|
||||
if (pri->debug & PRI_DEBUG_APDU) {
|
||||
pri_message(pri, "ROSE %i: Handle CallingName\n", operation_tag);
|
||||
dump_apdu (pri, (u_int8_t *)comp, comp->len + 2);
|
||||
}
|
||||
if (pri->debug & PRI_DEBUG_APDU)
|
||||
pri_message(pri, " Handle DivertingLegInformation2\n");
|
||||
return rose_diverting_leg_information2_decode(pri, call, comp, len-i);
|
||||
case ROSE_AOC_NO_CHARGING_INFO_AVAILABLE:
|
||||
if (pri->debug & PRI_DEBUG_APDU) {
|
||||
|
||||
@@ -41,10 +41,7 @@
|
||||
/* Argument values */
|
||||
#define ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE 0x80
|
||||
#define ROSE_NAME_PRESENTATION_RESTRICTED_NULL 0x87
|
||||
#define ROSE_NAME_PRESENTATION_ALLOWED_EXTENDED 0xA1
|
||||
#define ROSE_NAME_PRESENTATION_RESTRICTED_SIMPLE 0xA2
|
||||
#define ROSE_NAME_PRESENTATION_RESTRICTED_EXTENDED 0xA3
|
||||
#define ROSE_NAME_NOT_AVAIL 0x84
|
||||
#define ROSE_NAME_NOT_AVAIL 0x84
|
||||
|
||||
/* Component types */
|
||||
#define COMP_TYPE_INTERPRETATION 0x8B
|
||||
@@ -309,10 +306,8 @@ int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
|
||||
|
||||
int rlt_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
|
||||
|
||||
int qsig_cf_callrerouting(struct pri *pri, q931_call *c, const char* dest, const char* original, const char* reason);
|
||||
|
||||
/* starts a QSIG Path Replacement */
|
||||
int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
|
||||
extern int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
|
||||
|
||||
/* Use this function to queue a facility-IE born APDU onto a call
|
||||
* call is the call to use, messagetype is any one of the Q931 messages,
|
||||
|
||||
@@ -114,9 +114,6 @@ struct pri {
|
||||
/* do we do overlap dialing */
|
||||
int overlapdial;
|
||||
|
||||
/* do not skip channel 16 */
|
||||
int chan_mapping_logical;
|
||||
|
||||
#ifdef LIBPRI_COUNTERS
|
||||
/* q921/q931 packet counters */
|
||||
unsigned int q921_txcount;
|
||||
|
||||
@@ -256,8 +256,6 @@ extern int q931_receive(struct pri *pri, q931_h *h, int len);
|
||||
|
||||
extern int q931_alerting(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
extern int q931_call_progress_with_cause(struct pri *pri, q931_call *call, int channel, int info, int cause);
|
||||
|
||||
extern int q931_call_progress(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
extern int q931_notify(struct pri *pri, q931_call *call, int channel, int info);
|
||||
|
||||
300
q921.c
300
q921.c
@@ -56,7 +56,6 @@
|
||||
} while(0)
|
||||
|
||||
static void reschedule_t203(struct pri *pri);
|
||||
static void reschedule_t200(struct pri *pri);
|
||||
static void q921_restart(struct pri *pri, int now);
|
||||
static void q921_tei_release_and_reacquire(struct pri *master);
|
||||
|
||||
@@ -98,6 +97,7 @@ static int q921_transmit(struct pri *pri, q921_h *h, int len)
|
||||
pri_error(pri, "Short write: %d/%d (%s)\n", res, len + 2, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
reschedule_t203(pri);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -238,6 +238,21 @@ static int q921_ack_packet(struct pri *pri, int num)
|
||||
pri->retrans = 0;
|
||||
/* Decrement window size */
|
||||
pri->windowlen--;
|
||||
/* Search for something to send */
|
||||
f = pri->txqueue;
|
||||
while(f) {
|
||||
if (!f->transmitted) {
|
||||
/* Send it now... */
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Finally transmitting %d, since window opened up\n", f->h.n_s);
|
||||
f->transmitted++;
|
||||
pri->windowlen++;
|
||||
f->h.n_r = pri->v_r;
|
||||
q921_transmit(pri, (q921_h *)(&f->h), f->len);
|
||||
break;
|
||||
}
|
||||
f = f->next;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
prev = f;
|
||||
@@ -250,45 +265,18 @@ static void t203_expire(void *);
|
||||
static void t200_expire(void *);
|
||||
static pri_event *q921_dchannel_down(struct pri *pri);
|
||||
|
||||
static void reschedule_t200(struct pri *pri)
|
||||
{
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Restarting T200 timer\n");
|
||||
if (pri->t200_timer)
|
||||
pri_schedule_del(pri, pri->t200_timer);
|
||||
pri->t200_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri);
|
||||
}
|
||||
|
||||
static void reschedule_t203(struct pri *pri)
|
||||
{
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Restarting T203 timer\n");
|
||||
if (pri->t203_timer)
|
||||
if (pri->t203_timer) {
|
||||
pri_schedule_del(pri, pri->t203_timer);
|
||||
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;
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Restarting T203 counter\n");
|
||||
/* Nothing to transmit, start the T203 counter instead */
|
||||
pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri);
|
||||
}
|
||||
}
|
||||
|
||||
static pri_event *q921_ack_rx(struct pri *pri, int ack, int send_untransmitted_frames)
|
||||
static pri_event *q921_ack_rx(struct pri *pri, int ack)
|
||||
{
|
||||
int x;
|
||||
int cnt=0;
|
||||
@@ -312,10 +300,8 @@ static pri_event *q921_ack_rx(struct pri *pri, int ack, int send_untransmitted_f
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Since there was nothing left, stopping T200 counter\n");
|
||||
/* Something was ACK'd. Stop T200 counter */
|
||||
if (pri->t200_timer) {
|
||||
pri_schedule_del(pri, pri->t200_timer);
|
||||
pri->t200_timer = 0;
|
||||
}
|
||||
pri_schedule_del(pri, pri->t200_timer);
|
||||
pri->t200_timer = 0;
|
||||
}
|
||||
if (pri->t203_timer) {
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
@@ -325,14 +311,10 @@ static pri_event *q921_ack_rx(struct pri *pri, int ack, int send_untransmitted_f
|
||||
}
|
||||
if (pri->txqueue) {
|
||||
/* Something left to transmit, Start the T200 counter again if we stopped it */
|
||||
if (!pri->busy && send_untransmitted_frames) {
|
||||
pri->retrans = 0;
|
||||
/* Search for something to send */
|
||||
q921_send_queued_iframes(pri);
|
||||
}
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Waiting for acknowledge, restarting T200 counter\n");
|
||||
reschedule_t200(pri);
|
||||
pri_message(pri, "-- Something left to transmit (%d), restarting T200 counter\n", pri->txqueue->h.n_s);
|
||||
if (!pri->t200_timer)
|
||||
pri->t200_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri);
|
||||
} else {
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Nothing left, starting T203 counter\n");
|
||||
@@ -402,16 +384,20 @@ static void q921_rr(struct pri *pri, int pbit, int cmd) {
|
||||
static void t200_expire(void *vpri)
|
||||
{
|
||||
struct pri *pri = vpri;
|
||||
q921_frame *f, *lastframe=NULL;
|
||||
|
||||
if (pri->txqueue) {
|
||||
/* Retransmit first packet in the queue, setting the poll bit */
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- T200 counter expired, What to do...\n");
|
||||
/* Force Poll bit */
|
||||
pri->txqueue->h.p_f = 1;
|
||||
/* Update nr */
|
||||
pri->txqueue->h.n_r = pri->v_r;
|
||||
pri->v_na = pri->v_r;
|
||||
pri->solicitfbit = 1;
|
||||
pri->retrans++;
|
||||
/* Up to three retransmissions */
|
||||
if (pri->retrans < pri->timers[PRI_TIMER_N200]) {
|
||||
pri->retrans++;
|
||||
/* Reschedule t200_timer */
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Retransmitting %d bytes\n", pri->txqueue->len);
|
||||
@@ -420,19 +406,7 @@ static void t200_expire(void *vpri)
|
||||
else {
|
||||
if (!pri->txqueue->transmitted)
|
||||
pri_error(pri, "!! Not good - head of queue has not been transmitted yet\n");
|
||||
/*Actually we need to retransmit the last transmitted packet, setting the poll bit */
|
||||
for (f=pri->txqueue; f; f = f->next) {
|
||||
if (f->transmitted)
|
||||
lastframe = f;
|
||||
}
|
||||
if (lastframe) {
|
||||
/* Force Poll bit */
|
||||
lastframe->h.p_f = 1;
|
||||
/* Update nr */
|
||||
lastframe->h.n_r = pri->v_r;
|
||||
pri->v_na = pri->v_r;
|
||||
q921_transmit(pri, (q921_h *)&lastframe->h, lastframe->len);
|
||||
}
|
||||
q921_transmit(pri, (q921_h *)&pri->txqueue->h, pri->txqueue->len);
|
||||
}
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Rescheduling retransmission (%d)\n", pri->retrans);
|
||||
@@ -444,20 +418,15 @@ static void t200_expire(void *vpri)
|
||||
pri_message(pri, DBGHEAD "q921_state now is Q921_LINK_CONNECTION_RELEASED\n",DBGINFO);
|
||||
pri->q921_state = Q921_LINK_CONNECTION_RELEASED;
|
||||
pri->t200_timer = 0;
|
||||
if (pri->bri && pri->master) {
|
||||
q921_tei_release_and_reacquire(pri->master);
|
||||
return;
|
||||
} else {
|
||||
q921_dchannel_down(pri);
|
||||
q921_start(pri, 1);
|
||||
pri->schedev = 1;
|
||||
}
|
||||
q921_dchannel_down(pri);
|
||||
q921_start(pri, 1);
|
||||
pri->schedev = 1;
|
||||
}
|
||||
} else if (pri->solicitfbit) {
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Retrying poll with f-bit\n");
|
||||
pri->retrans++;
|
||||
if (pri->retrans < pri->timers[PRI_TIMER_N200]) {
|
||||
pri->retrans++;
|
||||
pri->solicitfbit = 1;
|
||||
q921_rr(pri, 1, 1);
|
||||
pri->t200_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri);
|
||||
@@ -521,7 +490,7 @@ 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->q921_state == Q921_LINK_CONNECTION_ESTABLISHED) && (!pri->retrans && !pri->busy)) {
|
||||
if (!pri->retrans && !pri->busy) {
|
||||
if (pri->windowlen < pri->window) {
|
||||
pri->windowlen++;
|
||||
q921_transmit(pri, (q921_h *)(&f->h), f->len);
|
||||
@@ -538,14 +507,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;
|
||||
}
|
||||
|
||||
/* 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->t200_timer) {
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "Starting T_200 timer\n");
|
||||
|
||||
reschedule_t200(pri);
|
||||
}
|
||||
pri->t200_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T200], t200_expire, pri);
|
||||
} else
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "T_200 timer already going (%d)\n", pri->t200_timer);
|
||||
|
||||
} else {
|
||||
pri_error(pri, "!! Out of memory for Q.921 transmit\n");
|
||||
return -1;
|
||||
@@ -571,26 +540,25 @@ static void t203_expire(void *vpri)
|
||||
pri->t203_timer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static pri_event *q921_handle_iframe(struct pri *pri, q921_i *i, int len)
|
||||
{
|
||||
int res;
|
||||
pri_event *ev;
|
||||
|
||||
pri->solicitfbit = 0;
|
||||
/* Make sure this is a valid packet */
|
||||
if (i->n_s == pri->v_r) {
|
||||
/* Increment next expected I-frame */
|
||||
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);
|
||||
if (ev)
|
||||
return ev;
|
||||
if (i->p_f) {
|
||||
/* If the Poll/Final bit is set, immediate send the RR */
|
||||
q921_rr(pri, 1, 0);
|
||||
} else if (pri->busy || pri->retrans) {
|
||||
q921_rr(pri, 0, 0);
|
||||
} else if (pri->busy) {
|
||||
q921_rr(pri, 0, 0);
|
||||
}
|
||||
/* Receive Q.931 data */
|
||||
res = q931_receive(pri, (q931_h *)i->data, len - 4);
|
||||
@@ -654,7 +622,6 @@ void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx)
|
||||
direction_tag,
|
||||
h->h.tei,
|
||||
h->h.ea2);
|
||||
|
||||
switch (h->h.data[0] & Q921_FRAMETYPE_MASK) {
|
||||
case 0:
|
||||
case 2:
|
||||
@@ -745,48 +712,13 @@ void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx)
|
||||
len - 3);
|
||||
break;
|
||||
};
|
||||
|
||||
if ((h->u.ft == 3) && (h->u.m3 == 0) && (h->u.m2 == 0) && (h->u.data[0] == 0x0f)) {
|
||||
int ri;
|
||||
int tei;
|
||||
|
||||
ri = (h->u.data[1] << 8) | h->u.data[2];
|
||||
tei = (h->u.data[4] >> 1);
|
||||
/* TEI assignment related */
|
||||
switch (h->u.data[3]) {
|
||||
case Q921_TEI_IDENTITY_REQUEST:
|
||||
type = "TEI Identity Request";
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_ASSIGNED:
|
||||
type = "TEI Identity Assigned";
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_CHECK_REQUEST:
|
||||
type = "TEI Identity Check Request";
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_REMOVE:
|
||||
type = "TEI Identity Remove";
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_DENIED:
|
||||
type = "TEI Identity Denied";
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_CHECK_RESPONSE:
|
||||
type = "TEI Identity Check Response";
|
||||
break;
|
||||
case Q921_TEI_IDENTITY_VERIFY:
|
||||
type = "TEI Identity Verify";
|
||||
break;
|
||||
default:
|
||||
type = "Unknown";
|
||||
break;
|
||||
}
|
||||
pri_message(pri, "%c MDL Message: %s (%d)\n", direction_tag, type, h->u.data[3]);
|
||||
pri_message(pri, "%c RI: %d\n", direction_tag, ri);
|
||||
pri_message(pri, "%c Ai: %d E:%d\n", direction_tag, (h->u.data[4] >> 1) & 0x7f, h->u.data[4] & 1);
|
||||
}
|
||||
}
|
||||
|
||||
static pri_event *q921_dchannel_up(struct pri *pri)
|
||||
{
|
||||
/* Reset counters, etc */
|
||||
q921_reset(pri);
|
||||
|
||||
/* Stop any SABME retransmissions */
|
||||
if (pri->sabme_timer) {
|
||||
pri_schedule_del(pri, pri->sabme_timer);
|
||||
@@ -807,8 +739,6 @@ 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;
|
||||
@@ -953,18 +883,6 @@ static pri_event *q921_receive_MDL(struct pri *pri, q921_u *h, int len)
|
||||
return NULL; /* Do we need to return something??? */
|
||||
}
|
||||
|
||||
static int is_command(struct pri *pri, q921_h *h)
|
||||
{
|
||||
int command =0;
|
||||
int c_r = h->s.h.c_r;
|
||||
|
||||
if ((pri->localtype == PRI_NETWORK && c_r == 0) ||
|
||||
(pri->localtype == PRI_CPE && c_r == 1))
|
||||
command = 1;
|
||||
|
||||
return( command );
|
||||
}
|
||||
|
||||
static pri_event *__q921_receive_qualified(struct pri *pri, q921_h *h, int len)
|
||||
{
|
||||
q921_frame *f;
|
||||
@@ -999,98 +917,74 @@ static pri_event *__q921_receive_qualified(struct pri *pri, q921_h *h, int len)
|
||||
/* Receiver Ready */
|
||||
pri->busy = 0;
|
||||
/* Acknowledge frames as necessary */
|
||||
ev = q921_ack_rx(pri, h->s.n_r, 1);
|
||||
ev = q921_ack_rx(pri, h->s.n_r);
|
||||
if (ev)
|
||||
return ev;
|
||||
if (is_command(pri, h))
|
||||
pri->solicitfbit = 0;
|
||||
if (h->s.p_f) {
|
||||
/* If it's a p/f one then send back a RR in return with the p/f bit set */
|
||||
if (!is_command(pri, h)) {
|
||||
if (pri->solicitfbit) {
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Got RR response to our frame\n");
|
||||
pri->retrans = 0;
|
||||
} else {
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "-- Unsolicited RR with P/F bit, responding\n");
|
||||
q921_rr(pri, 1, 0);
|
||||
}
|
||||
pri->solicitfbit = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* Receiver not ready */
|
||||
if (pri->debug & PRI_DEBUG_Q921_STATE)
|
||||
pri_message(pri, "-- Got receiver not ready\n");
|
||||
if(h->s.p_f) {
|
||||
/* Send RR if poll bit set */
|
||||
q921_rr(pri, h->s.p_f, 0);
|
||||
}
|
||||
pri->busy = 1;
|
||||
ev = q921_ack_rx(pri, h->s.n_r, 0);
|
||||
if (ev)
|
||||
return ev;
|
||||
if (h->s.p_f && is_command(pri, h))
|
||||
q921_rr(pri, 1, 0);
|
||||
pri->solicitfbit = 1;
|
||||
pri->retrans = 0;
|
||||
if (pri->t203_timer) {
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "Stopping T_203 timer\n");
|
||||
pri_schedule_del(pri, pri->t203_timer);
|
||||
pri->t203_timer = 0;
|
||||
}
|
||||
if (pri->debug & PRI_DEBUG_Q921_DUMP)
|
||||
pri_message(pri, "Restarting T_200 timer\n");
|
||||
reschedule_t200(pri);
|
||||
break;
|
||||
case 2:
|
||||
/* Just retransmit */
|
||||
if (pri->debug & PRI_DEBUG_Q921_STATE)
|
||||
pri_message(pri, "-- Got reject requesting packet %d... Retransmitting.\n", h->s.n_r);
|
||||
if (pri->busy && !is_command(pri, h))
|
||||
pri->solicitfbit = 0;
|
||||
pri->busy = 0;
|
||||
if (is_command(pri, h) && h->s.p_f)
|
||||
q921_rr(pri, 1, 0);
|
||||
q921_ack_rx(pri, h->s.n_r, 0);
|
||||
/*Resend only if we are in the Multiple Frame Established state or when
|
||||
we are in the Time Recovery state and received responce with bit F=1*/
|
||||
if ((pri->solicitfbit == 0) || (pri->solicitfbit && !is_command(pri, h) && h->s.p_f)) {
|
||||
pri->solicitfbit = 0;
|
||||
pri->retrans = 0;
|
||||
sendnow = 0;
|
||||
/* Resend I-frames starting from frame where f->h.n_s == h->s.n_r */
|
||||
for (f = pri->txqueue; f && (f->h.n_s != h->s.n_r); f = f->next);
|
||||
while (f) {
|
||||
sendnow = 1;
|
||||
if (f->transmitted || (!f->transmitted && (pri->windowlen < pri->window))) {
|
||||
if (pri->debug & PRI_DEBUG_Q921_STATE)
|
||||
pri_error(pri, "!! Got reject for frame %d, retransmitting frame %d now, updating n_r!\n", h->s.n_r, f->h.n_s);
|
||||
f->h.n_r = pri->v_r;
|
||||
f->h.p_f = 0;
|
||||
if (!f->transmitted && (pri->windowlen < pri->window))
|
||||
pri->windowlen++;
|
||||
q921_transmit(pri, (q921_h *)(&f->h), f->len);
|
||||
}
|
||||
f = f->next;
|
||||
}
|
||||
if (!sendnow) {
|
||||
if (pri->txqueue) {
|
||||
/* This should never happen */
|
||||
if (!h->s.p_f || h->s.n_r) {
|
||||
pri_error(pri, "!! Got reject for frame %d, but we only have others!\n", h->s.n_r);
|
||||
}
|
||||
} else {
|
||||
/* Hrm, we have nothing to send, but have been REJ'd. Reset v_a, v_s, etc */
|
||||
pri_error(pri, "!! Got reject for frame %d, but we have nothing -- resetting!\n", h->s.n_r);
|
||||
pri->v_a = h->s.n_r;
|
||||
pri->v_s = h->s.n_r;
|
||||
}
|
||||
}
|
||||
/* Reset t200 timer if it was somehow going */
|
||||
if (pri->t200_timer) {
|
||||
pri_schedule_del(pri, pri->t200_timer);
|
||||
pri->t200_timer = 0;
|
||||
}
|
||||
/* Reset and restart t203 timer */
|
||||
reschedule_t203(pri);
|
||||
}
|
||||
if (h->s.p_f) {
|
||||
/* If it has the poll bit set, send an appropriate supervisory response */
|
||||
q921_rr(pri, 1, 0);
|
||||
}
|
||||
sendnow = 0;
|
||||
/* Resend the proper I-frame */
|
||||
for(f=pri->txqueue;f;f=f->next) {
|
||||
if ((sendnow || (f->h.n_s == h->s.n_r)) && f->transmitted) {
|
||||
/* Matches the request, or follows in our window, and has
|
||||
already been transmitted. */
|
||||
sendnow = 1;
|
||||
pri_error(pri, "!! Got reject for frame %d, retransmitting frame %d now, updating n_r!\n", h->s.n_r, f->h.n_s);
|
||||
f->h.n_r = pri->v_r;
|
||||
q921_transmit(pri, (q921_h *)(&f->h), f->len);
|
||||
}
|
||||
}
|
||||
if (!sendnow) {
|
||||
if (pri->txqueue) {
|
||||
/* This should never happen */
|
||||
if (!h->s.p_f || h->s.n_r) {
|
||||
pri_error(pri, "!! Got reject for frame %d, but we only have others!\n", h->s.n_r);
|
||||
}
|
||||
} else {
|
||||
/* Hrm, we have nothing to send, but have been REJ'd. Reset v_a, v_s, etc */
|
||||
pri_error(pri, "!! Got reject for frame %d, but we have nothing -- resetting!\n", h->s.n_r);
|
||||
pri->v_a = h->s.n_r;
|
||||
pri->v_s = h->s.n_r;
|
||||
/* Reset t200 timer if it was somehow going */
|
||||
if (pri->t200_timer) {
|
||||
pri_schedule_del(pri, pri->t200_timer);
|
||||
pri->t200_timer = 0;
|
||||
}
|
||||
/* Reset and restart t203 timer */
|
||||
if (pri->t203_timer)
|
||||
pri_schedule_del(pri, pri->t203_timer);
|
||||
pri->t203_timer = pri_schedule_event(pri, pri->timers[PRI_TIMER_T203], t203_expire, pri);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pri_error(pri, "!! XXX Unknown Supervisory frame ss=0x%02x,pf=%02xnr=%02x vs=%02x, va=%02x XXX\n", h->s.ss, h->s.p_f, h->s.n_r,
|
||||
|
||||
46
q931.c
46
q931.c
@@ -345,8 +345,6 @@ static FUNC_RECV(receive_channel_id)
|
||||
pos++;
|
||||
/* Only expect a particular channel */
|
||||
call->channelno = ie->data[pos] & 0x7f;
|
||||
if (pri->chan_mapping_logical && call->channelno > 15)
|
||||
call->channelno++;
|
||||
return 0;
|
||||
}
|
||||
} else
|
||||
@@ -402,10 +400,7 @@ static FUNC_SEND(transmit_channel_id)
|
||||
ie->data[pos++] = 0x83;
|
||||
if (call->channelno > -1) {
|
||||
/* Channel number specified */
|
||||
if (pri->chan_mapping_logical && call->channelno > 16)
|
||||
ie->data[pos++] = 0x80 | (call->channelno - 1);
|
||||
else
|
||||
ie->data[pos++] = 0x80 | call->channelno;
|
||||
ie->data[pos++] = 0x80 | call->channelno;
|
||||
return pos + 2;
|
||||
}
|
||||
/* We have to send a channel map */
|
||||
@@ -825,12 +820,6 @@ 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)) {
|
||||
@@ -2742,8 +2731,6 @@ int q931_notify(struct pri *pri, q931_call *c, int channel, int info)
|
||||
#ifdef ALERTING_NO_PROGRESS
|
||||
static int call_progress_ies[] = { -1 };
|
||||
#else
|
||||
static int call_progress_with_cause_ies[] = { Q931_PROGRESS_INDICATOR, Q931_CAUSE, -1 };
|
||||
|
||||
static int call_progress_ies[] = { Q931_PROGRESS_INDICATOR, -1 };
|
||||
#endif
|
||||
|
||||
@@ -2755,7 +2742,6 @@ int q931_call_progress(struct pri *pri, q931_call *c, int channel, int info)
|
||||
channel &= 0xff;
|
||||
c->channelno = channel;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
c->progloc = LOC_PRIV_NET_LOCAL_USER;
|
||||
c->progcode = CODE_CCITT;
|
||||
@@ -2765,38 +2751,10 @@ int q931_call_progress(struct pri *pri, q931_call *c, int channel, int info)
|
||||
pri_error(pri, "XXX Progress message requested but no information is provided\n");
|
||||
c->progressmask = 0;
|
||||
}
|
||||
|
||||
c->alive = 1;
|
||||
return send_message(pri, c, Q931_PROGRESS, call_progress_ies);
|
||||
}
|
||||
|
||||
int q931_call_progress_with_cause(struct pri *pri, q931_call *c, int channel, int info, int cause)
|
||||
{
|
||||
if (channel) {
|
||||
c->ds1no = (channel & 0xff00) >> 8;
|
||||
c->ds1explicit = (channel & 0x10000) >> 16;
|
||||
channel &= 0xff;
|
||||
c->channelno = channel;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
c->progloc = LOC_PRIV_NET_LOCAL_USER;
|
||||
c->progcode = CODE_CCITT;
|
||||
c->progressmask = PRI_PROG_INBAND_AVAILABLE;
|
||||
} else {
|
||||
/* PI is mandatory IE for PROGRESS message - Q.931 3.1.8 */
|
||||
pri_error(pri, "XXX Progress message requested but no information is provided\n");
|
||||
c->progressmask = 0;
|
||||
}
|
||||
|
||||
c->cause = cause;
|
||||
c->causecode = CODE_CCITT;
|
||||
c->causeloc = LOC_PRIV_NET_LOCAL_USER;
|
||||
|
||||
c->alive = 1;
|
||||
return send_message(pri, c, Q931_PROGRESS, call_progress_with_cause_ies);
|
||||
}
|
||||
|
||||
#ifdef ALERTING_NO_PROGRESS
|
||||
static int call_proceeding_ies[] = { Q931_CHANNEL_IDENT, -1 };
|
||||
#else
|
||||
@@ -2991,7 +2949,7 @@ static int restart_ies[] = { Q931_CHANNEL_IDENT, Q931_RESTART_INDICATOR, -1 };
|
||||
int q931_restart(struct pri *pri, int channel)
|
||||
{
|
||||
struct q931_call *c;
|
||||
c = q931_getcall(pri, 0 | 0x8000, 1);
|
||||
c = q931_getcall(pri, 0 | 0x8000, 0);
|
||||
if (!c)
|
||||
return -1;
|
||||
if (!channel)
|
||||
|
||||
Reference in New Issue
Block a user