Compare commits

..

23 Commits

Author SHA1 Message Date
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
Matthew Fredrickson
07c4195876 Add additional case where T200 expires greater than N200 times and we need to release and reacquire the TEI.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@656 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-01-09 17:58:28 +00:00
Matthew Fredrickson
40ae2a030a Add some additional debug for Q.921 MDL messages as well as fix a bug in RESTART messages on BRI
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@653 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-12-23 21:38:25 +00:00
Matthew Fredrickson
2c104c4dbd Fix a number of Q.921 bugs, found doing TBR4 compliance testing, thanks to Tzafrir, Xorcom, and co. (#12861). Thanks!
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@645 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-11-22 00:34:26 +00:00
Matthew Fredrickson
e1bfec4b1e 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.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@636 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-10-17 16:13:42 +00:00
Jason Parker
aeb5a6d284 Make install paths use libdir, like libss7
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@616 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-08-06 18:20:51 +00:00
Kevin P. Fleming
64eaca5bfa Merged revisions 610 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r610 | kpfleming | 2008-08-05 17:16:58 -0500 (Tue, 05 Aug 2008) | 2 lines

clean up license headers, and explicitly grant additional permissions when used with Asterisk

........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@611 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-08-05 22:18:12 +00:00
Kevin P. Fleming
67bc1003ab update ignore list
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@607 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-30 15:43:55 +00:00
Kevin P. Fleming
419282d399 use better version.c creation process, and better dependency tracking process too
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@606 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-30 15:39:37 +00:00
Jason Parker
9e6df1092c I believe this is what was meant. (it matches how Asterisk does it)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@602 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-29 22:47:37 +00:00
Jason Parker
1c7588ead5 libpri is not libss7 :D
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@598 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-29 22:29:11 +00:00
Kevin P. Fleming
16df54e01a correct comments to match code
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@594 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-22 22:36:25 +00:00
21 changed files with 1101 additions and 556 deletions

View File

@@ -1 +1 @@
1.4.6
1.4.10

120
ChangeLog
View File

@@ -1,3 +1,123 @@
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.
2008-08-05 22:18 +0000 [r611] Kevin P. Fleming <kpfleming@digium.com>
* pritest.c, pri.c, pri_internal.h, q921.c, q931.c, copy_string.c,
prisched.c, pri_q921.h, pri_q931.h, pri_facility.c, /,
compiler.h, pridump.c, testprilib.c, pri_timers.h,
pri_facility.h, libpri.h: Merged revisions 610 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2 ........ r610
| kpfleming | 2008-08-05 17:16:58 -0500 (Tue, 05 Aug 2008) | 2
lines clean up license headers, and explicitly grant additional
permissions when used with Asterisk ........
2008-07-30 15:43 +0000 [r606-607] Kevin P. Fleming <kpfleming@digium.com>
* /: update ignore list
* Makefile, mkdep (removed): use better version.c creation process,
and better dependency tracking process too
2008-07-29 22:47 +0000 [r598-602] Jason Parker <jparker@digium.com>
* build_tools/make_version: I believe this is what was meant. (it
matches how Asterisk does it)
* build_tools/make_version: libpri is not libss7 :D
2008-07-22 22:36 +0000 [r594] Kevin P. Fleming <kpfleming@digium.com>
* pri_internal.h, libpri.h: correct comments to match code
2008-07-22 Kevin P. Fleming <kpfleming@digium.com>
* Libpri 1.4.6 released.

View File

@@ -46,6 +46,7 @@ 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))
@@ -76,7 +77,7 @@ PROC=ultrasparc
CFLAGS += -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
endif
all: depend $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
all: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
update:
@if [ -d .svn ]; then \
@@ -96,27 +97,27 @@ update:
fi
install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/lib
mkdir -p $(INSTALL_PREFIX)$(libdir)
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)$(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
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
else
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include -m 644 libpri.h
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)
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)
endif
uninstall:
@echo "Removing Libpri"
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)$(libdir)/libpri.so.$(SONAME)
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.a
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include/libpri.h
pritest: pritest.o
@@ -131,12 +132,13 @@ testprilib: testprilib.o
pridump: pridump.o
$(CC) -o pridump pridump.o -L. -lpri $(CFLAGS)
ifneq ($(wildcard .depend),)
include .depend
endif
MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
%.lo : %.c
$(CC) $(CFLAGS) -o $@ -c $<
%.o: %.c
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
%.lo: %.c
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
$(STATIC_LIBRARY): $(STATIC_OBJS)
ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
@@ -147,7 +149,7 @@ $(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
$(LDCONFIG) $(LDCONFIG_FLAGS) .
ln -sf libpri.so.$(SONAME) libpri.so
version.c:
version.c: FORCE
@build_tools/make_version_c > $@.tmp
@cmp -s $@.tmp $@ || mv $@.tmp $@
@rm -f $@.tmp
@@ -156,11 +158,12 @@ clean:
rm -f *.o *.so *.lo *.so.$(SONAME)
rm -f testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
rm -f pritest pridump
rm -f .depend
rm -f .*.d
depend: .depend
.PHONY:
.depend:
CC="$(CC)" ./mkdep ${CFLAGS} `ls *.c`
FORCE:
.PHONY: version.c
ifneq ($(wildcard .*.d),)
include .*.d
endif

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,65 +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="2${PART}"
else
RESULT="3${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="4${PART}"
else
RESULT="5${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
RESULT="libss7"
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

@@ -4,9 +4,26 @@
* Compiler-specific macros and other items
*
* Copyright (C) 2005, Digium, Inc.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _ASTERISK_COMPILER_H

View File

@@ -3,23 +3,28 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2005, Digium
* Copyright (C) 2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#include <string.h>

View File

@@ -1,25 +1,30 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _LIBPRI_H
@@ -59,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
@@ -590,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 */
@@ -610,6 +615,10 @@ 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);
@@ -617,14 +626,17 @@ char *pri_dump_info_str(struct pri *pri);
int pri_fd(struct pri *pri);
#define PRI_PROGRESS
/* Send call proceeding */
/* Send progress */
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);
/* Enable inband progress when a RELEASE is received */
/* Enable inband progress when a DISCONNECT is received */
void pri_set_inbanddisconnect(struct pri *pri, unsigned int enable);
/* Enslave a PRI to another, so they share the same call list
@@ -642,6 +654,8 @@ 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);

125
mkdep
View File

@@ -1,125 +0,0 @@
#!/bin/sh -
#
# $OpenBSD: mkdep.gcc.sh,v 1.8 1998/09/02 06:40:07 deraadt Exp $
# $NetBSD: mkdep.gcc.sh,v 1.9 1994/12/23 07:34:59 jtc Exp $
#
# Copyright (c) 1991, 1993
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the University of
# California, Berkeley and its contributors.
# 4. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93
#
D=.depend # default dependency file is .depend
append=0
pflag=
while :
do case "$1" in
# -a appends to the depend file
-a)
append=1
shift ;;
# -f allows you to select a makefile name
-f)
D=$2
shift; shift ;;
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
pflag=p
shift ;;
*)
break ;;
esac
done
if [ $# = 0 ] ; then
echo 'usage: mkdep [-p] [-f depend_file] [cc_flags] file ...'
exit 1
fi
DTMP=/tmp/mkdep$$
TMP=$DTMP/mkdep
um=`umask`
umask 022
if ! mkdir $DTMP ; then
echo failed to create tmp dir $DTMP
exit 1
fi
umask $um
trap 'rm -rf $DTMP ; trap 2 ; kill -2 $$' 1 2 3 13 15
if [ x$pflag = x ]; then
${CC:-cc} -M "$@" 2>/dev/null | sed -e 's; \./; ;g' > $TMP
else
${CC:-cc} -M "$@" 2>/dev/null | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
fi
if [ $? != 0 ]; then
echo 'mkdep: compile failed.'
rm -rf $DTMP
exit 1
fi
if [ $append = 1 ]; then
cat $TMP >> $D
if [ $? != 0 ]; then
echo 'mkdep: append failed.'
rm -rf $DTMP
exit 1
fi
cat $TMP | sed -e 's/\.o:/.lo:/g' >>$D
if [ $? != 0 ]; then
echo 'mkdep: append failed.'
rm -rf $DTMP
exit 1
fi
else
cat $TMP > $D
if [ $? != 0 ]; then
echo 'mkdep: overwrite failed.'
rm -rf $DTMP
exit 1
fi
cat $TMP | sed -e 's/\.o:/.lo:/g' >>$D
if [ $? != 0 ]; then
echo 'mkdep: append failed.'
rm -rf $DTMP
exit 1
fi
fi
rm -rf $DTMP
exit 0

58
pri.c
View File

@@ -3,23 +3,28 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#include <unistd.h>
@@ -478,10 +483,19 @@ 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);
}
@@ -500,6 +514,15 @@ 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)
@@ -782,6 +805,12 @@ 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);
@@ -825,6 +854,7 @@ 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]);

View File

@@ -3,23 +3,28 @@
*
* Written by Matthew Fredrickson <creslin@digium.com>
*
* Copyright (C) 2004-2005, Digium
* Copyright (C) 2004-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#include "compat.h"
@@ -1181,6 +1186,198 @@ 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;
@@ -1210,7 +1407,7 @@ static int anfpr_pathreplacement_respond(struct pri *pri, q931_call *call, q931_
return 0;
}
/* AFN-PR */
extern int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
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 */
@@ -1228,7 +1425,6 @@ extern 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);
@@ -1236,6 +1432,7 @@ extern 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);
@@ -1250,15 +1447,22 @@ extern 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);
@@ -1283,7 +1487,6 @@ extern 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);
@@ -1291,6 +1494,7 @@ extern 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);
@@ -1305,15 +1509,22 @@ extern 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);
@@ -1543,6 +1754,47 @@ 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)
@@ -2029,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;
}
@@ -2092,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);
@@ -2153,6 +2404,12 @@ 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;
@@ -2204,19 +2461,7 @@ 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");
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;
return rose_calling_name_decode(pri, call, comp, len-i);
case ROSE_CALL_TRANSFER_IDENTIFY:
if (pri->debug & PRI_DEBUG_APDU)
pri_message(pri, "ROSE %i: CallTransferIdentify - not handled!\n", operation_tag);
@@ -2262,8 +2507,10 @@ 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, " Handle DivertingLegInformation2\n");
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);
}
return rose_diverting_leg_information2_decode(pri, call, comp, len-i);
case ROSE_AOC_NO_CHARGING_INFO_AVAILABLE:
if (pri->debug & PRI_DEBUG_APDU) {

View File

@@ -7,6 +7,26 @@
Copyright (C) Digium, Inc. 2004-2005
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_FACILITY_H
#define _PRI_FACILITY_H
#include "pri_q931.h"
@@ -21,7 +41,10 @@
/* Argument values */
#define ROSE_NAME_PRESENTATION_ALLOWED_SIMPLE 0x80
#define ROSE_NAME_PRESENTATION_RESTRICTED_NULL 0x87
#define ROSE_NAME_NOT_AVAIL 0x84
#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
/* Component types */
#define COMP_TYPE_INTERPRETATION 0x8B
@@ -286,8 +309,10 @@ 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 */
extern int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
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,

View File

@@ -1,25 +1,30 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_INTERNAL_H
@@ -65,7 +70,7 @@ struct pri {
int tei;
int protodisc;
unsigned int bri:1;
unsigned int acceptinbanddisconnect:1; /* Should we allow inband progress after RELEASE? */
unsigned int acceptinbanddisconnect:1; /* Should we allow inband progress after DISCONNECT? */
/* Q.921 State */
int q921_state;
@@ -109,6 +114,9 @@ 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;

View File

@@ -1,25 +1,30 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_Q921_H

View File

@@ -1,25 +1,30 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_Q931_H
@@ -251,6 +256,8 @@ 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);

View File

@@ -1,25 +1,30 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_TIMERS_H

View File

@@ -3,23 +3,28 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*

View File

@@ -3,23 +3,28 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#include <stdio.h>

View File

@@ -3,23 +3,28 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*

333
q921.c
View File

@@ -3,23 +3,28 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#include <stdio.h>
@@ -51,6 +56,7 @@
} 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);
@@ -92,7 +98,6 @@ 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;
}
@@ -233,21 +238,6 @@ 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;
@@ -260,18 +250,45 @@ 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->t203_timer) {
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "-- Restarting T203 timer\n");
if (pri->t203_timer)
pri_schedule_del(pri, pri->t203_timer);
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);
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)
static pri_event *q921_ack_rx(struct pri *pri, int ack, int send_untransmitted_frames)
{
int x;
int cnt=0;
@@ -295,8 +312,10 @@ static pri_event *q921_ack_rx(struct pri *pri, int ack)
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 */
pri_schedule_del(pri, pri->t200_timer);
pri->t200_timer = 0;
if (pri->t200_timer) {
pri_schedule_del(pri, pri->t200_timer);
pri->t200_timer = 0;
}
}
if (pri->t203_timer) {
if (pri->debug & PRI_DEBUG_Q921_DUMP)
@@ -306,10 +325,14 @@ static pri_event *q921_ack_rx(struct pri *pri, int ack)
}
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, "-- 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);
pri_message(pri, "-- Waiting for acknowledge, restarting T200 counter\n");
reschedule_t200(pri);
} else {
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "-- Nothing left, starting T203 counter\n");
@@ -379,20 +402,16 @@ 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);
@@ -401,7 +420,19 @@ 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");
q921_transmit(pri, (q921_h *)&pri->txqueue->h, pri->txqueue->len);
/*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);
}
}
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "-- Rescheduling retransmission (%d)\n", pri->retrans);
@@ -413,15 +444,20 @@ 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;
q921_dchannel_down(pri);
q921_start(pri, 1);
pri->schedev = 1;
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;
}
}
} 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);
@@ -485,7 +521,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->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);
@@ -502,14 +538,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->t200_timer) {
/* 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");
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);
reschedule_t200(pri);
}
} else {
pri_error(pri, "!! Out of memory for Q.921 transmit\n");
return -1;
@@ -535,25 +571,26 @@ 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);
ev = q921_ack_rx(pri, i->n_r, 0);
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) {
q921_rr(pri, 0, 0);
} else if (pri->busy || pri->retrans) {
q921_rr(pri, 0, 0);
}
/* Receive Q.931 data */
res = q931_receive(pri, (q931_h *)i->data, len - 4);
@@ -617,6 +654,7 @@ 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:
@@ -707,13 +745,48 @@ 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);
@@ -734,6 +807,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;
@@ -878,6 +953,18 @@ 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;
@@ -912,74 +999,98 @@ 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);
ev = q921_ack_rx(pri, h->s.n_r, 1);
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 (pri->solicitfbit) {
if (!is_command(pri, h)) {
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 (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);
}
}
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);
}
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,

79
q931.c
View File

@@ -3,23 +3,28 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#include "compat.h"
@@ -340,6 +345,8 @@ 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
@@ -395,7 +402,10 @@ static FUNC_SEND(transmit_channel_id)
ie->data[pos++] = 0x83;
if (call->channelno > -1) {
/* Channel number specified */
ie->data[pos++] = 0x80 | call->channelno;
if (pri->chan_mapping_logical && call->channelno > 16)
ie->data[pos++] = 0x80 | (call->channelno - 1);
else
ie->data[pos++] = 0x80 | call->channelno;
return pos + 2;
}
/* We have to send a channel map */
@@ -815,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)) {
@@ -2726,6 +2742,8 @@ 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
@@ -2737,6 +2755,7 @@ 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;
@@ -2746,10 +2765,38 @@ 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
@@ -2944,7 +2991,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, 0);
c = q931_getcall(pri, 0 | 0x8000, 1);
if (!c)
return -1;
if (!channel)

View File

@@ -3,25 +3,31 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*
* This program tests libpri call reception using a zaptel interface.
* Its state machines are setup for RECEIVING CALLS ONLY, so if you