From owner-freebsd-isdn Fri Aug 17 4:28:11 2001 Delivered-To: freebsd-isdn@freebsd.org Received: from kauha.saunalahti.fi (kauha.saunalahti.fi [195.197.53.227]) by hub.freebsd.org (Postfix) with ESMTP id 3F7DC37B406 for ; Fri, 17 Aug 2001 04:28:04 -0700 (PDT) (envelope-from jml@cubical.fi) Received: from gw.cubical.fi (gw.cubical.fi [195.218.69.227]) by kauha.saunalahti.fi (8.10.1/8.10.1) with ESMTP id f7HBS0C23885; Fri, 17 Aug 2001 14:28:01 +0300 (EEST) Received: (from root@localhost) by gw.cubical.fi (8.9.3/8.9.3) id OAA45560; Fri, 17 Aug 2001 14:27:54 +0300 (EEST) (envelope-from jml@cubical.fi) Received: from cubical.fi (dhcp-45.intra.net [192.168.42.45]) by gw.cubical.fi (8.9.3/8.9.3av) with ESMTP id OAA45550; Fri, 17 Aug 2001 14:27:48 +0300 (EEST) (envelope-from jml@cubical.fi) Message-ID: <3B7CFFAF.4A37B960@cubical.fi> Date: Fri, 17 Aug 2001 14:27:43 +0300 From: Juha-Matti Liukkonen Organization: Cubical Solutions Ltd X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: hm@hcs.de Cc: freebsd-isdn@freebsd.org Subject: Heinous bug in i4b CAPI support Content-Type: multipart/mixed; boundary="------------A0277CEA452086267319D5BF" X-Virus-Scanned: by AMaViS perl-10 Sender: owner-freebsd-isdn@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org This is a multi-part message in MIME format. --------------A0277CEA452086267319D5BF Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, it seems that I slipped a nasty bug into the CAPI support. The message lengths for CONNECT_REQ and CONNECT_IND are incorrect, which causes dialouts to fail after certain error situations (an invalid -- not wrong! -- number has been dialed). Since these messages are tagged as too short, the device reads trailing garbage as the B protocol parameters; this is OK as long as the garbage consists of zero bytes, which it usually does, except after the said error. Another change we have taken into use is to send an explicit Q.850 "normal call clearing" code when a call is ignored using PRI equipment (specifically AVM T1); the CAPI pseudo-code for ignore, 1, translates into something at least Ericsson exchanges interpret oddly (message "this area is not reachable from your number"). NCCLR makes the exchange give a busy signal, which is the behaviour at least we prefer (conceivably, the ignore code could be made a sysctl variable). The attached patch corrects the message length issue. It also includes a somewhat unpretty solution for the PRI ignore code (if device's number of channels equals 30, assume PRI and send NCCLR, otherwise send CAPI ignore). Tested using AVM B1 PCI and T1 PCI. Cheers, - Juha -- Juha-Matti Liukkonen, Cubical Solutions Ltd Phone: +358(0)405280142 Email: jml@cubical.fi --------------A0277CEA452086267319D5BF Content-Type: text/plain; charset=us-ascii; name="i4b-101_capifix.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="i4b-101_capifix.patch" --- capi_msgs.c-orig Tue Aug 14 18:39:59 2001 +++ capi_msgs.c Fri Aug 17 14:13:41 2001 @@ -195,7 +195,7 @@ int slen = strlen(cd->src_telno); int dlen = strlen(cd->dst_telno); - m = i4b_Dgetmbuf(8 + 18 + slen + dlen); + m = i4b_Dgetmbuf(8 + 27 + slen + dlen); if (!m) { printf("capi%d: can't get mbuf for connect_req\n", sc->sc_unit); return; @@ -566,7 +566,7 @@ u_int32_t PLCI; int dlen = strlen(cd->dst_telno); - m = i4b_Dgetmbuf(8 + 11 + dlen); + m = i4b_Dgetmbuf(8 + 21 + dlen); if (!m) { printf("capi%d: can't get mbuf for connect_resp\n", sc->sc_unit); return; @@ -600,7 +600,12 @@ case SETUP_RESP_DNTCRE: sc->sc_bchan[cd->channelid].state = B_FREE; ctrl_desc[sc->ctrl_unit].bch_state[cd->channelid] = BCH_ST_FREE; - msg = capimsg_setu16(msg, 1); /* Ignore */ + if (sc->sc_nbch == 30) { + /* With PRI, we can't really ignore calls -- normal clearing */ + msg = capimsg_setu16(msg, (0x3480|CAUSE_Q850_NCCLR)); + } else { + msg = capimsg_setu16(msg, 1); /* Ignore */ + } break; default: @@ -733,7 +738,7 @@ void capi_data_b3_ind(capi_softc_t *sc, struct mbuf *m_in) { - struct mbuf *m = i4b_Dgetmbuf(8 + 14); + struct mbuf *m = i4b_Dgetmbuf(8 + 6); u_int8_t *msg = mtod(m_in, u_int8_t*); u_int16_t applid, msgid; u_int32_t NCCI; --------------A0277CEA452086267319D5BF-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isdn" in the body of the message