Compare commits

..

4 Commits

Author SHA1 Message Date
Kevin P. Fleming
7dcf8a8906 remove CVS ignore lists
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.2.0-beta1@267 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-29 18:40:06 +00:00
Kevin P. Fleming
a468a4ea77 remove extraneous svn:executable properties
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.2.0-beta1@266 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-29 18:39:18 +00:00
Kevin P. Fleming
ef415db74a manual tag renames
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.2.0-beta1@262 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-27 04:16:28 +00:00
Admin Commit
44f6938952 This commit was manufactured by cvs2svn to create tag 'v1-2-0-beta1'.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/v1-2-0-beta1@244 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-07-27 13:14:05 +00:00
10 changed files with 81 additions and 281 deletions

View File

@@ -1 +0,0 @@
1.2.4

101
ChangeLog
View File

@@ -1,91 +1,16 @@
2006-10-17 Kevin P. Fleming <kpfleming@digium.com>
libpri 0.3.0
-- Fix talking to switch
-- Add pri dump
-- Add test application
-- Fix strncpy stuff
libpri 0.1.2
-- Added PRI_EVENT_HANGUP_ACK so you can know when the disconnect was
acknowledged
* libpri 1.2.4 Released
2006-07-28 14:44 +0000 [r368] Matt Frederickson <creslin@digium.com>
* q931.c: Make sure we send any pending facilty APDUs after we get
proceeding. (#7551)
2006-07-12 19:08 +0000 [r360] Russell Bryant <russell@digium.com>
* q931.c: ensure buffer is initialized (issue #7512, klaus3000)
2006-07-07 15:36 +0000 [r358] Matt Frederickson <creslin@digium.com>
* q931.c: Fix for #7378 (namespace collision)
2006-06-02 16:05 +0000 [r342-347] Matt Frederickson <creslin@digium.com>
* q931.c: Minor state fix. (#7269)
* q931.c: Fix for 7115 (Don't call pri_message multiple times per
line)
* q931.c: Fixes to fill in non-filled fields in libpri. (Issue
#7241) Thanks flefoll!
2006-05-30 Kevin P. Fleming <kpfleming@digium.com>
* libpri 1.2.3 Released
2006-04-30 15:17 +0000 [r332] Kevin P. Fleming <kpfleming@digium.com>
* Makefile: set LDCONFIG_FLAGS for GNU/kFreeBSD as well use the
flags during installation
2006-04-27 16:08 +0000 [r327] Matt Frederickson <creslin@digium.com>
* q931.c, libpri.h: Make sure we pass the call back in the
setup_ack
2006-04-04 15:36 +0000 [r323] Matt Frederickson <creslin@digium.com>
* Makefile: Fix for #6566 (Makefile does not honor DESTDIR)
2006-02-17 18:55 +0000 [r316] Matt Frederickson <creslin@digium.com>
* q931.c: Backport of 6480
2006-02-15 17:59 +0000 [r311] Matt O'Gorman <mogorman@digium.com>
* README: bug 6500 typo in README.
2006-02-13 23:06 +0000 [r306] Kevin P. Fleming <kpfleming@digium.com>
* pri_facility.c: suppress annoying message about unsupported
components in facility messages
2006-01-18 Russell Bryant <russell@digium.com>
* Libpri 1.2.2 Released
2006-01-17 13:43 +0000 [r291] Kevin P. Fleming <kpfleming@digium.com>
* q931.c: ensure that user-user info field in call is properly
reset when not needed
2006-01-10 20:19 +0000 [r290] Matt Frederickson <creslin@digium.com>
* Makefile: Backport of doing correct minor numbers to 1.2 (#6188)
2005-12-27 14:01 +0000 [r284] Matt Frederickson <creslin@digium.com>
* q931.c: Fix for issue #6039 backported to 1.2
2005-12-06 21:35 +0000 [r280] Matt Frederickson <creslin@digium.com>
* q921.c: Send RR as command instead of response when T200 expires
after receiving RNR.
2005-12-01 23:13 +0000 [r274] Kevin P. Fleming <kpfleming@digium.com>
* Makefile: Makefile 'update' target now supports Subversion
repositories (issue #5875)
2005-12-01 02:34 +0000 [r270] Matt Frederickson <creslin@digium.com>
* q931.c: Backport of fix from trunk. Fix broken single digit
keypad facility code.
libpri 0.1.1
-- Added PRI_DEBUG_Q931_ANOMALY flag so that certain non-error-related
messages would not be output unless specifically desired.
libpri 0.1.0
-- Initial release

View File

@@ -30,7 +30,7 @@
CC=gcc
OSARCH=$(shell uname -s)
PROC?=$(shell uname -m)
PROC=$(shell uname -m)
TOBJS=testpri.o
T2OBJS=testprilib.o
@@ -39,11 +39,9 @@ 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)
INSTALL_PREFIX=$(DESTDIR)
INSTALL_PREFIX=
INSTALL_BASE=/usr
SOFLAGS = -Wl,-hlibpri.so.1.0
LDCONFIG = /sbin/ldconfig
ifneq (,$(findstring $(OSARCH), Linux GNU/kFreeBSD))
ifeq (${OSARCH},Linux)
LDCONFIG_FLAGS=-n
else
ifeq (${OSARCH},FreeBSD)
@@ -52,11 +50,13 @@ CFLAGS += -I../zaptel -I../zapata
endif
endif
ifeq (${OSARCH},SunOS)
CFLAGS += -DSOLARIS -I../zaptel-solaris
LDCONFIG =
LDCONFIG_FLAGS = \# # Trick to comment out the period in the command below
SOSLINK = ln -sf libpri.so.1.0 libpri.so.1
#INSTALL_PREFIX = /opt/asterisk # Uncomment out to install in standard Solaris location for 3rd party code
CFLAGS += -DSOLARIS -I../zaptel-solaris -lsocket -lnsl
SOFLAGS =
LDCONFIG = echo
INSTALL_BASE = /usr/local
else
SOFLAGS = -Wl,-soname,libpri.so.1
LDCONFIG = /sbin/ldconfig
endif
#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
@@ -70,40 +70,29 @@ endif
all: depend $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
update:
@if [ -d .svn ]; then \
echo "Updating from Subversion..." ; \
svn update -q; \
elif [ -d CVS ]; then \
@if [ -d CVS ]; then \
echo "Updating from CVS..." ; \
cvs -q -z3 update -Pd; \
else \
echo "Not under version control"; \
echo "Not CVS"; \
fi
install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
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)$(INSTALL_BASE)/lib
if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then restorecon -v $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/$(DYNAMIC_LIBRARY); fi
( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.1.0 libpri.so ; ln -sf libpri.so.1.0 libpri.so.1 )
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)$(INSTALL_BASE)/lib -m 755 $(DYNAMIC_LIBRARY)
( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.1.0 libpri.so ; $(SOSLINK) )
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib -m 644 $(STATIC_LIBRARY)
endif
mkdir -p $(INSTALL_PREFIX)/$(INSTALL_BASE)/lib
mkdir -p $(INSTALL_PREFIX)/$(INSTALL_BASE)/include
install -m 644 libpri.h $(INSTALL_PREFIX)/$(INSTALL_BASE)/include
install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)/$(INSTALL_BASE)/lib
if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then restorecon -v $(INSTALL_PREFIX)/$(INSTALL_BASE)/lib/$(DYNAMIC_LIBRARY); fi
( cd $(INSTALL_PREFIX)/$(INSTALL_BASE)/lib ; ln -sf libpri.so.1 libpri.so )
install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)/$(INSTALL_BASE)/lib
$(LDCONFIG)
uninstall:
@echo "Removing Libpri"
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.so.1.0
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/libpri.so.1
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
rm -f $(INSTALL_PREFIX)/$(INSTALL_BASE)/lib/libpri.so.1.0
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
$(CC) -o pritest pritest.o -L. -lpri -lzap $(CFLAGS)
@@ -131,9 +120,7 @@ $(STATIC_LIBRARY): $(STATIC_OBJS)
$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
$(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
$(LDCONFIG) $(LDCONFIG_FLAGS) .
ln -sf libpri.so.1.0 libpri.so
ln -sf libpri.so.1.0 libpri.so.1
$(SOSLINK)
ln -sf libpri.so.1 libpri.so
clean:
rm -f *.o *.so *.lo *.so.1 *.so.1.0
@@ -144,4 +131,4 @@ clean:
depend: .depend
.depend:
CC=$(CC) ./mkdep ${CFLAGS} `ls *.c`
./mkdep ${CFLAGS} `ls *.c`

2
README
View File

@@ -1,4 +1,4 @@
libpri: An implementation of Primary Rate ISDN
libpri: An implementation of Primate Rate ISDN
Written by Mark Spencer <markster@digium.com>

View File

@@ -274,7 +274,6 @@ typedef struct pri_event_ringing {
int progress;
int progressmask;
q931_call *call;
char useruserinfo[260]; /* User->User info */
} pri_event_ringing;
typedef struct pri_event_answer {
@@ -284,7 +283,6 @@ typedef struct pri_event_answer {
int progress;
int progressmask;
q931_call *call;
char useruserinfo[260]; /* User->User info */
} pri_event_answer;
typedef struct pri_event_facname {
@@ -297,7 +295,6 @@ typedef struct pri_event_facname {
} pri_event_facname;
#define PRI_CALLINGPLANANI
#define PRI_CALLINGPLANRDNIS
typedef struct pri_event_ring {
int e;
int channel; /* Channel requested */
@@ -313,8 +310,7 @@ typedef struct pri_event_ring {
char redirectingnum[256]; /* Redirecting number */
char redirectingname[256]; /* Redirecting name */
int redirectingreason; /* Reason for redirect */
int callingplanrdnis; /* Dialing plan of Redirecting Number */
char useruserinfo[260]; /* User->User info */
char useruserinfo[256]; /* User->User info */
int flexible; /* Are we flexible with our channel selection? */
int cref; /* Call Reference Number */
int ctype; /* Call type (see PRI_TRANS_CAP_* */
@@ -326,7 +322,6 @@ typedef struct pri_event_ring {
int progressmask;
char origcalledname[256];
char origcallednum[256];
int callingplanorigcalled; /* Dialing plan of Originally Called Number */
int origredirectingreason;
} pri_event_ring;
@@ -337,7 +332,6 @@ typedef struct pri_event_hangup {
int cref;
q931_call *call; /* Opaque call pointer */
long aoc_units; /* Advise of Charge number of charged units */
char useruserinfo[260]; /* User->User info */
} pri_event_hangup;
typedef struct pri_event_restart_ack {
@@ -359,7 +353,6 @@ typedef struct pri_event_proceeding {
typedef struct pri_event_setup_ack {
int e;
int channel;
q931_call *call;
} pri_event_setup_ack;
typedef struct pri_event_notify {
@@ -491,9 +484,6 @@ extern int pri_hangup(struct pri *pri, q931_call *call, int cause);
#define PRI_DESTROYCALL
extern void pri_destroycall(struct pri *pri, q931_call *call);
#define PRI_RESTART
extern int pri_restart(struct pri *pri);
extern int pri_reset(struct pri *pri, int channel);
/* Create a new call */
@@ -523,11 +513,6 @@ extern int pri_sr_set_bearer(struct pri_sr *sr, int transmode, int userl1);
extern int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int complete);
extern int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres);
extern int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason);
#define PRI_USER_USER_TX
/* Set the user user field. Warning! don't send binary data accross this field */
extern void pri_sr_set_useruser(struct pri_sr *sr, char *userchars);
extern void pri_call_set_useruser(q931_call *sr, char *userchars);
extern int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req);

21
pri.c
View File

@@ -247,27 +247,6 @@ static struct pri *__pri_new(int fd, int node, int switchtype, struct pri *maste
return p;
}
void pri_call_set_useruser(q931_call *c, char *userchars)
{
if (userchars)
libpri_copy_string(c->useruserinfo, userchars, sizeof(c->useruserinfo));
}
void pri_sr_set_useruser(struct pri_sr *sr, char *userchars)
{
sr->useruserinfo = userchars;
}
int pri_restart(struct pri *pri)
{
/* Restart Q.921 layer */
if (pri) {
q921_reset(pri);
q921_start(pri, pri->localtype == PRI_CPE);
}
return 0;
}
struct pri *pri_new(int fd, int nodetype, int switchtype)
{
return __pri_new(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL);

View File

@@ -1136,17 +1136,13 @@ extern int rose_invoke_decode(struct pri *pri, q931_call *call, unsigned char *d
do {
/* Invoke ID stuff */
GET_COMPONENT(comp, i, vdata, len);
#if 0
CHECK_COMPONENT(comp, INVOKE_IDENTIFIER, "Don't know what to do if first ROSE component is of type 0x%x\n");
#endif
invokeid = comp;
NEXT_COMPONENT(comp, i);
/* Operation Tag */
GET_COMPONENT(comp, i, vdata, len);
#if 0
CHECK_COMPONENT(comp, ASN1_INTEGER, "Don't know what to do if second ROSE component is of type 0x%x\n");
#endif
operationid = comp;
ASN1_GET_INTEGER(comp, operation_tag);
NEXT_COMPONENT(comp, i);
@@ -1303,10 +1299,9 @@ extern int pri_call_add_standard_apdus(struct pri *pri, q931_call *call)
return 0;
if (pri->switchtype == PRI_SWITCH_QSIG) { /* For Q.SIG it does network and cpe operations */
if (call->redirectingnum[0])
rose_diverting_leg_information2_encode(pri, call);
/* FIXME: Presumably, it should only send on a redirect */
rose_diverting_leg_information2_encode(pri, call);
add_callername_facility_ies(pri, call, 1);
return 0;
}
if (pri->localtype == PRI_NETWORK) {
@@ -1317,7 +1312,6 @@ extern int pri_call_add_standard_apdus(struct pri *pri, q931_call *call)
default:
break;
}
return 0;
} else if (pri->localtype == PRI_CPE) {
switch (pri->switchtype) {
case PRI_SWITCH_NI2:
@@ -1326,7 +1320,6 @@ extern int pri_call_add_standard_apdus(struct pri *pri, q931_call *call)
default:
break;
}
return 0;
}
return 0;

View File

@@ -129,7 +129,6 @@ struct pri_sr {
int redirectingpres;
int redirectingreason;
int justsignalling;
char *useruserinfo;
};
/* Internal switch types */

2
q921.c
View File

@@ -338,7 +338,7 @@ static void t200_expire(void *vpri)
if (pri->debug & PRI_DEBUG_Q921_STATE)
pri_message(pri, "-- Retransmitting %d bytes\n", pri->txqueue->len);
if (pri->busy)
q921_rr(pri, 1, 1);
q921_rr(pri, 1, 0);
else {
if (!pri->txqueue->transmitted)
pri_error(pri, "!! Not good - head of queue has not been transmitted yet\n");

141
q931.c
View File

@@ -43,7 +43,7 @@ struct msgtype {
int mandies[MAX_MAND_IES];
};
static struct msgtype msgs[] = {
struct msgtype msgs[] = {
/* Call establishment messages */
{ Q931_ALERTING, "ALERTING" },
{ Q931_CALL_PROCEEDING, "CALL PROCEEDING" },
@@ -89,7 +89,7 @@ static struct msgtype msgs[] = {
{ NATIONAL_SERVICE_ACKNOWLEDGE, "SERVICE ACKNOWLEDGE" },
};
static struct msgtype causes[] = {
struct msgtype causes[] = {
{ PRI_CAUSE_UNALLOCATED, "Unallocated (unassigned) number" },
{ PRI_CAUSE_NO_ROUTE_TRANSIT_NET, "No route to specified transmit network" },
{ PRI_CAUSE_NO_ROUTE_DESTINATION, "No route to destination" },
@@ -136,7 +136,7 @@ static struct msgtype causes[] = {
{ PRI_CAUSE_INTERWORKING, "Interworking, unspecified" },
};
static struct msgtype facilities[] = {
struct msgtype facilities[] = {
{ PRI_NSF_SID_PREFERRED, "CPN (SID) preferred" },
{ PRI_NSF_ANI_PREFERRED, "BN (ANI) preferred" },
{ PRI_NSF_SID_ONLY, "CPN (SID) only" },
@@ -361,7 +361,7 @@ static FUNC_SEND(transmit_channel_id)
return 0;
}
if (((pri->switchtype != PRI_SWITCH_QSIG) && (call->ds1no > 0)) || call->ds1explicit) {
if ((call->ds1no > 0) || call->ds1explicit) {
/* Note that we are specifying the identifier */
ie->data[pos++] |= 0x40;
/* We need to use the Channel Identifier Present thingy. Just specify it and we're done */
@@ -736,7 +736,7 @@ char *pri_pres2str(int pres)
static void q931_get_number(unsigned char *num, int maxlen, unsigned char *src, int len)
{
if ((len < 0) || (len > maxlen - 1)) {
if (len > maxlen - 1) {
num[0] = 0;
return;
}
@@ -780,7 +780,7 @@ static FUNC_DUMP(dump_calling_party_number)
static FUNC_DUMP(dump_calling_party_subaddr)
{
unsigned char cnum[256];
q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
q931_get_number(cnum, sizeof(cnum), ie->data + 2, len - 4);
pri_message(pri, "%c Calling Sub-Address (len=%2d) [ Ext: %d Type: %s (%d) O: %d '%s' ]\n",
prefix, len, ie->data[0] >> 7,
subaddrtype2str((ie->data[0] & 0x70) >> 4), (ie->data[0] & 0x70) >> 4,
@@ -889,7 +889,7 @@ static FUNC_DUMP(dump_redirecting_subaddr)
static FUNC_RECV(receive_calling_party_subaddr)
{
/* copy digits to call->callingsubaddr */
q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 1, len - 3);
q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 2, len - 4);
return 0;
}
@@ -969,27 +969,6 @@ static FUNC_RECV(receive_user_user)
return 0;
}
static FUNC_SEND(transmit_user_user)
{
int datalen = strlen(call->useruserinfo);
if (datalen > 0) {
/* Restricted to 35 characters */
if (msgtype == Q931_USER_INFORMATION) {
if (datalen > 260)
datalen = 260;
} else {
if (datalen > 35)
datalen = 35;
}
ie->data[0] = 4; /* IA5 characters */
memcpy(&ie->data[1], call->useruserinfo, datalen);
call->useruserinfo[0] = '\0';
return datalen + 3;
}
return 0;
}
static char *prog2str(int prog)
{
static struct msgtype progs[] = {
@@ -1057,8 +1036,7 @@ static FUNC_RECV(receive_display)
static FUNC_SEND(transmit_display)
{
int i;
if ((pri->switchtype != PRI_SWITCH_NI1) && (pri->switchtype != PRI_SWITCH_QSIG)
&& *call->callername) {
if ((pri->switchtype != PRI_SWITCH_NI1) && *call->callername) {
i = 0;
if(pri->switchtype != PRI_SWITCH_EUROISDN_E1) {
ie->data[0] = 0xb1;
@@ -1382,14 +1360,12 @@ static FUNC_RECV(receive_keypad_facility)
if (ie->len == 0)
return -1;
if (ie->len > (sizeof(call->digitbuf) - 1))
mylen = (sizeof(call->digitbuf) - 1);
if (ie->len > sizeof(call->digitbuf))
mylen = sizeof(call->digitbuf);
else
mylen = ie->len;
memcpy(call->digitbuf, ie->data, mylen);
call->digitbuf[mylen] = 0;
libpri_copy_string(call->digitbuf, (char *) ie->data, mylen);
return 0;
}
@@ -1398,7 +1374,7 @@ static FUNC_DUMP(dump_display)
{
int x, y;
char *buf = malloc(len + 1);
char tmp[80] = "";
char tmp[80];
if (buf) {
x=y=0;
if ((x < ie->len) && (ie->data[x] & 0x80)) {
@@ -1907,7 +1883,7 @@ static FUNC_DUMP(dump_signal)
}
static struct ie ies[] = {
struct ie ies[] = {
/* Codeset 0 - Common */
{ 1, NATIONAL_CHANGE_STATUS, "Change Status" },
{ 0, Q931_LOCKING_SHIFT, "Locking Shift", dump_shift },
@@ -1950,7 +1926,7 @@ static struct ie ies[] = {
{ 1, Q931_IE_KEYPAD_FACILITY, "Keypad Facility", dump_keypad_facility, receive_keypad_facility },
{ 0, Q931_IE_SIGNAL, "Signal", dump_signal },
{ 1, Q931_IE_SWITCHHOOK, "Switch-hook" },
{ 1, Q931_IE_USER_USER, "User-User", dump_user_user, receive_user_user, transmit_user_user },
{ 1, Q931_IE_USER_USER, "User-User", dump_user_user, receive_user_user },
{ 1, Q931_IE_ESCAPE_FOR_EXT, "Escape for Extension" },
{ 1, Q931_IE_CALL_STATUS, "Call Status" },
{ 1, Q931_IE_CHANGE_STATUS, "Change Status" },
@@ -2070,17 +2046,15 @@ static inline void q931_dumpie(struct pri *pri, int codeset, q931_ie *ie, char p
unsigned int x;
int full_ie = Q931_FULL_IE(codeset, ie->ie);
int base_ie;
char *buf = malloc(ielen(ie) * 3 + 1);
int buflen = 0;
buf[0] = '\0';
pri_message(NULL, "%c [", prefix);
pri_message(NULL, "%02x", ie->ie);
if (!(ie->ie & 0x80)) {
buflen += sprintf(buf, " %02x", ielen(ie)-2);
pri_message(NULL, " %02x", ielen(ie)-2);
for (x = 0; x + 2 < ielen(ie); ++x)
buflen += sprintf(buf + buflen, " %02x", ie->data[x]);
pri_message(NULL, " %02x", ie->data[x]);
}
pri_message(pri, "%c [%02x%s]\n", prefix, ie->ie, buf);
free(buf);
pri_message(NULL, "]\n");
/* Special treatment for shifts */
if((full_ie & 0xf0) == Q931_LOCKING_SHIFT)
@@ -2529,7 +2503,7 @@ int q931_call_proceeding(struct pri *pri, q931_call *c, int channel, int info)
return send_message(pri, c, Q931_CALL_PROCEEDING, call_proceeding_ies);
}
#ifndef ALERTING_NO_PROGRESS
static int alerting_ies[] = { Q931_PROGRESS_INDICATOR, Q931_IE_USER_USER, -1 };
static int alerting_ies[] = { Q931_PROGRESS_INDICATOR, -1 };
#else
static int alerting_ies[] = { -1 };
#endif
@@ -2608,11 +2582,9 @@ static void pri_release_finaltimeout(void *data)
pri->schedev = 1;
pri->ev.e = PRI_EVENT_HANGUP_ACK;
pri->ev.hangup.channel = c->channelno;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.cref = c->cr;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.call = c;
pri->ev.hangup.aoc_units = c->aoc_units;
libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
q931_hangup(pri, c, c->cause);
}
@@ -2642,10 +2614,7 @@ int q931_connect(struct pri *pri, q931_call *c, int channel, int nonisdn)
c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
} else
c->progressmask = 0;
if (pri->localtype == PRI_CPE)
c->ourcallstate = Q931_CALL_STATE_CONNECT_REQUEST;
else
c->ourcallstate = Q931_CALL_STATE_ACTIVE;
c->ourcallstate = Q931_CALL_STATE_CONNECT_REQUEST;
c->peercallstate = Q931_CALL_STATE_ACTIVE;
c->alive = 1;
/* Setup timer */
@@ -2657,7 +2626,7 @@ int q931_connect(struct pri *pri, q931_call *c, int channel, int nonisdn)
return send_message(pri, c, Q931_CONNECT, connect_ies);
}
static int release_ies[] = { Q931_CAUSE, Q931_IE_USER_USER, -1 };
static int release_ies[] = { Q931_CAUSE, -1 };
int q931_release(struct pri *pri, q931_call *c, int cause)
{
@@ -2705,7 +2674,7 @@ int q931_restart(struct pri *pri, int channel)
return send_message(pri, c, Q931_RESTART, restart_ies);
}
static int disconnect_ies[] = { Q931_CAUSE, Q931_IE_USER_USER, -1 };
static int disconnect_ies[] = { Q931_CAUSE, -1 };
int q931_disconnect(struct pri *pri, q931_call *c, int cause)
{
@@ -2725,7 +2694,7 @@ 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,
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_SENDING_COMPLETE, Q931_IE_ORIGINATING_LINE_INFO, Q931_IE_GENERIC_DIGITS, -1 };
static int gr303_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 };
@@ -2803,11 +2772,6 @@ int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
} else
return -1;
if (req->useruserinfo)
libpri_copy_string(c->useruserinfo, req->useruserinfo, sizeof(c->useruserinfo));
else
c->useruserinfo[0] = '\0';
if (req->nonisdn && (pri->switchtype == PRI_SWITCH_NI2))
c->progressmask = PRI_PROG_CALLER_NOT_ISDN;
else
@@ -2832,7 +2796,7 @@ int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
}
static int release_complete_ies[] = { Q931_IE_USER_USER, -1 };
static int release_complete_ies[] = { -1 };
static int q931_release_complete(struct pri *pri, q931_call *c, int cause)
{
@@ -3053,7 +3017,6 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
case Q931_CONNECT:
case Q931_ALERTING:
case Q931_PROGRESS:
c->useruserinfo[0] = '\0';
c->cause = -1;
case Q931_CALL_PROCEEDING:
c->progress = -1;
@@ -3073,13 +3036,11 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
if (c->retranstimer)
pri_schedule_del(pri, c->retranstimer);
c->retranstimer = 0;
c->useruserinfo[0] = '\0';
break;
case Q931_RELEASE_COMPLETE:
if (c->retranstimer)
pri_schedule_del(pri, c->retranstimer);
c->retranstimer = 0;
c->useruserinfo[0] = '\0';
case Q931_STATUS:
c->cause = -1;
c->causecode = -1;
@@ -3091,7 +3052,6 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
c->channelno = -1;
break;
case Q931_INFORMATION:
c->callednum[0] = '\0';
break;
case Q931_STATUS_ENQUIRY:
break;
@@ -3250,8 +3210,6 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
pri->ev.ring.callingpres = c->callerpres;
pri->ev.ring.callingplan = c->callerplan;
pri->ev.ring.callingplanani = c->callerplanani;
pri->ev.ring.callingplanrdnis = c->redirectingplan;
pri->ev.ring.callingplanorigcalled = c->origcalledplan;
pri->ev.ring.ani2 = c->ani2;
libpri_copy_string(pri->ev.ring.callingani, c->callerani, sizeof(pri->ev.ring.callingani));
libpri_copy_string(pri->ev.ring.callingnum, c->callernum, sizeof(pri->ev.ring.callingnum));
@@ -3261,10 +3219,9 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
libpri_copy_string(pri->ev.ring.callednum, c->callednum, sizeof(pri->ev.ring.callednum));
libpri_copy_string(pri->ev.ring.origcalledname, c->origcalledname, sizeof(pri->ev.ring.origcalledname));
libpri_copy_string(pri->ev.ring.origcallednum, c->origcallednum, sizeof(pri->ev.ring.origcallednum));
libpri_copy_string(pri->ev.ring.redirectingnum, c->redirectingnum, sizeof(pri->ev.ring.redirectingnum));
libpri_copy_string(pri->ev.ring.redirectingname, c->redirectingname, sizeof(pri->ev.ring.redirectingname));
libpri_copy_string(pri->ev.ring.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo));
c->useruserinfo[0] = '\0';
libpri_copy_string(pri->ev.ring.redirectingnum, c->redirectingnum, sizeof(pri->ev.ring.redirectingnum));
libpri_copy_string(pri->ev.ring.redirectingname, c->redirectingname, sizeof(pri->ev.ring.redirectingname));
libpri_copy_string(pri->ev.ring.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo));
pri->ev.ring.redirectingreason = c->redirectingreason;
pri->ev.ring.origredirectingreason = c->origredirectingreason;
pri->ev.ring.flexible = ! (c->chanflags & FLAG_EXCLUSIVE);
@@ -3290,8 +3247,6 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
pri->ev.ringing.call = c;
pri->ev.ringing.progress = c->progress;
pri->ev.ringing.progressmask = c->progressmask;
libpri_copy_string(pri->ev.ringing.useruserinfo, c->useruserinfo, sizeof(pri->ev.ringing.useruserinfo));
c->useruserinfo[0] = '\0';
return Q931_RES_HAVEEVENT;
case Q931_CONNECT:
if (c->newcall) {
@@ -3310,8 +3265,6 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
pri->ev.answer.call = c;
pri->ev.answer.progress = c->progress;
pri->ev.answer.progressmask = c->progressmask;
libpri_copy_string(pri->ev.answer.useruserinfo, c->useruserinfo, sizeof(pri->ev.answer.useruserinfo));
c->useruserinfo[0] = '\0';
q931_connect_acknowledge(pri, c);
if (c->justsignalling) { /* Make sure WE release when we initiatie a signalling only connection */
q931_release(pri, c, PRI_CAUSE_NORMAL_CLEARING);
@@ -3364,16 +3317,6 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
pri->ev.proceeding.progressmask = c->progressmask;
pri->ev.proceeding.cref = c->cr;
pri->ev.proceeding.call = c;
cur = c->apdus;
while (cur) {
if (!cur->sent && cur->message == Q931_FACILITY) {
q931_facility(pri, c);
break;
}
cur = cur->next;
}
return Q931_RES_HAVEEVENT;
case Q931_CONNECT_ACKNOWLEDGE:
if (c->newcall) {
@@ -3406,11 +3349,9 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
/* Workaround for S-12 ver 7.3 - it responds for invalid/non-implemented IEs at SETUP with null call state */
if (!c->sugcallstate && (c->ourcallstate != Q931_CALL_STATE_CALL_INITIATED)) {
pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.cref = c->cr;
pri->ev.hangup.call = c;
pri->ev.hangup.aoc_units = c->aoc_units;
libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
pri->ev.hangup.cref = c->cr;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.call = c;
/* Free resources */
c->ourcallstate = Q931_CALL_STATE_NULL;
c->peercallstate = Q931_CALL_STATE_NULL;
@@ -3434,12 +3375,9 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
c->ourcallstate = Q931_CALL_STATE_NULL;
c->peercallstate = Q931_CALL_STATE_NULL;
pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.cref = c->cr;
pri->ev.hangup.call = c;
pri->ev.hangup.aoc_units = c->aoc_units;
libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
c->useruserinfo[0] = '\0';
pri->ev.hangup.cref = c->cr;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.call = c;
/* Free resources */
if (c->alive) {
pri->ev.e = PRI_EVENT_HANGUP;
@@ -3469,12 +3407,10 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
c->ourcallstate = Q931_CALL_STATE_NULL;
pri->ev.e = PRI_EVENT_HANGUP;
pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.cref = c->cr;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.call = c;
pri->ev.hangup.aoc_units = c->aoc_units;
libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
c->useruserinfo[0] = '\0';
/* Don't send release complete if they send us release
while we sent it, assume a NULL state */
if (c->newcall)
@@ -3497,12 +3433,10 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
/* Return such an event */
pri->ev.e = PRI_EVENT_HANGUP_REQ;
pri->ev.hangup.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.cref = c->cr;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.call = c;
pri->ev.hangup.aoc_units = c->aoc_units;
libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.hangup.useruserinfo));
c->useruserinfo[0] = '\0';
if (c->alive)
return Q931_RES_HAVEEVENT;
else
@@ -3552,7 +3486,6 @@ int q931_receive(struct pri *pri, q931_h *h, int len)
c->peercallstate = Q931_CALL_STATE_OVERLAP_RECEIVING;
pri->ev.e = PRI_EVENT_SETUP_ACK;
pri->ev.setup_ack.channel = c->channelno | (c->ds1no << 8) | (c->ds1explicit << 16);
pri->ev.setup_ack.call = c;
cur = c->apdus;
while (cur) {