Compare commits

...

25 Commits

Author SHA1 Message Date
Kevin P. Fleming
4adeac1d87 importing files for 1.2.4 release
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.2.4@379 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-10-17 22:45:09 +00:00
Kevin P. Fleming
a4bd50b8e9 Creating tag for the release of libpri-1.2.4
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.2.4@378 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-10-17 22:44:26 +00:00
Matthew Fredrickson
7e04dfc279 Make sure we send any pending facilty APDUs after we get proceeding. (#7551)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@368 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-28 14:44:15 +00:00
Russell Bryant
0dcd4a1c1e ensure buffer is initialized (issue #7512, klaus3000)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@360 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-12 19:08:31 +00:00
Matthew Fredrickson
3963b924b2 Fix for #7378 (namespace collision)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@358 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-07 15:36:50 +00:00
Matthew Fredrickson
725b07229a Minor state fix. (#7269)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@347 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-02 16:05:55 +00:00
Matthew Fredrickson
f1bf41b9f3 Fix for 7115 (Don't call pri_message multiple times per line)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@345 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-02 14:33:50 +00:00
Matthew Fredrickson
7d1f278dbe Fixes to fill in non-filled fields in libpri. (Issue #7241) Thanks flefoll!
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@342 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-01 17:57:03 +00:00
Kevin P. Fleming
33e5d26221 set LDCONFIG_FLAGS for GNU/kFreeBSD as well
use the flags during installation


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@332 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-04-30 15:17:47 +00:00
Matthew Fredrickson
856498556b Make sure we pass the call back in the setup_ack
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@327 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-04-27 16:08:39 +00:00
Matthew Fredrickson
8bf694a4f5 Fix for #6566 (Makefile does not honor DESTDIR)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@323 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-04-04 15:36:04 +00:00
Matthew Fredrickson
ff8098285c Backport of 6480
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@316 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-17 18:55:05 +00:00
Matt O'Gorman
67d7e324a1 bug 6500 typo in README.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@311 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-15 17:59:38 +00:00
Kevin P. Fleming
7c66b22563 suppress annoying message about unsupported components in facility messages
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@306 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-13 23:06:02 +00:00
Russell Bryant
1626cd29b8 remove old ChangeLog ... it will now only be in the tags
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@296 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-18 04:53:47 +00:00
Kevin P. Fleming
cbd9c37c29 ensure that user-user info field in call is properly reset when not needed
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@291 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-17 13:43:18 +00:00
Matthew Fredrickson
c3854dede0 Backport of doing correct minor numbers to 1.2 (#6188)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@290 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-10 20:19:14 +00:00
Matthew Fredrickson
29d1983e4d Fix for issue #6039 backported to 1.2
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@284 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-27 14:01:34 +00:00
Matthew Fredrickson
8fc524e6e7 Send RR as command instead of response when T200 expires after receiving RNR.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@280 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-06 21:35:50 +00:00
Kevin P. Fleming
50e2d23352 Makefile 'update' target now supports Subversion repositories (issue #5875)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@274 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-01 23:13:49 +00:00
Matthew Fredrickson
8c424cc4ff Backport of fix from trunk. Fix broken single digit keypad facility code.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@270 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-01 02:34:44 +00:00
Kevin P. Fleming
2f6aee20d9 remove extraneous svn:executable properties
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@266 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-29 18:39:18 +00:00
Kevin P. Fleming
1328ab60de remove CVS ignore list, update SVN ignore list
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@265 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-29 00:31:21 +00:00
Kevin P. Fleming
f826a6e4ad rename branches
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@261 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-27 04:14:49 +00:00
Admin Commit
4ec90f7435 This commit was manufactured by cvs2svn to create branch 'v1-2'.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/v1-2@256 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-10-25 16:59:59 +00:00
24 changed files with 170 additions and 62 deletions

View File

@@ -1,5 +0,0 @@
.depend
*.lo
libpri.so.1.0
pritest

1
.version Normal file
View File

@@ -0,0 +1 @@
1.2.4

101
ChangeLog Executable file → Normal file
View File

@@ -1,16 +1,91 @@
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
2006-10-17 Kevin P. Fleming <kpfleming@digium.com>
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 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.0
-- Initial release

0
LICENSE Executable file → Normal file
View File

22
Makefile Executable file → Normal file
View File

@@ -39,11 +39,11 @@ 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?=
INSTALL_PREFIX=$(DESTDIR)
INSTALL_BASE=/usr
SOFLAGS = -Wl,-hlibpri.so.1
SOFLAGS = -Wl,-hlibpri.so.1.0
LDCONFIG = /sbin/ldconfig
ifeq (${OSARCH},Linux)
ifneq (,$(findstring $(OSARCH), Linux GNU/kFreeBSD))
LDCONFIG_FLAGS=-n
else
ifeq (${OSARCH},FreeBSD)
@@ -70,11 +70,14 @@ endif
all: depend $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
update:
@if [ -d CVS ]; then \
@if [ -d .svn ]; then \
echo "Updating from Subversion..." ; \
svn update -q; \
elif [ -d CVS ]; then \
echo "Updating from CVS..." ; \
cvs -q -z3 update -Pd; \
else \
echo "Not CVS"; \
echo "Not under version control"; \
fi
install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
@@ -84,13 +87,13 @@ 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 libpri.so )
( 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); fi
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 libpri.so ; $(SOSLINK) )
( 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
@@ -128,7 +131,8 @@ $(STATIC_LIBRARY): $(STATIC_OBJS)
$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
$(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
$(LDCONFIG) $(LDCONFIG_FLAGS) .
ln -sf libpri.so.1 libpri.so
ln -sf libpri.so.1.0 libpri.so
ln -sf libpri.so.1.0 libpri.so.1
$(SOSLINK)
clean:

2
README Executable file → Normal file
View File

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

0
TODO Executable file → Normal file
View File

0
compat.h Executable file → Normal file
View File

0
compiler.h Executable file → Normal file
View File

0
copy_string.c Executable file → Normal file
View File

1
libpri.h Executable file → Normal file
View File

@@ -359,6 +359,7 @@ 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 {

0
pri.c Executable file → Normal file
View File

4
pri_facility.c Executable file → Normal file
View File

@@ -1136,13 +1136,17 @@ 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);

0
pri_facility.h Executable file → Normal file
View File

0
pri_internal.h Executable file → Normal file
View File

0
pri_q921.h Executable file → Normal file
View File

0
pri_q931.h Executable file → Normal file
View File

0
pri_timers.h Executable file → Normal file
View File

0
pridump.c Executable file → Normal file
View File

0
prisched.c Executable file → Normal file
View File

0
pritest.c Executable file → Normal file
View File

2
q921.c Executable file → Normal file
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, 0);
q921_rr(pri, 1, 1);
else {
if (!pri->txqueue->transmitted)
pri_error(pri, "!! Not good - head of queue has not been transmitted yet\n");

94
q931.c Executable file → Normal file
View File

@@ -43,7 +43,7 @@ struct msgtype {
int mandies[MAX_MAND_IES];
};
struct msgtype msgs[] = {
static struct msgtype msgs[] = {
/* Call establishment messages */
{ Q931_ALERTING, "ALERTING" },
{ Q931_CALL_PROCEEDING, "CALL PROCEEDING" },
@@ -89,7 +89,7 @@ struct msgtype msgs[] = {
{ NATIONAL_SERVICE_ACKNOWLEDGE, "SERVICE ACKNOWLEDGE" },
};
struct msgtype causes[] = {
static 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 @@ struct msgtype causes[] = {
{ PRI_CAUSE_INTERWORKING, "Interworking, unspecified" },
};
struct msgtype facilities[] = {
static struct msgtype facilities[] = {
{ PRI_NSF_SID_PREFERRED, "CPN (SID) preferred" },
{ PRI_NSF_ANI_PREFERRED, "BN (ANI) preferred" },
{ PRI_NSF_SID_ONLY, "CPN (SID) only" },
@@ -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 > maxlen - 1) {
if ((len < 0) || (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 + 2, len - 4);
q931_get_number(cnum, sizeof(cnum), ie->data + 1, len - 3);
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 + 2, len - 4);
q931_get_number((unsigned char *) call->callingsubaddr, sizeof(call->callingsubaddr), ie->data + 1, len - 3);
return 0;
}
@@ -1382,12 +1382,14 @@ static FUNC_RECV(receive_keypad_facility)
if (ie->len == 0)
return -1;
if (ie->len > sizeof(call->digitbuf))
mylen = sizeof(call->digitbuf);
if (ie->len > (sizeof(call->digitbuf) - 1))
mylen = (sizeof(call->digitbuf) - 1);
else
mylen = ie->len;
libpri_copy_string(call->digitbuf, (char *) ie->data, mylen);
memcpy(call->digitbuf, ie->data, mylen);
call->digitbuf[mylen] = 0;
return 0;
}
@@ -1396,7 +1398,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)) {
@@ -1905,7 +1907,7 @@ static FUNC_DUMP(dump_signal)
}
struct ie ies[] = {
static struct ie ies[] = {
/* Codeset 0 - Common */
{ 1, NATIONAL_CHANGE_STATUS, "Change Status" },
{ 0, Q931_LOCKING_SHIFT, "Locking Shift", dump_shift },
@@ -2068,15 +2070,17 @@ 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;
pri_message(NULL, "%c [", prefix);
pri_message(NULL, "%02x", ie->ie);
buf[0] = '\0';
if (!(ie->ie & 0x80)) {
pri_message(NULL, " %02x", ielen(ie)-2);
buflen += sprintf(buf, " %02x", ielen(ie)-2);
for (x = 0; x + 2 < ielen(ie); ++x)
pri_message(NULL, " %02x", ie->data[x]);
buflen += sprintf(buf + buflen, " %02x", ie->data[x]);
}
pri_message(NULL, "]\n");
pri_message(pri, "%c [%02x%s]\n", prefix, ie->ie, buf);
free(buf);
/* Special treatment for shifts */
if((full_ie & 0xf0) == Q931_LOCKING_SHIFT)
@@ -2604,9 +2608,11 @@ 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.cref = c->cr;
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));
q931_hangup(pri, c, c->cause);
}
@@ -2636,7 +2642,10 @@ int q931_connect(struct pri *pri, q931_call *c, int channel, int nonisdn)
c->progressmask = PRI_PROG_CALLED_NOT_ISDN;
} else
c->progressmask = 0;
c->ourcallstate = Q931_CALL_STATE_CONNECT_REQUEST;
if (pri->localtype == PRI_CPE)
c->ourcallstate = Q931_CALL_STATE_CONNECT_REQUEST;
else
c->ourcallstate = Q931_CALL_STATE_ACTIVE;
c->peercallstate = Q931_CALL_STATE_ACTIVE;
c->alive = 1;
/* Setup timer */
@@ -2796,6 +2805,8 @@ int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req)
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;
@@ -3080,6 +3091,7 @@ 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;
@@ -3249,9 +3261,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));
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';
pri->ev.ring.redirectingreason = c->redirectingreason;
pri->ev.ring.origredirectingreason = c->origredirectingreason;
@@ -3278,7 +3290,7 @@ 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.ring.useruserinfo));
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:
@@ -3298,7 +3310,7 @@ 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.ring.useruserinfo));
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 */
@@ -3352,6 +3364,16 @@ 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) {
@@ -3384,9 +3406,11 @@ 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.cref = c->cr;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.call = c;
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));
/* Free resources */
c->ourcallstate = Q931_CALL_STATE_NULL;
c->peercallstate = Q931_CALL_STATE_NULL;
@@ -3410,10 +3434,11 @@ 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.cref = c->cr;
pri->ev.hangup.cause = c->cause;
pri->ev.hangup.call = c;
libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo));
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';
/* Free resources */
if (c->alive) {
@@ -3444,11 +3469,11 @@ 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.cref = c->cr;
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.ring.useruserinfo));
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 */
@@ -3472,10 +3497,12 @@ 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.cref = c->cr;
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';
if (c->alive)
return Q931_RES_HAVEEVENT;
else
@@ -3525,6 +3552,7 @@ 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) {

0
testprilib.c Executable file → Normal file
View File