Compare commits

..

6 Commits
1.4.8 ... 1.4.5

Author SHA1 Message Date
Jason Parker
07d57d3818 Importing files for 1.4.5 release
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.5@587 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-11 16:53:35 +00:00
Jason Parker
e258c073aa Creating tag for the release of libpri-1.4.5
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.5@586 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-11 16:52:30 +00:00
Kevin P. Fleming
120f751076 Creating tag for the release of libpri-1.4.5
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.5@582 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-11 16:45:58 +00:00
Kevin P. Fleming
fccbc0649f Creating tag for the release of libpri-1.4.5
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.5@580 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-11 16:44:39 +00:00
Kevin P. Fleming
59e2d271ee Creating tag for the release of libpri-1.4.5
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.5@577 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-11 16:36:24 +00:00
Kevin P. Fleming
bc0125d4f9 Creating tag for the release of libpri-1.4.5
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.5@575 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-11 16:34:05 +00:00
21 changed files with 477 additions and 887 deletions

View File

@@ -1 +1 @@
1.4.8
1.4.5

View File

@@ -1,68 +1,3 @@
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.
2008-07-22 19:43 +0000 [r589] Kevin P. Fleming <kpfleming@digium.com>
* pri.c, pri_internal.h, q931.c, libpri.h: rename API call and
option (nothing has been released to use it yet so this should be
safe) to be more accurate in describing what it does (closes
issue #13042)
2008-07-11 Jason Parker <jparker@digium.com>
* Libpri 1.4.5 released.

View File

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

View File

@@ -31,18 +31,18 @@ elif [ -d .svn ]; then
if [ ${BRANCH} != 0 ] ; then
if [ -z ${RESULT} ] ; then
RESULT="${PART}"
RESULT="2${PART}"
else
RESULT="${RESULT}-${PART}"
RESULT="3${RESULT}-${PART}"
fi
break
fi
if [ ${TEAM} != 0 ] ; then
if [ -z ${RESULT} ] ; then
RESULT="${PART}"
RESULT="4${PART}"
else
RESULT="${RESULT}-${PART}"
RESULT="5${RESULT}-${PART}"
fi
continue
fi
@@ -64,6 +64,8 @@ elif [ -d .svn ]; then
fi
done
RESULT="libss7"
if [ ${TAG} != 0 ] ; then
echo ${RESULT}
else

View File

@@ -4,26 +4,9 @@
* 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 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.
* the GNU General Public License
*/
#ifndef _ASTERISK_COMPILER_H

View File

@@ -3,28 +3,23 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2005, Digium, Inc.
* Copyright (C) 2005, Digium
* 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, 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.
* 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.
*
* 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,30 +1,25 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@digium.com>
* Written by Mark Spencer <markster@linux-support.net>
*
* Copyright (C) 2001, Digium, Inc.
* Copyright (C) 2001, Linux Support Services, 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, 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.
* 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.
*
* 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
@@ -615,10 +610,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,18 +617,15 @@ 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);
/* Enable inband progress when a DISCONNECT is received */
void pri_set_inbanddisconnect(struct pri *pri, unsigned int enable);
/* Enable inband progress when a RELEASE is received */
void pri_set_inbandrelease(struct pri *pri, unsigned int enable);
/* Enslave a PRI to another, so they share the same call list
(and maybe some timers) */
@@ -654,8 +642,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);

125
mkdep Executable file
View File

@@ -0,0 +1,125 @@
#!/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

62
pri.c
View File

@@ -3,28 +3,23 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium, Inc.
* Copyright (C) 2001-2005, Digium
* 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, 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.
* 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.
*
* 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>
@@ -483,19 +478,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 +500,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,15 +782,9 @@ void pri_set_overlapdial(struct pri *pri,int state)
pri->overlapdial = state;
}
void pri_set_chan_mapping_logical(struct pri *pri, int state)
void pri_set_inbandrelease(struct pri *pri, unsigned int enable)
{
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);
pri->acceptinbandrelease = (enable != 0);
}
int pri_fd(struct pri *pri)
@@ -854,7 +825,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]);

View File

@@ -3,28 +3,23 @@
*
* Written by Matthew Fredrickson <creslin@digium.com>
*
* Copyright (C) 2004-2005, Digium, Inc.
* Copyright (C) 2004-2005, Digium
* 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, 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.
* 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.
*
* 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"
@@ -1186,198 +1181,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); /* add BC */
buffer[i++] = (0x03);
buffer[i++] = (0x80);
buffer[i++] = (0x90);
buffer[i++] = (0xa3);
buffer[i++] = (0x95);
buffer[i++] = (0x32);
buffer[i++] = (0x01);
buffer[i++] = (0x81);
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 +1210,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 */
@@ -1740,47 +1543,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)
@@ -2391,12 +2153,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;
@@ -2448,7 +2204,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);
@@ -2494,10 +2262,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) {

View File

@@ -7,26 +7,6 @@
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"
@@ -41,10 +21,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 +286,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,

View File

@@ -1,30 +1,25 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@digium.com>
* Written by Mark Spencer <markster@linux-support.net>
*
* Copyright (C) 2001, Digium, Inc.
* Copyright (C) 2001, Linux Support Services, 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, 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.
* 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.
*
* 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
@@ -70,7 +65,7 @@ struct pri {
int tei;
int protodisc;
unsigned int bri:1;
unsigned int acceptinbanddisconnect:1; /* Should we allow inband progress after DISCONNECT? */
unsigned int acceptinbandrelease:1; /* Should we allow inband progress after RELEASE? */
/* Q.921 State */
int q921_state;
@@ -114,9 +109,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;

View File

@@ -1,30 +1,25 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@digium.com>
* Written by Mark Spencer <markster@linux-support.net>
*
* Copyright (C) 2001, Digium, Inc.
* Copyright (C) 2001, Linux Support Services, 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, 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.
* 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.
*
* 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,30 +1,25 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@digium.com>
* Written by Mark Spencer <markster@linux-support.net>
*
* Copyright (C) 2001, Digium, Inc.
* Copyright (C) 2001, Linux Support Services, 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, 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.
* 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.
*
* 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
@@ -256,8 +251,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);

View File

@@ -1,30 +1,25 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@digium.com>
* Written by Mark Spencer <markster@linux-support.net>
*
* Copyright (C) 2001, Digium, Inc.
* Copyright (C) 2001, Linux Support Services, 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, 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.
* 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.
*
* 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,28 +3,23 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium, Inc.
* Copyright (C) 2001-2005, Digium
* 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, 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.
* 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.
*
* 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,28 +3,23 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium, Inc.
* Copyright (C) 2001-2005, Digium
* 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, 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.
* 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.
*
* 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,28 +3,23 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium, Inc.
* Copyright (C) 2001-2005, Digium
* 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, 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.
* 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.
*
* 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.
*/
/*

271
q921.c
View File

@@ -3,28 +3,23 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium, Inc.
* Copyright (C) 2001-2005, Digium
* 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, 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.
* 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.
*
* 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>
@@ -56,7 +51,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 +92,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 +233,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,30 +260,22 @@ 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);
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;
pri_event *ev;
struct q921_frame *f;
/* Make sure the ACK was within our window */
for (x=pri->v_a; (x != pri->v_s) && (x != ack); Q921_INC(x));
if (x != ack) {
@@ -293,10 +295,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)
@@ -306,27 +306,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 */
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, "-- 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");
@@ -396,16 +379,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);
@@ -414,19 +401,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);
@@ -445,8 +420,8 @@ static void t200_expire(void *vpri)
} 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);
@@ -527,9 +502,14 @@ int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr)
pri_schedule_del(pri, pri->t203_timer);
pri->t203_timer = 0;
}
if (pri->debug & PRI_DEBUG_Q921_DUMP)
pri_message(pri, "Starting T_200 timer\n");
reschedule_t200(pri);
if (!pri->t200_timer) {
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);
} else {
pri_error(pri, "!! Out of memory for Q.921 transmit\n");
return -1;
@@ -555,26 +535,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);
@@ -899,18 +878,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;
@@ -945,98 +912,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,

73
q931.c
View File

@@ -3,28 +3,23 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium, Inc.
* Copyright (C) 2001-2005, Digium
* 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, 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.
* 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.
*
* 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"
@@ -345,8 +340,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 +395,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 */
@@ -2736,8 +2726,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
@@ -2749,7 +2737,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;
@@ -2759,38 +2746,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
@@ -3823,7 +3782,7 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
/* wait for a RELEASE so that sufficient time has passed
for the inband audio to be heard */
if (pri->acceptinbanddisconnect && (c->progressmask & PRI_PROG_INBAND_AVAILABLE))
if (pri->acceptinbandrelease && (c->progressmask & PRI_PROG_INBAND_AVAILABLE))
break;
/* Return such an event */

View File

@@ -3,31 +3,25 @@
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001-2005, Digium, Inc.
* Copyright (C) 2001-2005, Digium
* 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, 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.
* 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.
*
* 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