Compare commits

...

16 Commits
1.2.3 ... 1.2.6

Author SHA1 Message Date
Matthew Fredrickson
b96b0791e3 importing files for 1.2.6 release
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.2.6@475 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-10-16 14:56:34 +00:00
Matthew Fredrickson
f60ad88bc9 Creating tag for the release of libpri-1.2.6
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.2.6@474 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-10-16 14:54:54 +00:00
Matthew Fredrickson
0e75c28513 Fix user-user IE order in setup message (#10705)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@467 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-09-25 21:33:16 +00:00
Matthew Fredrickson
6fb4d0ee4a TBCT now works. It should work for NI2, 4E, and 5E. This code was tested on NI2.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@460 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-09-06 15:06:42 +00:00
Jason Parker
8c5e372f29 Make sure we build both the static and shared modules with -fPIC.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@445 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-08-27 19:20:23 +00:00
Matthew Fredrickson
2fa3049e19 Try to send pending facility messages if we receive alerting (for when we don't get proceeding) (#9651)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@426 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-06-19 18:22:33 +00:00
Matthew Fredrickson
165a1190f2 Oops, that should not be on one line
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@423 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-06-06 21:57:15 +00:00
Matthew Fredrickson
a3f9429129 Make sure we only send the NFE when we are talking QSIG
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@415 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-06-06 13:20:05 +00:00
Matthew Fredrickson
26260008d1 Make sure we send DISCONNECT if we reached the active state and a call is disconnected, regardless of cause code.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@389 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-01-22 22:20:59 +00:00
Joshua Colp
b5feb47e50 Specify full path to restorecon instead of assuming it will be available from what is in $PATH. (issue #8670 reported by djflux)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.2@385 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-12-30 19:16:17 +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
6 changed files with 238 additions and 68 deletions

1
.version Normal file
View File

@@ -0,0 +1 @@
1.2.6

136
ChangeLog Normal file
View File

@@ -0,0 +1,136 @@
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
2007-06-19 18:22 +0000 [r426] Matthew Fredrickson <creslin@digium.com>
* q931.c: Try to send pending facility messages if we receive
alerting (for when we don't get proceeding) (#9651)
2007-06-06 21:57 +0000 [r415-423] Matthew Fredrickson <creslin@digium.com>
* pri_facility.c: Oops, that should not be on one line
* pri_facility.c: Make sure we only send the NFE when we are
talking QSIG
2007-01-22 22:20 +0000 [r389] Matthew Fredrickson <creslin@digium.com>
* q931.c: Make sure we send DISCONNECT if we reached the active
state and a call is disconnected, regardless of cause code.
2006-12-30 19:16 +0000 [r385] Joshua Colp <jcolp@digium.com>
* Makefile: Specify full path to restorecon instead of assuming it
will be available from what is in $PATH. (issue #8670 reported by
djflux)
2006-10-17 Kevin P. Fleming <kpfleming@digium.com>
* 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.

View File

@@ -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
@@ -86,7 +86,7 @@ install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
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
if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then /sbin/restorecon -v $(INSTALL_PREFIX)$(INSTALL_BASE)/lib/$(DYNAMIC_LIBRARY); fi
( cd $(INSTALL_PREFIX)$(INSTALL_BASE)/lib ; ln -sf libpri.so.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
@@ -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)

26
pri.c
View File

@@ -521,24 +521,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)

View File

@@ -721,11 +721,13 @@ static int add_callername_facility_ies(struct pri *pri, q931_call *c, int cpe)
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);
if (pri->switchtype == PRI_SWITCH_QSIG) {
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);
@@ -762,11 +764,13 @@ static int add_callername_facility_ies(struct pri *pri, q931_call *c, int cpe)
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);
if (pri->switchtype == PRI_SWITCH_QSIG) {
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);
@@ -855,13 +859,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[] = {
@@ -874,16 +875,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);

97
q931.c
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" },
@@ -1398,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)) {
@@ -1907,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 },
@@ -2070,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)
@@ -2606,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);
}
@@ -2638,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 */
@@ -2718,8 +2725,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 };
@@ -2905,8 +2913,6 @@ int q931_hangup(struct pri *pri, q931_call *c, int cause)
/* sent CONNECT */
case Q931_CALL_STATE_INCOMING_CALL_PROCEEDING:
/* we sent CALL_PROCEEDING */
case Q931_CALL_STATE_ACTIVE:
/* received CONNECT */
case Q931_CALL_STATE_OVERLAP_RECEIVING:
/* received SETUP_ACKNOWLEDGE */
/* send DISCONNECT in general */
@@ -2920,6 +2926,10 @@ int q931_hangup(struct pri *pri, q931_call *c, int cause)
} else
pri_error(pri, "Wierd, doing nothing but this shouldn't happen, ourstate %s, peerstate %s\n",callstate2str(c->ourcallstate),callstate2str(c->peercallstate));
break;
case Q931_CALL_STATE_ACTIVE:
/* received CONNECT */
q931_disconnect(pri,c,cause);
break;
case Q931_CALL_STATE_DISCONNECT_REQUEST:
/* sent DISCONNECT */
q931_release(pri,c,cause);
@@ -3254,9 +3264,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;
@@ -3283,8 +3293,18 @@ 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';
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:
if (c->newcall) {
@@ -3303,7 +3323,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 */
@@ -3357,6 +3377,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) {
@@ -3389,9 +3419,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;
@@ -3415,10 +3447,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) {
@@ -3449,11 +3482,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 */
@@ -3477,10 +3510,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