Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b13a9798dd | ||
|
|
82deae0414 | ||
|
|
e044d2f545 | ||
|
|
e77a1054a2 | ||
|
|
c53f63e1c4 | ||
|
|
268ce63ab8 | ||
|
|
a17ea8d6d5 | ||
|
|
0a095c88f1 | ||
|
|
2e5dd8ec5d | ||
|
|
6be94aed97 | ||
|
|
0e75c28513 | ||
|
|
6fb4d0ee4a | ||
|
|
8c5e372f29 |
68
ChangeLog
68
ChangeLog
@@ -1,3 +1,71 @@
|
||||
2008-08-05 Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* libpri 1.2.8 Released
|
||||
|
||||
2008-08-05 22:16 +0000 [r610] 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:
|
||||
clean up license headers, and explicitly grant additional
|
||||
permissions when used with Asterisk
|
||||
|
||||
2008-06-04 16:59 +0000 [r561] Dwayne M. Hubbard <dhubbard@digium.com>
|
||||
|
||||
* q931.c: While working on issue 3450 I noticed that the
|
||||
information channel selection field in the channel identification
|
||||
IE was displayed incorrectly when using 'pri intense debug'. I
|
||||
wanted another pair of eyes to look at the code because
|
||||
everything looked correct until Shaun Ruffell noticed the missing
|
||||
comma in the msg_chan_sel array.
|
||||
|
||||
2008-02-20 21:36 +0000 [r527] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c: Don't send a status error when we receive connect
|
||||
acknowledge during an active state
|
||||
|
||||
2008-02-18 20:31 +0000 [r521-523] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c, libpri.h: Improve transmission, receiving, and dumping of
|
||||
bearer capability IE (#11593)
|
||||
|
||||
* q931.c, libpri.h: Revert previous commit 521
|
||||
|
||||
* q931.c, libpri.h: Fix for bug #960. Better support for more
|
||||
exotic bearer capabilities
|
||||
|
||||
2008-01-11 16:33 +0000 [r513] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c: We should not be parsing further into the bearer
|
||||
capability IE if the length does not confirm that there actually
|
||||
is data present
|
||||
|
||||
2007-12-13 Russell Bryant <russell@digium.com>
|
||||
|
||||
* libpri 1.2.7 Released
|
||||
|
||||
2007-10-22 15:09 +0000 [r478] Kevin P. Fleming <kpfleming@digium.com>
|
||||
|
||||
* pri_internal.h: we need to include stddef.h for 'size_t'
|
||||
|
||||
2007-10-16 Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* libpri 1.2.6 Released
|
||||
|
||||
2007-09-25 21:33 +0000 [r467] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* q931.c: Fix user-user IE order in setup message (#10705)
|
||||
|
||||
2007-09-06 15:06 +0000 [r460] Matthew Fredrickson <creslin@digium.com>
|
||||
|
||||
* pri.c, pri_facility.c: TBCT now works. It should work for NI2,
|
||||
4E, and 5E. This code was tested on NI2.
|
||||
|
||||
2007-08-27 19:20 +0000 [r445] Jason Parker <jparker@digium.com>
|
||||
|
||||
* Makefile: Make sure we build both the static and shared modules
|
||||
with -fPIC.
|
||||
|
||||
2007-07-09 Russell Bryant <russell@digium.com>
|
||||
|
||||
* libpri 1.2.5 Released
|
||||
|
||||
4
Makefile
4
Makefile
@@ -38,7 +38,7 @@ STATIC_LIBRARY=libpri.a
|
||||
DYNAMIC_LIBRARY=libpri.so.1.0
|
||||
STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o
|
||||
DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo
|
||||
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING) $(LIBPRI_COUNTERS)
|
||||
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS)
|
||||
INSTALL_PREFIX=$(DESTDIR)
|
||||
INSTALL_BASE=/usr
|
||||
SOFLAGS = -Wl,-hlibpri.so.1.0
|
||||
@@ -122,7 +122,7 @@ include .depend
|
||||
endif
|
||||
|
||||
%.lo : %.c
|
||||
$(CC) -fPIC $(CFLAGS) -o $@ -c $<
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
$(STATIC_LIBRARY): $(STATIC_OBJS)
|
||||
ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
|
||||
|
||||
19
compiler.h
19
compiler.h
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
82
libpri.h
82
libpri.h
@@ -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
|
||||
@@ -205,6 +210,52 @@
|
||||
#define PRI_LAYER_1_V120_RATE_ADAPT 0x28
|
||||
#define PRI_LAYER_1_X31_RATE_ADAPT 0x29
|
||||
|
||||
|
||||
/* Intermediate rates for V.110 */
|
||||
#define PRI_INT_RATE_8K 1
|
||||
#define PRI_INT_RATE_16K 2
|
||||
#define PRI_INT_RATE_32K 3
|
||||
|
||||
|
||||
/* Rate adaption for bottom 5 bits of rateadaption */
|
||||
#define PRI_RATE_USER_RATE_MASK 0x1F
|
||||
#define PRI_RATE_ADAPT_UNSPEC 0x00
|
||||
#define PRI_RATE_ADAPT_0K6 0x01
|
||||
#define PRI_RATE_ADAPT_1K2 0x02
|
||||
#define PRI_RATE_ADAPT_2K4 0x03
|
||||
#define PRI_RATE_ADAPT_3K6 0x04
|
||||
#define PRI_RATE_ADAPT_4K8 0x05
|
||||
#define PRI_RATE_ADAPT_7K2 0x06
|
||||
#define PRI_RATE_ADAPT_8K 0x07
|
||||
#define PRI_RATE_ADAPT_9K6 0x08
|
||||
#define PRI_RATE_ADAPT_14K4 0x09
|
||||
#define PRI_RATE_ADAPT_16K 0x0A
|
||||
#define PRI_RATE_ADAPT_19K2 0x0B
|
||||
#define PRI_RATE_ADAPT_32K 0x0C
|
||||
#define PRI_RATE_ADAPT_38K4 0x0D
|
||||
#define PRI_RATE_ADAPT_48K 0x0E
|
||||
#define PRI_RATE_ADAPT_56K 0x0F
|
||||
#define PRI_RATE_ADAPT_57K6 0x12
|
||||
#define PRI_RATE_ADAPT_28K8 0x13
|
||||
#define PRI_RATE_ADAPT_24K 0x14
|
||||
#define PRI_RATE_ADAPT_0K1345 0x15
|
||||
#define PRI_RATE_ADAPT_0K1 0x16
|
||||
#define PRI_RATE_ADAPT_0K075_1K2 0x17
|
||||
#define PRI_RATE_ADAPT_1K2_0K075 0x18
|
||||
#define PRI_RATE_ADAPT_0K05 0x19
|
||||
#define PRI_RATE_ADAPT_0K075 0x1A
|
||||
#define PRI_RATE_ADAPT_0K110 0x1B
|
||||
#define PRI_RATE_ADAPT_0K150 0x1C
|
||||
#define PRI_RATE_ADAPT_0K200 0x1D
|
||||
#define PRI_RATE_ADAPT_0K300 0x1E
|
||||
#define PRI_RATE_ADAPT_12K 0x1F
|
||||
|
||||
/* in-band negotiation flag for rateadaption bit 5 */
|
||||
#define PRI_RATE_ADAPT_NEGOTIATION_POSS 0x20
|
||||
|
||||
/* async flag for rateadaption bit 6 */
|
||||
#define PRI_RATE_ADAPT_ASYNC 0x40
|
||||
|
||||
/* Notifications */
|
||||
#define PRI_NOTIFY_USER_SUSPENDED 0x00 /* User suspended */
|
||||
#define PRI_NOTIFY_USER_RESUMED 0x01 /* User resumed */
|
||||
@@ -510,6 +561,7 @@ extern struct timeval *pri_schedule_next(struct pri *pri);
|
||||
|
||||
/* Run any pending schedule events */
|
||||
extern pri_event *pri_schedule_run(struct pri *pri);
|
||||
extern pri_event *pri_schedule_run_tv(struct pri *pri, const struct timeval *now);
|
||||
|
||||
extern int pri_call(struct pri *pri, q931_call *c, int transmode, int channel,
|
||||
int exclusive, int nonisdn, char *caller, int callerplan, char *callername, int callerpres,
|
||||
|
||||
59
pri.c
59
pri.c
@@ -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>
|
||||
@@ -521,24 +526,30 @@ int pri_channel_bridge(q931_call *call1, q931_call *call2)
|
||||
if (!call1 || !call2)
|
||||
return -1;
|
||||
|
||||
/* Check switchtype compatibility */
|
||||
if (call1->pri->switchtype != PRI_SWITCH_LUCENT5E ||
|
||||
call2->pri->switchtype != PRI_SWITCH_LUCENT5E)
|
||||
/* Make sure we have compatible switchtypes */
|
||||
if (call1->pri->switchtype != call2->pri->switchtype)
|
||||
return -1;
|
||||
|
||||
/* Check for bearer capability */
|
||||
if (call1->transcapability != call2->transcapability)
|
||||
return -1;
|
||||
/* Check to see if calls are on the same PRI dchannel
|
||||
* Currently only support calls on the same dchannel
|
||||
*/
|
||||
|
||||
/* Check to see if we're on the same PRI */
|
||||
if (call1->pri != call2->pri)
|
||||
return -1;
|
||||
|
||||
if (eect_initiate_transfer(call1->pri, call1, call2))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
switch (call1->pri->switchtype) {
|
||||
case PRI_SWITCH_NI2:
|
||||
case PRI_SWITCH_LUCENT5E:
|
||||
case PRI_SWITCH_ATT4ESS:
|
||||
if (eect_initiate_transfer(call1->pri, call1, call2))
|
||||
return -1;
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int pri_hangup(struct pri *pri, q931_call *call, int cause)
|
||||
|
||||
@@ -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"
|
||||
@@ -859,13 +864,10 @@ extern int mwi_message_send(struct pri* pri, q931_call *call, struct pri_sr *req
|
||||
/* EECT functions */
|
||||
extern int eect_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 */
|
||||
/* TODO */
|
||||
int i = 0;
|
||||
int res = 0;
|
||||
unsigned char buffer[255] = "";
|
||||
unsigned short call_reference = c2->cr;
|
||||
short call_reference = c2->cr ^ 0x8000; /* Let's do the trickery to make sure the flag is correct */
|
||||
struct rose_component *comp = NULL, *compstk[10];
|
||||
int compsp = 0;
|
||||
static unsigned char op_tag[] = {
|
||||
@@ -878,16 +880,7 @@ extern int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2)
|
||||
0x08,
|
||||
};
|
||||
|
||||
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, 0);
|
||||
buffer[i++] = (ASN1_CONTEXT_SPECIFIC | Q932_PROTOCOL_ROSE);
|
||||
|
||||
ASN1_ADD_SIMPLE(comp, COMP_TYPE_INVOKE, buffer, i);
|
||||
ASN1_PUSH(compstk, compsp, comp);
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
/*
|
||||
* 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
|
||||
#define _PRI_INTERNAL_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
struct pri_sched {
|
||||
|
||||
35
pri_q921.h
35
pri_q921.h
@@ -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
|
||||
|
||||
35
pri_q931.h
35
pri_q931.h
@@ -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
|
||||
|
||||
35
pri_timers.h
35
pri_timers.h
@@ -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
|
||||
|
||||
33
pridump.c
33
pridump.c
@@ -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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
33
prisched.c
33
prisched.c
@@ -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>
|
||||
|
||||
33
pritest.c
33
pritest.c
@@ -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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
33
q921.c
33
q921.c
@@ -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>
|
||||
|
||||
272
q931.c
272
q931.c
@@ -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"
|
||||
@@ -399,7 +404,7 @@ static FUNC_DUMP(dump_channel_id)
|
||||
int x;
|
||||
int res = 0;
|
||||
static const char* msg_chan_sel[] = {
|
||||
"No channel selected", "B1 channel", "B2 channel","Any channel selected"
|
||||
"No channel selected", "B1 channel", "B2 channel","Any channel selected",
|
||||
"No channel selected", "As indicated in following octets", "Reserved","Any channel selected"
|
||||
};
|
||||
|
||||
@@ -528,12 +533,12 @@ static char *mode2str(int mode)
|
||||
static char *l12str(int proto)
|
||||
{
|
||||
static struct msgtype protos[] = {
|
||||
{ PRI_LAYER_1_ITU_RATE_ADAPT, "ITU Rate Adaption" },
|
||||
{ PRI_LAYER_1_ITU_RATE_ADAPT, "V.110 Rate Adaption" },
|
||||
{ PRI_LAYER_1_ULAW, "u-Law" },
|
||||
{ PRI_LAYER_1_ALAW, "A-Law" },
|
||||
{ PRI_LAYER_1_G721, "G.721 ADPCM" },
|
||||
{ PRI_LAYER_1_G722_G725, "G.722/G.725 7kHz Audio" },
|
||||
{ PRI_LAYER_1_G7XX_384K, "G.7xx 384k Video" },
|
||||
{ PRI_LAYER_1_G7XX_384K, "H.223/H.245 Multimedia" },
|
||||
{ PRI_LAYER_1_NON_ITU_ADAPT, "Non-ITU Rate Adaption" },
|
||||
{ PRI_LAYER_1_V120_RATE_ADAPT, "V.120 Rate Adaption" },
|
||||
{ PRI_LAYER_1_X31_RATE_ADAPT, "X.31 Rate Adaption" },
|
||||
@@ -544,7 +549,7 @@ static char *l12str(int proto)
|
||||
static char *ra2str(int proto)
|
||||
{
|
||||
static struct msgtype protos[] = {
|
||||
{ RATE_ADAPT_56K, "from 56kbps" },
|
||||
{ PRI_RATE_ADAPT_9K6, "9.6 kbit/s" },
|
||||
};
|
||||
return code2str(proto, protos, sizeof(protos) / sizeof(protos[0]));
|
||||
}
|
||||
@@ -565,31 +570,143 @@ static char *l32str(int proto)
|
||||
return code2str(proto, protos, sizeof(protos) / sizeof(protos[0]));
|
||||
}
|
||||
|
||||
static char *int_rate2str(int proto)
|
||||
{
|
||||
static struct msgtype protos[] = {
|
||||
{ PRI_INT_RATE_8K, "8 kbit/s" },
|
||||
{ PRI_INT_RATE_16K, "16 kbit/s" },
|
||||
{ PRI_INT_RATE_32K, "32 kbit/s" },
|
||||
};
|
||||
return code2str(proto, protos, sizeof(protos) / sizeof(protos[0]));
|
||||
}
|
||||
|
||||
static FUNC_DUMP(dump_bearer_capability)
|
||||
{
|
||||
int pos=2;
|
||||
pri_message(pri, "%c Bearer Capability (len=%2d) [ Ext: %d Q.931 Std: %d Info transfer capability: %s (%d)\n",
|
||||
prefix, len, (ie->data[0] & 0x80 ) >> 7, (ie->data[0] & 0x60) >> 5, cap2str(ie->data[0] & 0x1f), (ie->data[0] & 0x1f));
|
||||
pri_message(pri, "%c Ext: %d Trans mode/rate: %s (%d)\n", prefix, (ie->data[1] & 0x80) >> 7, mode2str(ie->data[1] & 0x7f), ie->data[1] & 0x7f);
|
||||
|
||||
/* octet 4.1 exists iff mode/rate is multirate */
|
||||
if ((ie->data[1] & 0x7f) == 0x18) {
|
||||
pri_message(pri, "%c Ext: %d Transfer rate multiplier: %d x 64\n", prefix, (ie->data[2] & 0x80) >> 7, ie->data[2] & 0x7f);
|
||||
pos++;
|
||||
}
|
||||
/* Stop here if no more */
|
||||
if (pos >= len)
|
||||
return;
|
||||
if ((ie->data[1] & 0x7f) != TRANS_MODE_PACKET) {
|
||||
/* Look for octets 5 and 5.a if present */
|
||||
pri_message(pri, "%c Ext: %d User information layer 1: %s (%d)\n", prefix, (ie->data[pos] >> 7), l12str(ie->data[pos] & 0x7f), ie->data[pos] & 0x7f);
|
||||
if ((ie->data[pos] & 0x7f) == PRI_LAYER_1_ITU_RATE_ADAPT)
|
||||
pri_message(pri, "%c Ext: %d Rate adaptatation: %s (%d)\n", prefix, ie->data[pos] >> 7, ra2str(ie->data[pos] & 0x7f), ie->data[pos] & 0x7f);
|
||||
|
||||
/* don't count the IE num and length as part of the data */
|
||||
len -= 2;
|
||||
|
||||
/* Look for octet 5; this is identified by bits 5,6 == 01 */
|
||||
if (pos < len &&
|
||||
(ie->data[pos] & 0x60) == 0x20) {
|
||||
|
||||
/* although the layer1 is only the bottom 5 bits of the byte,
|
||||
previous versions of this library passed bits 5&6 through
|
||||
too, so we have to do the same for binary compatability */
|
||||
u_int8_t layer1 = ie->data[pos] & 0x7f;
|
||||
|
||||
pri_message(pri, "%c User information layer 1: %s (%d)\n",
|
||||
prefix, l12str(layer1), layer1);
|
||||
pos++;
|
||||
} else {
|
||||
/* Look for octets 6 and 7 but not 5 and 5.a */
|
||||
pri_message(pri, "%c Ext: %d User information layer 2: %s (%d)\n", prefix, ie->data[pos] >> 7, l22str(ie->data[pos] & 0x7f), ie->data[pos] & 0x7f);
|
||||
|
||||
/* octet 5a? */
|
||||
if (pos < len && !(ie->data[pos-1] & 0x80)) {
|
||||
int ra = ie->data[pos] & 0x7f;
|
||||
|
||||
pri_message(pri, "%c Async: %d, Negotiation: %d, "
|
||||
"User rate: %s (%#x)\n",
|
||||
prefix,
|
||||
ra & PRI_RATE_ADAPT_ASYNC ? 1 : 0,
|
||||
ra & PRI_RATE_ADAPT_NEGOTIATION_POSS ? 1 : 0,
|
||||
ra2str(ra & PRI_RATE_USER_RATE_MASK),
|
||||
ra & PRI_RATE_USER_RATE_MASK);
|
||||
pos++;
|
||||
}
|
||||
|
||||
/* octet 5b? */
|
||||
if (pos < len && !(ie->data[pos-1] & 0x80)) {
|
||||
u_int8_t data = ie->data[pos];
|
||||
if (layer1 == PRI_LAYER_1_ITU_RATE_ADAPT) {
|
||||
pri_message(pri, "%c Intermediate rate: %s (%d), "
|
||||
"NIC on Tx: %d, NIC on Rx: %d, "
|
||||
"Flow control on Tx: %d, "
|
||||
"Flow control on Rx: %d\n",
|
||||
prefix, int_rate2str((data & 0x60)>>5),
|
||||
(data & 0x60)>>5,
|
||||
(data & 0x10)?1:0,
|
||||
(data & 0x08)?1:0,
|
||||
(data & 0x04)?1:0,
|
||||
(data & 0x02)?1:0);
|
||||
} else if (layer1 == PRI_LAYER_1_V120_RATE_ADAPT) {
|
||||
pri_message(pri, "%c Hdr: %d, Multiframe: %d, Mode: %d, "
|
||||
"LLI negot: %d, Assignor: %d, "
|
||||
"In-band neg: %d\n", prefix,
|
||||
(data & 0x40)?1:0,
|
||||
(data & 0x20)?1:0,
|
||||
(data & 0x10)?1:0,
|
||||
(data & 0x08)?1:0,
|
||||
(data & 0x04)?1:0,
|
||||
(data & 0x02)?1:0);
|
||||
} else {
|
||||
pri_message(pri, "%c Unknown octet 5b: 0x%x\n", data );
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
/* octet 5c? */
|
||||
if (pos < len && !(ie->data[pos-1] & 0x80)) {
|
||||
u_int8_t data = ie->data[pos];
|
||||
const char *stop_bits[] = {"?","1","1.5","2"};
|
||||
const char *data_bits[] = {"?","5","7","8"};
|
||||
const char *parity[] = {"Odd","?","Even","None",
|
||||
"zero","one","?","?"};
|
||||
|
||||
pri_message(pri, "%c Stop bits: %s, data bits: %s, "
|
||||
"parity: %s\n", prefix,
|
||||
stop_bits[(data & 0x60) >> 5],
|
||||
data_bits[(data & 0x18) >> 3],
|
||||
parity[(data & 0x7)]);
|
||||
|
||||
pos++;
|
||||
}
|
||||
|
||||
/* octet 5d? */
|
||||
if (pos < len && !(ie->data[pos-1] & 0x80)) {
|
||||
u_int8_t data = ie->data[pos];
|
||||
pri_message(pri, "%c Duplex mode: %d, modem type: %d\n",
|
||||
prefix, (data & 0x40) ? 1 : 0,data & 0x3F);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Look for octet 6; this is identified by bits 5,6 == 10 */
|
||||
if (pos < len &&
|
||||
(ie->data[pos] & 0x60) == 0x40) {
|
||||
pri_message(pri, "%c User information layer 2: %s (%d)\n",
|
||||
prefix, l22str(ie->data[pos] & 0x1f),
|
||||
ie->data[pos] & 0x1f);
|
||||
pos++;
|
||||
pri_message(pri, "%c Ext: %d User information layer 3: %s (%d)\n", prefix, ie->data[pos] >> 7, l32str(ie->data[pos] & 0x7f), ie->data[pos] & 0x7f);
|
||||
}
|
||||
|
||||
/* Look for octet 7; this is identified by bits 5,6 == 11 */
|
||||
if (pos < len && (ie->data[pos] & 0x60) == 0x60) {
|
||||
pri_message(pri, "%c User information layer 3: %s (%d)\n",
|
||||
prefix, l32str(ie->data[pos] & 0x1f),
|
||||
ie->data[pos] & 0x1f);
|
||||
pos++;
|
||||
|
||||
/* octets 7a and 7b? */
|
||||
if (pos + 1 < len && !(ie->data[pos-1] & 0x80) &&
|
||||
!(ie->data[pos] & 0x80)) {
|
||||
unsigned int proto;
|
||||
proto = ((ie->data[pos] & 0xF) << 4 ) |
|
||||
(ie->data[pos+1] & 0xF);
|
||||
|
||||
pri_message(pri, "%c Network layer: 0x%x\n", prefix,
|
||||
proto );
|
||||
pos += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -602,18 +719,44 @@ static FUNC_RECV(receive_bearer_capability)
|
||||
}
|
||||
call->transcapability = ie->data[0] & 0x1f;
|
||||
call->transmoderate = ie->data[1] & 0x7f;
|
||||
if (call->transmoderate == PRI_TRANS_CAP_AUDIO_4ESS)
|
||||
call->transmoderate = PRI_TRANS_CAP_3_1K_AUDIO;
|
||||
if (call->transmoderate != TRANS_MODE_PACKET) {
|
||||
|
||||
/* octet 4.1 exists iff mode/rate is multirate */
|
||||
if (call->transmoderate == TRANS_MODE_MULTIRATE) {
|
||||
call->transmultiple = ie->data[pos++] & 0x7f;
|
||||
}
|
||||
|
||||
/* Look for octet 5; this is identified by bits 5,6 == 01 */
|
||||
if (pos < len &&
|
||||
(ie->data[pos] & 0x60) == 0x20 ) {
|
||||
/* although the layer1 is only the bottom 5 bits of the byte,
|
||||
previous versions of this library passed bits 5&6 through
|
||||
too, so we have to do the same for binary compatability */
|
||||
call->userl1 = ie->data[pos] & 0x7f;
|
||||
if (call->userl1 == PRI_LAYER_1_ITU_RATE_ADAPT) {
|
||||
call->rateadaption = ie->data[++pos] & 0x7f;
|
||||
}
|
||||
pos++;
|
||||
} else {
|
||||
/* Get 6 and 7 */
|
||||
call->userl2 = ie->data[pos++] & 0x7f;
|
||||
call->userl3 = ie->data[pos] & 0x7f;
|
||||
|
||||
/* octet 5a? */
|
||||
if (pos < len && !(ie->data[pos-1] & 0x80)) {
|
||||
call->rateadaption = ie->data[pos] & 0x7f;
|
||||
pos++;
|
||||
}
|
||||
|
||||
/* octets 5b through 5d? */
|
||||
while (pos < len && !(ie->data[pos-1] & 0x80)) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Look for octet 6; this is identified by bits 5,6 == 10 */
|
||||
if (pos < len &&
|
||||
(ie->data[pos] & 0x60) == 0x40) {
|
||||
call->userl2 = ie->data[pos++] & 0x1f;
|
||||
}
|
||||
|
||||
/* Look for octet 7; this is identified by bits 5,6 == 11 */
|
||||
if (pos < len &&
|
||||
(ie->data[pos] & 0x60) == 0x60) {
|
||||
call->userl3 = ie->data[pos++] & 0x1f;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -621,6 +764,7 @@ static FUNC_RECV(receive_bearer_capability)
|
||||
static FUNC_SEND(transmit_bearer_capability)
|
||||
{
|
||||
int tc;
|
||||
int pos;
|
||||
|
||||
/* We are ready to transmit single IE only */
|
||||
if(order > 1)
|
||||
@@ -647,26 +791,39 @@ static FUNC_SEND(transmit_bearer_capability)
|
||||
}
|
||||
ie->data[0] = 0x80 | tc;
|
||||
ie->data[1] = call->transmoderate | 0x80;
|
||||
if ((tc & PRI_TRANS_CAP_DIGITAL)&&(pri->switchtype == PRI_SWITCH_EUROISDN_E1)) {
|
||||
/* Apparently EuroISDN switches don't seem to like user layer 2/3 */
|
||||
return 4;
|
||||
|
||||
pos = 2;
|
||||
/* octet 4.1 exists iff mode/rate is multirate */
|
||||
if (call->transmoderate == TRANS_MODE_MULTIRATE ) {
|
||||
ie->data[pos++] = call->transmultiple | 0x80;
|
||||
}
|
||||
|
||||
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)) {
|
||||
ie->data[2] = call->userl1 | 0x80; /* XXX Ext bit? XXX */
|
||||
ie->data[pos++] = call->userl1 | 0x80; /* XXX Ext bit? XXX */
|
||||
if (call->userl1 == PRI_LAYER_1_ITU_RATE_ADAPT) {
|
||||
ie->data[3] = call->rateadaption | 0x80;
|
||||
return 6;
|
||||
ie->data[pos++] = call->rateadaption | 0x80;
|
||||
}
|
||||
return 5;
|
||||
} else
|
||||
return 4;
|
||||
} else {
|
||||
ie->data[2] = 0x80 | call->userl2;
|
||||
ie->data[3] = 0x80 | call->userl3;
|
||||
return 6;
|
||||
return pos + 2;
|
||||
}
|
||||
|
||||
ie->data[pos++] = 0xa0 | (call->userl1 & 0x1f);
|
||||
|
||||
if (call->userl1 == PRI_LAYER_1_ITU_RATE_ADAPT) {
|
||||
ie->data[pos-1] &= ~0x80; /* clear EXT bit in octet 5 */
|
||||
ie->data[pos++] = call->rateadaption | 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (call->userl2 != -1)
|
||||
ie->data[pos++] = 0xc0 | (call->userl2 & 0x1f);
|
||||
|
||||
if (call->userl3 != -1)
|
||||
ie->data[pos++] = 0xe0 | (call->userl3 & 0x1f);
|
||||
|
||||
return pos + 2;
|
||||
}
|
||||
|
||||
char *pri_plan2str(int plan)
|
||||
@@ -2725,8 +2882,9 @@ int q931_disconnect(struct pri *pri, q931_call *c, int cause)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_NETWORK_SPEC_FAC, Q931_DISPLAY, Q931_IE_USER_USER,
|
||||
Q931_CALLING_PARTY_NUMBER, Q931_CALLED_PARTY_NUMBER, Q931_REDIRECTING_NUMBER, Q931_SENDING_COMPLETE, Q931_IE_ORIGINATING_LINE_INFO, Q931_IE_GENERIC_DIGITS, -1 };
|
||||
static int setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_NETWORK_SPEC_FAC, Q931_DISPLAY,
|
||||
Q931_CALLING_PARTY_NUMBER, Q931_CALLED_PARTY_NUMBER, Q931_REDIRECTING_NUMBER, Q931_IE_USER_USER, Q931_SENDING_COMPLETE,
|
||||
Q931_IE_ORIGINATING_LINE_INFO, Q931_IE_GENERIC_DIGITS, -1 };
|
||||
|
||||
static int gr303_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 };
|
||||
|
||||
@@ -2742,6 +2900,8 @@ int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
|
||||
if (!req->userl1)
|
||||
req->userl1 = PRI_LAYER_1_ULAW;
|
||||
c->userl1 = req->userl1;
|
||||
c->userl2 = -1;
|
||||
c->userl3 = -1;
|
||||
c->ds1no = (req->channel & 0xff00) >> 8;
|
||||
c->ds1explicit = (req->channel & 0x10000) >> 16;
|
||||
req->channel &= 0xff;
|
||||
@@ -3392,7 +3552,7 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
|
||||
q931_release_complete(pri,c,PRI_CAUSE_INVALID_CALL_REFERENCE);
|
||||
break;
|
||||
}
|
||||
if (c->ourcallstate != Q931_CALL_STATE_CONNECT_REQUEST) {
|
||||
if ((c->ourcallstate != Q931_CALL_STATE_CONNECT_REQUEST) && (c->ourcallstate != Q931_CALL_STATE_ACTIVE)) {
|
||||
q931_status(pri,c,PRI_CAUSE_WRONG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
||||
38
testprilib.c
38
testprilib.c
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user