Compare commits

..

63 Commits

Author SHA1 Message Date
Sergey V. Lobanov
9ace221ca0 Makefile: Add the ability to build libpri on MacOS for Linux target.
This patch allows to redefine ar and ranlib tool using AR and
RANLIB make flags.

PRI-188 #close

Change-Id: I6554c57b6fab4d73bc752d4d9b878834aa86d1f1
2022-05-19 21:11:46 -05:00
bbabic
a7a2245b12 q931.c: Fix subaddress finding octet 4.
Some switches have extended subaddress ie octet 3 encoding to be
multi-octet.

* Update dump and receive helper functions to search for the end of octet
3 encoding to determine where octet 4 starts.

ASTERISK-27342

Change-Id: I5b2706f668e1a4664b020a58de41dad4cbc5c7e6
2017-10-23 12:27:42 -05:00
Tzafrir Cohen
c038af7892 Makefile: Use CPPFLAGS
* Include the value of CPPFLAGS in CFLAGS

Change-Id: Id8e6f3a231bf7581f3f37576b9ee6849ed59540a
2016-12-05 12:40:02 -06:00
Richard Mudgett
f8e6096bfe q931.c: Lucent switch implementation bug workaround (Part 2)
Work around a bug in a Lucent switch implementation that sets the
extension bit in octet 3 even though octet 3a is present.

The same issue was seen in a NI2 switch implementation.  It was probably a
Lucent switch configured for NI2 operation.  To avoid further surprises,
I'm going to enable the work around for all North American switch types.

PRI-183
Reported by: Richard Mudgett

Change-Id: I7eedbf68b7c3d9c868d9533012e4cea5142af281
2016-10-04 14:27:59 -05:00
Richard Mudgett
d2585d6da2 q931.c: Lucent switch implementation bug workaround.
A bug in a Lucent switch implementation sets the Connected Number
information element octet 3 extension bit.  When set that means octet 3 is
complete and thus there is no optional octet 3a.  However, the buggy
switch still sends octet 3a.  The unexpected octet 3a is interpreted as
the first octet 4 and thus the first character in the connected line
number is a garbage character.

* Work around the switch bug by checking octet 3 and the potential octet
3a extension bits.  If they are both set then assume that octet 3a is
actually present for the buggy switch types.

PRI-183 #close
Reported by: Richard Mudgett

Change-Id: I378af37bfd852737a0bfe6263ef3473ea6acfbad
2016-07-20 16:36:41 -05:00
Richard Mudgett
90019b935a q931.c: Add number ie specification references.
Change-Id: I0d15804963501d1e4063a581db756ff26513065b
2016-06-30 20:15:50 -05:00
Kevin Harwell
c71499df29 Adding .cleancount and .gitreview files
Change-Id: I0e5accd0e43c049578241b2841fc2efa821c24f4
2016-03-24 14:55:28 -05:00
Richard Mudgett
2952e95715 q931.c: Fix DISCONNECT Progress Indicator ie handling.
There are two scenarios that are exposed by DISCONNECT not initializing
the progress indicator value before processing the message when the
chan_dahdi.conf inbanddisconnect=yes option is set.

1) If a DISCONNECT comes in without a Progress Indicator ie and an earlier
message (such as SETUP-ACKNOWLEDGE or PROCEEDING) came in with the
indicator #8 (Inband audio present) then the DISCONNECT would not cause an
immediate hangup.  We would be letting the user hear the inband audio even
though there isn't any.

2) If a DISCONNECT message comes in with the indicator #8 (Inband audio
present) and then later the DISCONNECT message is repeated without a
Progress Indicator ie we would still ignore the second DISCONNECT to let
the user hear inband audio even though it likely isn't there anymore.

PRI-180 #close
Reported by: Alexandr Dranchuk

Change-Id: Ic88aafb45053146b5701d666e6212f7555573624
2016-03-17 11:43:10 -05:00
Richard Mudgett
7da3366cec q931.c: Substitute PROGRESS for DISCONNECT with progress indicator #8
When the pri_set_inbanddisconnect() option is enabled and the call has not
been answered when a DISCONNECT with progress indicator #8 (Inband audio
present) is received, then report the event as a PROGRESS with progress
indicator #8 (Inband audio present) instead.  Substituting a PROGRESS
event allows the upper layer to open the media path if it isn't already
open so the user can hear the inband audio message.

PRI-180
Reported by: Alexandr Dranchuk

Change-Id: I62313bf9cc1d2f3b0231f0c07a784717ddba0415
2016-03-17 11:43:10 -05:00
Richard Mudgett
734e922301 Add .gitignore
Change-Id: I11ac3b47a9d5d0a0c1ea4559280b75ef5d866d62
2016-03-16 16:09:24 -05:00
Richard Mudgett
a9722804c1 q931.c: Tighten mandatory ie checks.
Libpri was lax in checking if a missing channel identification ie is
mandatory for the SETUP ACKNOWLEDGE, PROCEEDING, ALERTING, and CONNECT
messages.  That ie is mandatory when those messages are the first response
to a SETUP message sent by the CPE side.

* Made those messages check if a missing channel identification ie is
mandatory and send a STATUS with cause 96 "Mandatory information element
is missing" in response.

Libpri did not care if a mandatory ie had a coding error.

* Made coding errors in mandatory ie's send a STATUS with cause 100
"Invalid information element contents" in response.

* Fixed detection of coding errors in channel identification ie.

SWP-8721
SWP-8722


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2337 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2016-02-17 20:21:18 +00:00
Richard Mudgett
6b2cc87b30 q931.c: Update ALERTING_NO_PROGRESS conditional code.
The conditional is to only remove the Progress Indicator ie from being
added to select messages.

* Made so the ALERTING message can have the User-User ie if needed when
ALERTING_NO_PROGRESS is defined.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2335 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2016-02-09 21:46:26 +00:00
Richard Mudgett
fc96191788 q931.c: Made not recognize ie 0x01 for switches other than 4ESS, 5ESS, NI2, and DMS-100.
An incoming SETUP message needs to reject the invalid ie 0x01 on switches
other than 4ESS, 5ESS, NI2, and DMS-100.

LIBPRI-74 #close
Reported by: Richard Mudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2333 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2014-11-17 23:26:55 +00:00
Richard Mudgett
5fda3d8c68 q931.c: Send STATUS messages when receiving messages in the wrong call state.
* Add checks to send STATUS messages when receiving SETUP ACKNOWLEDGE,
ALERTING, and CONNECT ACKNOWLEDGE messages when in the wrong call state.

LIBPRI-76 #close
Reported by: Richard Mudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2331 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2014-11-17 20:07:53 +00:00
Richard Mudgett
af8a550ff9 q921.c: Send DM and DISC frames with only three data octets instead of an extra fourth octet.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2329 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2014-11-04 22:19:02 +00:00
Richard Mudgett
a50516c1e4 q931.c: Make always post a PRI_EVENT_KEYPAD_DIGIT if keypad digits come in an INFO message.
Q.931 Section 3.1.6 INFORMATION message.  The keypad-facility or
called-party-number ie could be used to convey called party digits.  The
keypad-facility ie can also be used to convey supplementary service
information.

PRI-173 #close
Reported by: Gerald Schnabel
Patches:
      libpri_q931_keypad_digits.patch (license #6297) patch uploaded by Gerald Schnabel


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2327 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2014-08-18 22:44:04 +00:00
Richard Mudgett
998e6ba598 Adjust T202 default value to the minimum.
The minimum T202 time specified in Q.921 Section 5.9.7 is 2 seconds.  It
makes sense to set the value to the minimum 2 seconds in order to more
likely get a TEI value before an outgoing call request aborts from T303
timeouts.

PRI-171 #close
Reported by: dcolombo


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2322 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2014-06-02 16:27:13 +00:00
Richard Mudgett
cfac266390 libpri: Add control of inband audio progress indication ie to the SETUP_ACKNOWLEDGE message.
Added support to the libpri API to control the inband audio available
progress indication ie on the SETUP_ACKNOWLEDGE message.

* Added the progress indication ie progressmask value to the struct
pri_event_setup_ack so the PRI_EVENT_SETUP_ACK event can indicate when a
SETUP_ACKNOWLEDGE comes in with inband audio (ie dialtone).

* Added pri_setup_ack() so when the SETUP_ACKNOWLEDGE message is sent it
can indicate if inband audio is present (ie dialtone).

This patch and a corresponding change in Asterisk work together to allow
Asterisk to control the inband audio available progress indication ie on
the SETUP_ACKNOWLEDGE message when dialtone is present.

AST-1338 #close
Reported by: Tyler Stewart

Review: https://reviewboard.asterisk.org/r/3520/


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2320 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2014-05-12 22:45:13 +00:00
Richard Mudgett
13beaacc80 libpri: Make TE-PTP mode respond to MDL TEI check requests.
Some BRI devices in France insist on checking TEI's when in point-to-point
mode.  If they don't get a response for TEI 0 they drop layer 1 even
though libpri keeps trying to bring layer 2 up.

* Made q921_mdl_receive() handle TEI check request messages in TE-PTP
mode.  Had to change q921_mdl_send()/Q921_INIT() because the PTP modes do
not setup a link structure specifically for MDL as the PTMP modes do.

* Fixed q921_tei_check()/t201_expire() to check TEI's even if the network
side doesn't have any assigned.  This should make TE's that request the
TEI verify procedure (Q.921 Section 5.3.5) happy when the network side
doesn't have any TEI's allocated.

PRI-165
Reported by: Denis Alberto Martinez
Patches:
      jira_pri_165_ptp_respond_tei_check.patch (license #5621) patch uploaded by rmudgett
Review: https://reviewboard.asterisk.org/r/3434/



git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2318 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2014-04-18 17:44:31 +00:00
Richard Mudgett
84b2560da5 Fix hole in layer2_persistence option for TE PTMP links.
If the network stops responding, according to Q.921 we are supposed to
remove the TEI.  With the layer2_persistence option enabled, we are
supposed to keep trying to bring layer 2 back up.  Unfortunately, when the
network stops responding, we stopped the restart timer and removed the
TEI.  As a result, layer 2 does not immediately come back up.

* Made not stop the restart timer if we are removing the TEI on the CPE
side.  Also handle the timer expiration in relevant unassigned TEI states.

(closes issue LIBPRI-72)
Reported by: Trey Blancher
Patches:
      jira_dahdi_1001_libpri_v1.4.patch (license #5621) patch uploaded by rmudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2315 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2013-03-28 16:40:22 +00:00
Richard Mudgett
28553ff8cb Handle optional Recommendation octet 3a in Cause IE.
If the MSB of octet 3 is 0 then the optional Recommendation octet 3a is
present.

References: ITU-T Q.850 Section 2.1 and ETSI ETS 300 102-1 Section 4.5.12.

(closes issue PRI-151)
Reported by: Tzafrir Cohen
Patches:
      0001-handle-optional-Recommendation-in-Cause-IE.patch (license #5035) patch uploaded by Tzafrir Cohen
      Modified


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2310 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-12-10 18:28:55 +00:00
Richard Mudgett
1a0927ca23 Q.SIG: Allow PROGRESS when in the Active state.
ECMA-143 Section 10.1.7.2 indicates that PROGRESS is allowed when in the
Active state.

* Made Q.SIG ignore the PROGRESS message when in the Active call state.

(closes issue PRI-147)
Reported by: Nick Merrett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2308 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-11-13 19:59:50 +00:00
Richard Mudgett
de78c8d37f Fix compiler error with ALERTING_NO_PROGRESS define.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2307 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-11-13 19:42:17 +00:00
Richard Mudgett
cdb844c16b Fix compiler warning in pritest.c.
* Made do_channel() exit on a failed write().

(closes issue PRI-145)
Reported by: Tzafrir Cohen
Patches:
      fix_unused_write.patch (license #5035) patch uploaded by Tzafrir Cohen
      Modified


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2305 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-10-29 21:19:52 +00:00
Richard Mudgett
75bf8f0a20 Allow passing compiler flags (CFLAGS, LDFLAGS)
(closes issue PRI-144)
Reported by: Tzafrir Cohen
Patches:
      flags.diff (license #5035) patch uploaded by Tzafrir Cohen


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2300 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-09-26 15:46:23 +00:00
Richard Mudgett
5e3581c977 Fix compile error in pridump.c.
With gcc 4.6.3 it's possible to get the following error:

  $ make
  gcc -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC  -O2  -MD -MT pridump.o -MF .pridump.o.d -MP -c -o pridump.o pridump.c
  pridump.c: In function \u2018pri_bridge\u2019:
  pridump.c:117:1: error: no return statement in function returning non-void [-Werror=return-type]
  cc1: all warnings being treated as errors
  make: *** [pridump.o] Error 1

Changing the function return value to void fixes the issue since there
were no places in the code that used the return value.

(closes issue PRI-143)
Reported by: Birger "WIMPy" Harzenetter
Patches:
      0001-Fix-no-return-statement-in-function-returning-non-vo.patch (license #5417) patch uploaded by Shaun Ruffell


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2298 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-09-10 15:52:31 +00:00
Richard Mudgett
d9c6cc68a5 SVN ignore built utilities.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2295 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-08-11 01:38:57 +00:00
Richard Mudgett
27808e3640 * Made no longer compile *.lo files they are identical to *.o files.
* Made compile the pritest, rosetest, and testprilib utilities using the
static libpri library.  No more forgetting to install the library after a
change and wondering why it still did not work.  The pridump utility is
still dynamically linked.

* Made compile the utilities by default.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2294 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-08-11 01:37:58 +00:00
Richard Mudgett
4af121db62 Make pridump and testprilib compile again.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2292 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-08-11 00:42:04 +00:00
Richard Mudgett
053a38202e Removed MDL/TEI management configuration warning message.
Some telco switches send out MDL messages even though they are configured
for PTP.  Usually they are checking for assigned TEI's.  Since these
switches periodically poll for assigned TEI's, the message needlessly
fills up log files.

* Changed message warning level to a normal debug message level and
reworded.

(closes issue PRI-137)
Reported by: Bart Coninckx


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2290 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-07-30 16:20:47 +00:00
Richard Mudgett
fffb7babaf Implement T316 to allow RESTART messages to be automatically retransmitted.
Q.931 defines the T316 timer to retransmit RESTART messages if a RESTART
ACKNOWLEDGE message is not received before the timer expires.  Q.931
defaults the time of T316 to 2 minutes with the default number of
consecutive RESTART failures as two.

* To support legacy behavior, the T316 timer is disabled by default.  It
is also disabled because the user cannot configure it to disabled if it is
enabled.

* The N316 count is created to allow the number of RESTART attempts to be
configurable.  Note you will need to recompile Asterisk to be able to
configure N316.

(issue ASTERISK-19608)
(issue AST-815)
(closes issue PRI-133)
Reported by: Mike Boylan
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2288 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-06-28 00:16:33 +00:00
Richard Mudgett
f78400fc07 Make pri_pres2str() return correct string.
* Fix pri_pres2str() mask creation.

(closes issue PRI-139)
Reported by: Pavel Troller
Patches:
      q931.c.diff (license #6302) patch uploaded by Pavel Troller


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2286 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-05-14 14:54:01 +00:00
Richard Mudgett
a7eaec1aaa Make number not available presentation also set screening to network provided.
Q.951 indicates that when the presentation indicator is "Number not
available due to interworking" for a number then the screening indicator
field should be "Network provided".

Released versions of Asterisk starting with v1.8 relesed before this patch
only recognized the PRES_NUMBER_NOT_AVAILABLE value as an unavailable
number.  This patch improves compatibility as a result.

* Made mask the presentation value for names and numbers from the upper
layer.

* Made pri_mwi_indicate_v2() also call q931_party_id_fixup() for
completeness even though it is a noop in this case.

* Made pri_pres2str() deceoode better.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2284 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-03-23 19:35:23 +00:00
Kinsey Moore
17649b363b Make PRI_DEBUG_Q921_RAW work independantly of PRI_DEBUG_Q921_DUMP
Ensure that the DUMP and RAW flags work independently in q921_dump().

(closes issue PRI-119)
Patch-by: wimpy


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2282 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-02-03 23:12:57 +00:00
Richard Mudgett
2c159d4685 Use ie2str(full_ie) where possible in q931.c.
Initial patch by Alec Davis.

Review: https://reviewboard.asterisk.org/r/1633/


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2280 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2012-01-26 20:19:50 +00:00
Richard Mudgett
6078b21698 Remove nul octets from IE data that is normally treated as strings.
Sometimes ie values received from carriers contain nul octets in values
normally treated by libpri as nul terminated strings.  A discussion on the
asterisk-users list determined that the best thing to do in the situation
is to delete the nul octets and unconditionally report/log when that
happens.

* Remove nul octets from the following ie's and generate an unconditional
log message to the upper layer when they are removed:
Connected Number
Connected Address
Redirecting Number
Original Called Number
Redirection Number
Called Party Number
Calling Party Number
Display
Keypad Facility

(closes issue PRI-128)
Reported by: phsultan
Patches:
      jira_pri_128.patch (license #5621) patch uploaded by rmudgett (modified)
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2278 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-12-16 20:01:46 +00:00
Richard Mudgett
4e7c3d1462 Implement handling a multi-channel RESTART request.
The channel id ie can supply a slotmap or list of channels.  For a RESTART
message, this can be handy to indicate multiple channels that need to be
restarted at the same time.

An incoming RESTART request will now generate a PRI_EVENT_RESTART to the
upper layer for each channel indicated in the request.  If the event is
successfully generated for all indicated channels then a
RESTART_ACKNOWLEDGE is sent back to the peer indicating all channels
restarted.

* Add the ability to process a channel id ie channel list with a RESTART
request.

* Add the ability to process slotmaps with a RESTART request.

(closes issue PRI-93)
Reported by: Marcin Kowalczyk
Patches:
      jira_pri_93.patch (license #5621) patch uploaded by rmudgett
Tested by: zvision, rmudgett

(closes issue PRI-71)
Reported by: Torrey Searle
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2277 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-12-16 19:26:56 +00:00
Richard Mudgett
5947536965 Fix message typo: Weird
(closes issue PRI-126)
Reported by: Tzafrir Cohen


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2275 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-09-26 22:54:46 +00:00
Richard Mudgett
c5ec479bd2 Outgoing BRI calls fail when using Asterisk 1.8 with HA8, HB8, and B410P cards.
France Telecom brings layer 2 and layer 1 down on BRI lines when the line
is idle.  When layer 1 goes down Asterisk cannot make outgoing calls and
the HA8 and HB8 cards also get IRQ misses.

The inability to make outgoing calls is because the line is in red alarm
and Asterisk will not make calls over a line it considers unavailable.
The IRQ misses for the HA8 and HB8 card are because the hardware is
switching clock sources from the line which just brought layer 1 down to
internal timing.

There is a DAHDI option for the B410P card to not tell Asterisk that layer
1 went down so Asterisk will allow outgoing calls: "modprobe wcb4xxp
teignored=1".  There is a similar DAHDI option for the HA8 and HB8 cards:
"modprobe wctdm24xxp bri_teignored=1".  Unfortunately that will not clear
up the IRQ misses when the telco brings layer 1 down.

* Add layer 2 persistence option to customize the layer 2 behavior on BRI
PTMP lines.  The new option has three settings: 1) Use libpri default
layer 2 setting.  2) Keep layer 2 up.  Bring layer 2 back up when the peer
brings it down.  3) Leave layer 2 down when the peer brings it down.
Layer 2 will be brought up as needed for outgoing calls.

(issue AST-598)
Reported by: Trey Blancher


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2273 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-08-17 15:48:54 +00:00
Richard Mudgett
092811da55 Option needed for Q931_IE_TIME_DATE to be optional in CONNECT message.
The NEC SV8300 rejects the Q931_IE_TIME_DATE for Q.SIG.

Add option to specify if and how much of the current time is put in
Q931_IE_TIME_DATE.
* Send date/time ie never.
* Send date/time ie date only.
* Send date/time ie date and hour.
* Send date/time ie date, hour, and minute.
* Send date/time ie date, hour, minute, and second.
* Send date/time ie default: Libpri will send date and hhmm only when in
NT PTMP mode to support ISDN phones.

(closes issue #19221)
Reported by: kenner

JIRA SWP-3396


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2266 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-05-17 20:13:10 +00:00
Richard Mudgett
239f8186ef Problems with ISDN MWI to phones.
1) The "controlling user number" is always the number of the voice mail box
which is identical with the subscriber number itself.  This number which
is listed in the ISDN phone MWI menu cannot be called back to contact the
voice mail box.  The controlling user number should be made configurable.

2) The MWI indication is not restricted to a user (broadcast facility with
dummy call reference).  A called party IE should be added to address only
the relevant MSN.  (ETSI 300-196 Section 8.3.2.4)

JIRA ABE-2738
JIRA SWP-2846


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2262 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-04-18 19:43:47 +00:00
Richard Mudgett
c794af652e CallRerouting response not sent if peer hangs up first.
Send the CallRerouting response on the next message instead of only on the
DISCONNECT message.  The next message is either going to be a DISCONNECT
or RELEASE depending on who initiates disconnection first.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2258 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-03-18 01:59:18 +00:00
Richard Mudgett
1013e7626d Implement the mandatory T312 timer for NT PTMP broadcast SETUP calls.
* Fixed stopping T303 too early on a NT PTMP broadcast SETUP call if a
subcall just receives a RELEASE_COMPLETE(busy).

* Fixed a valgrind reported invalid read/write when hanging up a NT PTMP
broadcast SETUP call.

JIRA LIBPRI-32
JIRA SWP-2548


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2238 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-03-01 00:50:04 +00:00
Richard Mudgett
afd91f7f31 Miscellaneous cleanup before T312 branch merge.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2236 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-03-01 00:22:38 +00:00
Richard Mudgett
a5efd98835 Fix valgrind reported invalid read/write for display text feature.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2233 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-28 23:39:30 +00:00
Richard Mudgett
898bc57fce Improve the usefulness of pri_dump_info_str() output.
* Add BRI and PTMP strings to node type config when configured that way.
* Move Q.921 statistics to after configuration settings.
* Add call and cc_record debug statistics to pri_dump_info_str().


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2232 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-28 23:20:25 +00:00
Richard Mudgett
9effbfc130 Add determined remote node type to pri_dump_info_str().
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2227 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-28 20:58:41 +00:00
Richard Mudgett
e7a5d0da62 B channel lost by incoming call in BRI NT PTMP mode.
A phone's RELEASE_COMPLETE as a response to an initial broadcast SETUP
blocks one B channel permantly when the call is cancelled.

Scenario: A call to the ISDN Bus is acknowledged (ALERTING) by one
phone/endpoint and rejected by another phone/endpoint with a
RELEASE_COMPLETE.  The call is then cancelled by the caller.  If the whole
procedure is repeated once again then any further call attempt is rejected
(WARNING[5666]: app_dial.c:1546 dial_exec_full: Unable to create channel
of type 'DAHDI' (cause 34 - Circuit/channel congestion)).  It seems that
receiving a RELEASE_COMPLETE in that state blocks one B channel
permanently when the call is cancelled by the caller.

Background: The ISDN phones (Siemens Gigaset 3035 or CX253) we use for
testing additionally contain a DECT base station, which operates as a
different endpoint on the ISDN Bus (TEI).  If the DECT base station is not
in use then there are no DECT phones registered to the base station.  The
DECT base station responds to an incoming call not directed toward it with
(RELEASE_COMPLETE, cause: no user responding).

* Made initiate_hangup_if_needed() also hangup the subcall if it is in the
NULL state.

* Simplified q931_set_subcall_winner().

JIRA ABE-2745
JIRA SWP-2954


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2207 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-17 21:12:04 +00:00
Richard Mudgett
df22f0e1cb DMS-100 not receiving caller name anymore.
Looks like DMS-100 is using the same message as Q.SIG to receive the
caller name.

Add the ability to decode the ROSE calling name message defined for the
Q.SIG switch on the DMS-100 switch.

(closes issue #18822)
Reported by: cmorford
Patches:
      issue18822_v1.4.patch uploaded by rmudgett (license 664)
Tested by: cmorford


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2206 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-17 20:35:01 +00:00
Richard Mudgett
492a19ab7d * Added switchtype to ROSE invoke operation not handled message.
* Reordered NI2 ROSE message table so any conflicts with the pirated Q.SIG
messages will be in favor of the NI2 specific messages.  This is
precautionary only.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2204 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-17 17:50:20 +00:00
Richard Mudgett
2867fc717e Crash if NFAS swaps D channels on a call with an active timer.
If a Q.931 call record related timer is started on one NFAS D channel
expires after NFAS swaps to another D channel, then libpri could crash.

For example:
1) Hangup a call.
1a) Send a DISCONNECT.
1b) Start the T305 retransmit timer on the current D channel.
2) The RELEASE comes in on another D channel.
2a) The found call record switches its assignment to the new D channel.
2b) Attempt to stop T305.  Unfortunately, the timer was started on another
    D channel so the attempt does not find the timer to stop.
3) The hangup sequence continues normally and the call record is freed
   since there is only one call record pool.
4) T305 expires on the original D channel and crashes the system when it
   uses the stale call record pointer it has saved.

Made each D channel timer pool have a unique range of valid timer
identifiers.  If a given timer identifier is not in the range for the
current NFAS D channel, then search the D channel group for the original D
channel.

JIRA LIBPRI-58
JIRA SWP-2721


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2202 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-16 19:23:02 +00:00
Richard Mudgett
d1cac6352a Fix I-frame retransmission quirks.
Revamped the I-frame retransmission queue to better comply with Q.921:
Figure B.7/Q.921 (sheet 1 of 10) and Figure B.9/Q.921 (Sheet 5 of 5).  The
changes prevent retransmitting I-frames when the peer is busy (RNR) (Q.921
Section 5.6.5) and eliminate an unnecessary delay sending new I-frames
after an I-frame retransmission.

Related to JIRA LIBPRI-60


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2200 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-14 23:33:56 +00:00
Richard Mudgett
e01dce27b7 Swap of master/slave in pri_enslave() incorrect.
Thank you.  All I can say is oops.

(closes issue #18769)
Reported by: jcollie
Patches:
      libpri-1.4.12-beta3-swap.patch uploaded by jcollie (license 412)


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2192 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-08 16:44:37 +00:00
Richard Mudgett
ed0d76d538 Add display ie text handling options.
The display ie handling can be controlled independently in the send and
receive directions with the following options:

* Block display text data.

* Use display text in SETUP/CONNECT messages for name.

* Use display text for COLP name updates (FACILITY/NOTIFY as appropriate).

* Pass arbitrary display text during a call.  Sent in INFORMATION
messages.  Received from any message that the display text was not used as
a name.

If the display options are not set then the options default to legacy
behavior.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2190 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-04 19:59:45 +00:00
Richard Mudgett
d0dbd5b3f2 Add Q931_IE_TIME_DATE to CONNECT message when in network mode.
Add the Q931_IE_TIME_DATE with the current date/time of the system to the
Q.931 CONNECT message when in network mode.  The date/time IE allows
attached equipment to synchronize their clock with the network.  Most
notably, ISDN phones can display the current date/time.

See issue #18047 about a concern with non-conforming Siemens terminals.

(closes issue #18047)
Reported by: wuwu
Patches:
      timedate.patch uploaded by rmudgett (license 664)
Tested by: rmudgett

JIRA SWP-2955
JIRA ABE-2747


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2187 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-04 18:09:46 +00:00
Richard Mudgett
82a0a8e2ab Enable LIBPRI_COUNTERS code by default.
Removed the conditional LIBPRI_COUNTERS to include the code
unconditionally.

Patches:
      enable_LIBPRI_COUNTERS_LIBPRI-61.diff uploaded by jbigelow

JIRA LIBPRI-61


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2183 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2011-02-01 00:37:49 +00:00
Richard Mudgett
261ab22dda Invalid PTMP redirecting signaling as TE towards NT.
* The PTMP redirection signaling (NOTIFY redirection number and
notification code, SETUP redirecting number) is also sent in PTMP/TE mode.
It should only apply in PTMP/NT mode.  The call setup proceeds but the
network (Deutsche Telekom) reacts with ugly ISDN STATUS messages.

* Don't send the redirecting number ie when PTP is also sending the
DivertingLegInformation2 facility.  The redirecting number ie is redundant
and the network (Deutsche Telekom) complains about it.

JIRA LIBPRI-53
JIRA SWP-2543


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2175 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-12-21 19:46:14 +00:00
Richard Mudgett
1b32a0e31b Fix Q.931 retried SETUP not sending facility ies.
Resend standard facility ies when the SETUP is retried by Q.931.  However,
one time facility ies are no longer available to add to a retried SETUP
message.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2174 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-12-21 19:41:52 +00:00
Richard Mudgett
19e2a84c89 Add call transfer exchange of subaddresses support and fix PTMP call transfer signaling.
* Add the ability to exchange subaddresses for ETSI PTMP, ETSI PTP, and
Q.SIG for call transfer.

* Fix ETSI PTMP to send the correct messages depending on the call state
for call transfer.  NOTE: Some ISDN phones only handle the NOTIFY message
that the EN 300-369 spec says should be sent only if the call has not
connected yet.

JIRA LIBPRI-47
JIRA SWP-2363

Review:	https://reviewboard.asterisk.org/r/1051/


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2172 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-12-21 16:49:30 +00:00
Richard Mudgett
4faa2935f8 Better HOLD/RETRIEVE collision handling.
The upper layer is now initiating HOLD/RETRIEVE signaling.  These changes
are needed to help preserve the correct channel id after a collision.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2170 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-12-20 23:12:10 +00:00
Richard Mudgett
8dc9486287 Fix regression when reorganized for struct pri and struct q921_link.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2169 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-12-20 22:42:07 +00:00
Richard Mudgett
cea6d541df Return error if q931_notify() cannot send NOTIFY.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2167 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-12-14 01:09:57 +00:00
Richard Mudgett
b79b886fc4 Fix bizarre logic to work as originally intended in q931_notify().
In revision 238: Don't allow notification codes outside of the Q.931 spec
for switches other than EuroISDN.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2166 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-12-14 00:55:49 +00:00
23 changed files with 3911 additions and 3259 deletions

1
.cleancount Normal file
View File

@@ -0,0 +1 @@
0

12
.gitignore vendored Normal file
View File

@@ -0,0 +1,12 @@
*.o
*.o.d
*.lo
*.so
*.a
libpri.so.*
pridump
pritest
rosetest
testprilib
version.c

4
.gitreview Normal file
View File

@@ -0,0 +1,4 @@
[gerrit]
host=gerrit.asterisk.org
port=29418
project=libpri.git

View File

@@ -1 +0,0 @@
1.4.12-beta3

1656
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@@ -10,26 +10,25 @@
# 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.
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Uncomment if you want libpri not send PROGRESS_INDICATOR w/ALERTING
#ALERTING=-DALERTING_NO_PROGRESS
# Uncomment if you want libpri to count number of Q921/Q931 sent/received
#LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
CC=gcc
GREP=grep
AWK=awk
AR=ar
RANLIB=ranlib
OSARCH=$(shell uname -s)
PROC?=$(shell uname -m)
@@ -68,43 +67,22 @@ STATIC_OBJS= \
rose_qsig_name.o \
version.o
DYNAMIC_OBJS= \
copy_string.lo \
pri.lo \
q921.lo \
prisched.lo \
q931.lo \
pri_aoc.lo \
pri_cc.lo \
pri_facility.lo \
asn1_primitive.lo \
rose.lo \
rose_address.lo \
rose_etsi_aoc.lo \
rose_etsi_cc.lo \
rose_etsi_diversion.lo \
rose_etsi_ect.lo \
rose_etsi_mwi.lo \
rose_other.lo \
rose_q931.lo \
rose_qsig_aoc.lo \
rose_qsig_cc.lo \
rose_qsig_ct.lo \
rose_qsig_diversion.lo \
rose_qsig_mwi.lo \
rose_qsig_name.lo \
version.lo
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS) $(LIBPRI_OPT) $(COVERAGE_CFLAGS)
$(STATIC_OBJS)
CFLAGS ?= -g
CFLAGS += $(CPPFLAGS)
CFLAGS += -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
CFLAGS += -fPIC $(ALERTING) $(LIBPRI_OPT) $(COVERAGE_CFLAGS)
INSTALL_PREFIX=$(DESTDIR)
INSTALL_BASE=/usr
libdir?=$(INSTALL_BASE)/lib
ifneq ($(findstring Darwin,$(OSARCH)),)
SOFLAGS=-dynamic -bundle -Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
SOFLAGS=$(LDFLAGS) -dynamic -bundle -Xlinker -macosx_version_min -Xlinker 10.4 -Xlinker -undefined -Xlinker dynamic_lookup -force_flat_namespace
ifeq ($(shell /usr/bin/sw_vers -productVersion | cut -c1-4),10.6)
SOFLAGS+=/usr/lib/bundle1.o
endif
LDCONFIG=/usr/bin/true
else
SOFLAGS=-shared -Wl,-h$(DYNAMIC_LIBRARY) $(COVERAGE_LDFLAGS)
SOFLAGS=$(LDFLAGS) -shared -Wl,-h$(DYNAMIC_LIBRARY) $(COVERAGE_LDFLAGS)
LDCONFIG = /sbin/ldconfig
endif
ifneq (,$(findstring X$(OSARCH)X, XLinuxX XGNU/kFreeBSDX XGNUX))
@@ -118,11 +96,13 @@ endif
endif
ifeq (${OSARCH},SunOS)
CFLAGS += -DSOLARIS -I../zaptel-solaris
LDCONFIG =
LDCONFIG =
LDCONFIG_FLAGS = \# # Trick to comment out the period in the command below
#INSTALL_PREFIX = /opt/asterisk # Uncomment out to install in standard Solaris location for 3rd party code
endif
UTILITIES= pridump pritest rosetest testprilib
export PRIVERSION
PRIVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
@@ -148,7 +128,7 @@ CFLAGS += -m32
SOFLAGS += -m32
endif
all: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
all: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY) $(UTILITIES)
update:
@if [ -d .svn ]; then \
@@ -174,37 +154,37 @@ ifneq (${OSARCH},SunOS)
install -m 644 libpri.h $(INSTALL_PREFIX)$(INSTALL_BASE)/include
install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)$(libdir)
#if [ -x /usr/sbin/sestatus ] && ( /usr/sbin/sestatus | grep "SELinux status:" | grep -q "enabled"); then /sbin/restorecon -v $(INSTALL_PREFIX)$(libdir)/$(DYNAMIC_LIBRARY); fi
( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf libpri.so.$(SONAME) libpri.so)
( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf $(DYNAMIC_LIBRARY) libpri.so)
install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)$(libdir)
if test $$(id -u) = 0; then $(LDCONFIG) $(LDCONFIG_FLAGS) $(INSTALL_PREFIX)$(libdir); fi
else
install -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include -m 644 libpri.h
install -f $(INSTALL_PREFIX)$(libdir) -m 755 $(DYNAMIC_LIBRARY)
( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf libpri.so.$(SONAME) libpri.so)
( cd $(INSTALL_PREFIX)$(libdir) ; ln -sf $(DYNAMIC_LIBRARY) libpri.so)
install -f $(INSTALL_PREFIX)$(libdir) -m 644 $(STATIC_LIBRARY)
endif
uninstall:
@echo "Removing Libpri"
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so.$(SONAME)
rm -f $(INSTALL_PREFIX)$(libdir)/$(STATIC_LIBRARY)
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.a
rm -f $(INSTALL_PREFIX)$(libdir)/$(DYNAMIC_LIBRARY)
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include/libpri.h
pritest: pritest.o
$(CC) -o pritest pritest.o -L. -lpri $(CFLAGS)
pritest: pritest.o $(STATIC_LIBRARY)
$(CC) -o $@ $< $(STATIC_LIBRARY) $(CFLAGS)
testprilib.o: testprilib.c
$(CC) $(CFLAGS) -D_REENTRANT -D_GNU_SOURCE -o $@ -c $<
$(CC) $(CFLAGS) -D_REENTRANT -D_GNU_SOURCE $(MAKE_DEPS) -c -o $@ $<
testprilib: testprilib.o
$(CC) -o testprilib testprilib.o -L. -lpri -lpthread $(CFLAGS)
testprilib: testprilib.o $(STATIC_LIBRARY)
$(CC) -o $@ $< $(STATIC_LIBRARY) -lpthread $(CFLAGS)
pridump: pridump.o
$(CC) -o pridump pridump.o -L. -lpri $(CFLAGS)
pridump: pridump.o $(DYNAMIC_LIBRARY)
$(CC) -o $@ $< -L. -lpri $(CFLAGS)
rosetest: rosetest.o
$(CC) -o rosetest rosetest.o -L. -lpri $(CFLAGS)
rosetest: rosetest.o $(STATIC_LIBRARY)
$(CC) -o $@ $< $(STATIC_LIBRARY) $(CFLAGS)
MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
@@ -215,13 +195,13 @@ MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
$(STATIC_LIBRARY): $(STATIC_OBJS)
ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
ranlib $(STATIC_LIBRARY)
$(AR) rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
$(RANLIB) $(STATIC_LIBRARY)
$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
$(CC) $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
$(LDCONFIG) $(LDCONFIG_FLAGS) .
ln -sf libpri.so.$(SONAME) libpri.so
ln -sf $(DYNAMIC_LIBRARY) libpri.so
version.c: FORCE
@build_tools/make_version_c > $@.tmp
@@ -229,9 +209,9 @@ version.c: FORCE
@rm -f $@.tmp
clean:
rm -f *.o *.so *.lo *.so.$(SONAME)
rm -f testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
rm -f pritest pridump
rm -f *.o *.so *.lo
rm -f $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
rm -f $(UTILITIES)
rm -f .*.d
.PHONY:

View File

@@ -1,157 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Release Summary - libpri-1.4.12-beta3</title></head>
<body>
<h1 align="center"><a name="top">Release Summary</a></h1>
<h3 align="center">libpri-1.4.12-beta3</h3>
<h3 align="center">Date: 2010-11-17</h3>
<h3 align="center">&lt;asteriskteam@digium.com&gt;</h3>
<hr/>
<h2 align="center">Table of Contents</h2>
<ol>
<li><a href="#summary">Summary</a></li>
<li><a href="#contributors">Contributors</a></li>
<li><a href="#issues">Closed Issues</a></li>
<li><a href="#commits">Other Changes</a></li>
<li><a href="#diffstat">Diffstat</a></li>
</ol>
<hr/>
<a name="summary"><h2 align="center">Summary</h2></a>
<center><a href="#top">[Back to Top]</a></center><br/><p>This release includes only bug fixes. The changes included were made only to address problems that have been identified in this release series. Users should be able to safely upgrade to this version if this release series is already in use. Users considering upgrading from a previous release series are strongly encouraged to review the UPGRADE.txt document as well as the CHANGES document for information about upgrading to this release series.</p>
<p>The data in this summary reflects changes that have been made since the previous release, libpri-1.4.12-beta2.</p>
<hr/>
<a name="contributors"><h2 align="center">Contributors</h2></a>
<center><a href="#top">[Back to Top]</a></center><br/><p>This table lists the people who have submitted code, those that have tested patches, as well as those that reported issues on the issue tracker that were resolved in this release. For coders, the number is how many of their patches (of any size) were committed into this release. For testers, the number is the number of times their name was listed as assisting with testing a patch. Finally, for reporters, the number is the number of issues that they reported that were closed by commits that went into this release.</p>
<table width="100%" border="0">
<tr>
<td width="33%"><h3>Coders</h3></td>
<td width="33%"><h3>Testers</h3></td>
<td width="33%"><h3>Reporters</h3></td>
</tr>
<tr valign="top">
<td>
28 rmudgett<br/>
1 russell<br/>
1 tilghman<br/>
</td>
<td>
4 rmudgett<br/>
1 lelio<br/>
1 shawkris<br/>
1 wimpy<br/>
</td>
<td>
1 bklang<br/>
1 gelo<br/>
1 jmls<br/>
1 lelio<br/>
1 schmoozecom<br/>
1 shawkris<br/>
1 wimpy<br/>
1 wuwu<br/>
</td>
</tr>
</table>
<hr/>
<a name="issues"><h2 align="center">Closed Issues</h2></a>
<center><a href="#top">[Back to Top]</a></center><br/><p>This is a list of all issues from the issue tracker that were closed by changes that went into this release.</p>
<h3>Category: Channels/chan_dahdi</h3><br/>
<a href="https://issues.asterisk.org/view.php?id=17270">#17270</a>: getting warning message every 4 seconds<br/>
Revision: <a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2113">2113</a><br/>
Reporter: jmls<br/>
Coders: rmudgett<br/>
<br/>
<h3>Category: General</h3><br/>
<a href="https://issues.asterisk.org/view.php?id=17360">#17360</a>: [patch] LibPRI problem with restart of PBX processor (Testing SVN 1688)<br/>
Revision: <a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=1962">1962</a><br/>
Reporter: shawkris<br/>
Testers: shawkris, rmudgett<br/>
Coders: rmudgett<br/>
<br/>
<a href="https://issues.asterisk.org/view.php?id=17522">#17522</a>: segfault in pri_schedule_del - ctrl invalid value<br/>
Revision: <a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2015">2015</a><br/>
Reporter: wuwu<br/>
Testers: rmudgett<br/>
Coders: rmudgett<br/>
<br/>
<a href="https://issues.asterisk.org/view.php?id=17865">#17865</a>: [patch] BRI NT ptmp: Active channels not cleard when i/f goes down<br/>
Revision: <a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=1982">1982</a><br/>
Reporter: wimpy<br/>
Testers: rmudgett, wimpy<br/>
Coders: rmudgett<br/>
<br/>
<a href="https://issues.asterisk.org/view.php?id=17968">#17968</a>: [patch] Libpri crashes when receiving Message Type (100)<br/>
Revision: <a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2021">2021</a><br/>
Reporter: gelo<br/>
Coders: rmudgett<br/>
<br/>
<a href="https://issues.asterisk.org/view.php?id=18032">#18032</a>: [patch] Asterisk is core dumping with LibPRI<br/>
Revision: <a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2015">2015</a><br/>
Reporter: schmoozecom<br/>
Testers: rmudgett<br/>
Coders: rmudgett<br/>
<br/>
<a href="https://issues.asterisk.org/view.php?id=18232">#18232</a>: [patch] B410P gets incoming call packets on ISDN but DAHDI doesn't generate the call in Asterisk<br/>
Revision: <a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2088">2088</a><br/>
Reporter: lelio<br/>
Testers: lelio<br/>
Coders: rmudgett<br/>
<br/>
<a href="https://issues.asterisk.org/view.php?id=18255">#18255</a>: SABME flood on backup D-channel in NFAS configuration<br/>
Revision: <a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2111">2111</a><br/>
Reporter: bklang<br/>
Coders: rmudgett<br/>
<br/>
<hr/>
<a name="commits"><h2 align="center">Commits Not Associated with an Issue</h2></a>
<center><a href="#top">[Back to Top]</a></center><br/><p>This is a list of all changes that went into this release that did not directly close an issue from the issue tracker. The commits may have been marked as being related to an issue. If that is the case, the issue numbers are listed here, as well.</p>
<table width="100%" border="1">
<tr><td><b>Revision</b></td><td><b>Author</b></td><td><b>Summary</b></td><td><b>Issues Referenced</b></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=1955">1955</a></td><td>rmudgett</td><td>Don't crash in __pri_new_tei() if a GR303 subchannel creation fails.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=1958">1958</a></td><td>rmudgett</td><td>Balance curly braces in post_handle_q931_message().</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=1961">1961</a></td><td>rmudgett</td><td>Prevent a CONNECT message from sending a CONNECT ACKNOWLEDGE in the wrong state.</td>
<td><a href="https://issues.asterisk.org/view.php?id=17360">#17360</a></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=1965">1965</a></td><td>rmudgett</td><td>Added more parameter checks to pri_set_timer() and pri_get_timer().</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=1976">1976</a></td><td>rmudgett</td><td>Fix spelling error in PTMP agent FSM files.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=1991">1991</a></td><td>rmudgett</td><td>PRI links do not retain active calls if the link comes back before T309 expires.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2001">2001</a></td><td>russell</td><td>Makefile tweaks to allow building for code coverage analysis.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2009">2009</a></td><td>tilghman</td><td>Minor changes to make libpri build on Mac OS X</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2027">2027</a></td><td>rmudgett</td><td>Create two versions of call ptr verify. One gripes and one does not.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2042">2042</a></td><td>rmudgett</td><td>Dump Q.931 message using the TEI value the message came in with.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2063">2063</a></td><td>rmudgett</td><td>Logically separate Q.921 TEI link processing from D channel control.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2070">2070</a></td><td>rmudgett</td><td>Restructure the Q.931 call record to layer 2 link association.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2077">2077</a></td><td>rmudgett</td><td>Extract the layer 2 link structure out of struct pri.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2078">2078</a></td><td>rmudgett</td><td>Partial support for dynamic interfaces with NFAS.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2079">2079</a></td><td>rmudgett</td><td>Fixes CC agents not automatically clearing if T309 clears the original call.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2098">2098</a></td><td>rmudgett</td><td>Mainly put space after switch and while keywords.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2101">2101</a></td><td>rmudgett</td><td>Remove all TEIs when NT PTMP starts.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2102">2102</a></td><td>rmudgett</td><td>Remove unneeded struct q921_link.mdl_error_state member.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2103">2103</a></td><td>rmudgett</td><td>Convert TEI identity defines to enum and create 2str() function.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2104">2104</a></td><td>rmudgett</td><td>Q.921 TEI assignment procedure corrections.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2105">2105</a></td><td>rmudgett</td><td>Added TEI identity check feature to reclaim dead TEIs.</td>
<td></td></tr><tr><td><a href="http://svn.digium.com/view/libpri/branches/1.4?view=revision&revision=2109">2109</a></td><td>rmudgett</td><td>Minor MDL handler changes.</td>
<td></td></tr></table>
<hr/>
<a name="diffstat"><h2 align="center">Diffstat Results</h2></a>
<center><a href="#top">[Back to Top]</a></center><br/><p>This is a summary of the changes to the source code that went into this release that was generated using the diffstat utility.</p>
<pre>
Makefile | 24
doc/cc_ptmp_agent.fsm | 16
doc/cc_ptmp_agent_flattened.fsm | 19
doc/cc_ptp_agent.fsm | 8
doc/cc_ptp_agent_flattened.fsm | 9
doc/cc_qsig_agent.fsm | 4
doc/cc_qsig_agent_flattened.fsm | 4
pri.c | 515 +++++++---
pri_aoc.c | 25
pri_cc.c | 82 -
pri_facility.c | 40
pri_internal.h | 134 +-
pri_q921.h | 101 +-
pri_q931.h | 17
prisched.c | 38
q921.c | 1988 ++++++++++++++++++++++++----------------
q931.c | 788 +++++++++++----
17 files changed, 2518 insertions(+), 1294 deletions(-)
</pre><br/>
<hr/>
</body>
</html>

View File

@@ -1,235 +0,0 @@
Release Summary
libpri-1.4.12-beta3
Date: 2010-11-17
<asteriskteam@digium.com>
----------------------------------------------------------------------
Table of Contents
1. Summary
2. Contributors
3. Closed Issues
4. Other Changes
5. Diffstat
----------------------------------------------------------------------
Summary
[Back to Top]
This release includes only bug fixes. The changes included were made only
to address problems that have been identified in this release series.
Users should be able to safely upgrade to this version if this release
series is already in use. Users considering upgrading from a previous
release series are strongly encouraged to review the UPGRADE.txt document
as well as the CHANGES document for information about upgrading to this
release series.
The data in this summary reflects changes that have been made since the
previous release, libpri-1.4.12-beta2.
----------------------------------------------------------------------
Contributors
[Back to Top]
This table lists the people who have submitted code, those that have
tested patches, as well as those that reported issues on the issue tracker
that were resolved in this release. For coders, the number is how many of
their patches (of any size) were committed into this release. For testers,
the number is the number of times their name was listed as assisting with
testing a patch. Finally, for reporters, the number is the number of
issues that they reported that were closed by commits that went into this
release.
Coders Testers Reporters
28 rmudgett 4 rmudgett 1 bklang
1 russell 1 lelio 1 gelo
1 tilghman 1 shawkris 1 jmls
1 wimpy 1 lelio
1 schmoozecom
1 shawkris
1 wimpy
1 wuwu
----------------------------------------------------------------------
Closed Issues
[Back to Top]
This is a list of all issues from the issue tracker that were closed by
changes that went into this release.
Category: Channels/chan_dahdi
#17270: getting warning message every 4 seconds
Revision: 2113
Reporter: jmls
Coders: rmudgett
Category: General
#17360: [patch] LibPRI problem with restart of PBX processor (Testing SVN
1688)
Revision: 1962
Reporter: shawkris
Testers: shawkris, rmudgett
Coders: rmudgett
#17522: segfault in pri_schedule_del - ctrl invalid value
Revision: 2015
Reporter: wuwu
Testers: rmudgett
Coders: rmudgett
#17865: [patch] BRI NT ptmp: Active channels not cleard when i/f goes down
Revision: 1982
Reporter: wimpy
Testers: rmudgett, wimpy
Coders: rmudgett
#17968: [patch] Libpri crashes when receiving Message Type (100)
Revision: 2021
Reporter: gelo
Coders: rmudgett
#18032: [patch] Asterisk is core dumping with LibPRI
Revision: 2015
Reporter: schmoozecom
Testers: rmudgett
Coders: rmudgett
#18232: [patch] B410P gets incoming call packets on ISDN but DAHDI doesn't
generate the call in Asterisk
Revision: 2088
Reporter: lelio
Testers: lelio
Coders: rmudgett
#18255: SABME flood on backup D-channel in NFAS configuration
Revision: 2111
Reporter: bklang
Coders: rmudgett
----------------------------------------------------------------------
Commits Not Associated with an Issue
[Back to Top]
This is a list of all changes that went into this release that did not
directly close an issue from the issue tracker. The commits may have been
marked as being related to an issue. If that is the case, the issue
numbers are listed here, as well.
+------------------------------------------------------------------------+
| Revision | Author | Summary | Issues |
| | | | Referenced |
|----------+----------+-------------------------------------+------------|
| 1955 | rmudgett | Don't crash in __pri_new_tei() if a | |
| | | GR303 subchannel creation fails. | |
|----------+----------+-------------------------------------+------------|
| 1958 | rmudgett | Balance curly braces in | |
| | | post_handle_q931_message(). | |
|----------+----------+-------------------------------------+------------|
| | | Prevent a CONNECT message from | |
| 1961 | rmudgett | sending a CONNECT ACKNOWLEDGE in | #17360 |
| | | the wrong state. | |
|----------+----------+-------------------------------------+------------|
| | | Added more parameter checks to | |
| 1965 | rmudgett | pri_set_timer() and | |
| | | pri_get_timer(). | |
|----------+----------+-------------------------------------+------------|
| 1976 | rmudgett | Fix spelling error in PTMP agent | |
| | | FSM files. | |
|----------+----------+-------------------------------------+------------|
| | | PRI links do not retain active | |
| 1991 | rmudgett | calls if the link comes back before | |
| | | T309 expires. | |
|----------+----------+-------------------------------------+------------|
| 2001 | russell | Makefile tweaks to allow building | |
| | | for code coverage analysis. | |
|----------+----------+-------------------------------------+------------|
| 2009 | tilghman | Minor changes to make libpri build | |
| | | on Mac OS X | |
|----------+----------+-------------------------------------+------------|
| | | Create two versions of call ptr | |
| 2027 | rmudgett | verify. One gripes and one does | |
| | | not. | |
|----------+----------+-------------------------------------+------------|
| 2042 | rmudgett | Dump Q.931 message using the TEI | |
| | | value the message came in with. | |
|----------+----------+-------------------------------------+------------|
| 2063 | rmudgett | Logically separate Q.921 TEI link | |
| | | processing from D channel control. | |
|----------+----------+-------------------------------------+------------|
| 2070 | rmudgett | Restructure the Q.931 call record | |
| | | to layer 2 link association. | |
|----------+----------+-------------------------------------+------------|
| 2077 | rmudgett | Extract the layer 2 link structure | |
| | | out of struct pri. | |
|----------+----------+-------------------------------------+------------|
| 2078 | rmudgett | Partial support for dynamic | |
| | | interfaces with NFAS. | |
|----------+----------+-------------------------------------+------------|
| | | Fixes CC agents not automatically | |
| 2079 | rmudgett | clearing if T309 clears the | |
| | | original call. | |
|----------+----------+-------------------------------------+------------|
| 2098 | rmudgett | Mainly put space after switch and | |
| | | while keywords. | |
|----------+----------+-------------------------------------+------------|
| 2101 | rmudgett | Remove all TEIs when NT PTMP | |
| | | starts. | |
|----------+----------+-------------------------------------+------------|
| 2102 | rmudgett | Remove unneeded struct | |
| | | q921_link.mdl_error_state member. | |
|----------+----------+-------------------------------------+------------|
| 2103 | rmudgett | Convert TEI identity defines to | |
| | | enum and create 2str() function. | |
|----------+----------+-------------------------------------+------------|
| 2104 | rmudgett | Q.921 TEI assignment procedure | |
| | | corrections. | |
|----------+----------+-------------------------------------+------------|
| 2105 | rmudgett | Added TEI identity check feature to | |
| | | reclaim dead TEIs. | |
|----------+----------+-------------------------------------+------------|
| 2109 | rmudgett | Minor MDL handler changes. | |
+------------------------------------------------------------------------+
----------------------------------------------------------------------
Diffstat Results
[Back to Top]
This is a summary of the changes to the source code that went into this
release that was generated using the diffstat utility.
Makefile | 24
doc/cc_ptmp_agent.fsm | 16
doc/cc_ptmp_agent_flattened.fsm | 19
doc/cc_ptp_agent.fsm | 8
doc/cc_ptp_agent_flattened.fsm | 9
doc/cc_qsig_agent.fsm | 4
doc/cc_qsig_agent_flattened.fsm | 4
pri.c | 515 +++++++---
pri_aoc.c | 25
pri_cc.c | 82 -
pri_facility.c | 40
pri_internal.h | 134 +-
pri_q921.h | 101 +-
pri_q931.h | 17
prisched.c | 38
q921.c | 1988 ++++++++++++++++++++++++----------------
q931.c | 788 +++++++++++----
17 files changed, 2518 insertions(+), 1294 deletions(-)
----------------------------------------------------------------------

224
libpri.h
View File

@@ -547,6 +547,7 @@ struct pri_rerouting_data {
#define PRI_SUBCMD_AOC_CHARGING_REQ_RSP 22 /*!< Advice Of Charge Request Response information */
#define PRI_SUBCMD_MCID_REQ 23 /*!< Malicious Call ID Request */
#define PRI_SUBCMD_MCID_RSP 24 /*!< Malicious Call ID Request response */
#define PRI_SUBCMD_DISPLAY_TEXT 25 /*!< Received display ie text */
#if defined(STATUS_REQUEST_PLACE_HOLDER)
struct pri_subcmd_status_request {
@@ -967,6 +968,35 @@ struct pri_subcmd_mcid_rsp {
int fail_code;
};
struct pri_subcmd_display_txt {
/*!
* \brief Character set the text is using.
* \details
* unknown(0),
* iso8859-1(1),
* enum-value-withdrawn-by-ITU-T(2)
* iso8859-2(3),
* iso8859-3(4),
* iso8859-4(5),
* iso8859-5(6),
* iso8859-7(7),
* iso10646-BmpString(8),
* iso10646-utf-8String(9)
*/
int char_set;
/*!
* \brief Number of octets in the display message.
* \note Not including any added null terminator.
*/
int length;
/*!
* \brief Display text data.
* \note Null terminated on receive.
* \note Does not need to be null terminated on send.
*/
char text[128];
};
struct pri_subcommand {
/*! PRI_SUBCMD_xxx defined values */
int cmd;
@@ -999,6 +1029,7 @@ struct pri_subcommand {
struct pri_subcmd_aoc_e aoc_e;
struct pri_subcmd_mcid_req mcid_req;
struct pri_subcmd_mcid_rsp mcid_rsp;
struct pri_subcmd_display_txt display;
} u;
};
@@ -1182,6 +1213,7 @@ typedef struct pri_event_setup_ack {
int channel;
q931_call *call;
struct pri_subcommands *subcmds;
int progressmask;
} pri_event_setup_ack;
typedef struct pri_event_notify {
@@ -1377,8 +1409,17 @@ const char *pri_facility_error2str(int facility_error_code);
*/
const char *pri_facility_reject2str(int facility_reject_code);
/* Acknowledge a call and place it on the given channel. Set info to non-zero if there
is in-band data available on the channel */
/*!
* \brief Send the ALERTING message.
*
* \param pri D channel controller.
* \param call Q.931 call leg.
* \param channel Encoded channel id to use. If zero do not change channel id.
* \param info Nonzero to include a progress ie indicating inband audio available (ie ringback).
*
* \retval 0 on success.
* \retval -1 on error.
*/
int pri_acknowledge(struct pri *pri, q931_call *call, int channel, int info);
/* Send a digit in overlap mode */
@@ -1388,12 +1429,44 @@ int pri_information(struct pri *pri, q931_call *call, char digit);
/* Send a keypad facility string of digits */
int pri_keypad_facility(struct pri *pri, q931_call *call, const char *digits);
/* Answer the incomplete(call without called number) call on the given channel.
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
/*!
* \brief Send the SETUP_ACKNOWLEDGE message.
*
* \param pri D channel controller.
* \param call Q.931 call leg.
* \param channel Encoded channel id to use. If zero do not change channel id.
* \param nonisdn Nonzero to include a progress ie indicating non-end-to-end-ISDN.
*
* \retval 0 on success.
* \retval -1 on error.
*/
int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisdn);
/* Answer(CONNECT) the call on the given channel.
Set non-isdn to non-zero if you are not connecting to ISDN equipment */
/*!
* \brief Send the SETUP_ACKNOWLEDGE message.
*
* \param ctrl D channel controller.
* \param call Q.931 call leg.
* \param channel Encoded channel id to use. If zero do not change channel id.
* \param nonisdn Nonzero to include a progress ie indicating non-end-to-end-ISDN.
* \param inband Nonzero to include a progress ie indicating inband audio available (ie dialtone).
*
* \retval 0 on success.
* \retval -1 on error.
*/
int pri_setup_ack(struct pri *ctrl, q931_call *call, int channel, int nonisdn, int inband);
/*!
* \brief Send the CONNECT message.
*
* \param pri D channel controller.
* \param call Q.931 call leg.
* \param channel Encoded channel id to use. If zero do not change channel id.
* \param nonisdn Nonzero to include a progress ie indicating non-end-to-end-ISDN.
*
* \retval 0 on success.
* \retval -1 on error.
*/
int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn);
/*!
@@ -1590,11 +1663,11 @@ int pri_mwi_deactivate(struct pri *pri, q931_call *c, char *caller, int callerpl
* \brief Send a MWI indication on the specified D channel.
*
* \param ctrl D channel controller.
* \param mailbox Controlling party number (NULL if not present).
* \param mailbox Party receiving notification.
* \param basic_service Basic service enum (-1 if not present).
* \param num_messages NumberOfMessages (-1 if not present).
* \param caller_id Controlling party privided number (NULL if not present).
* \param timestamp Generalized Time format (NULL if not present).
* \param caller_id Party leaving message (NULL if not present).
* \param timestamp When message left. (Generalized Time format, NULL if not present)
* \param message_reference Message reference number (-1 if not present).
* \param message_status Message status: added(0), removed(1).
*
@@ -1605,6 +1678,27 @@ int pri_mwi_indicate(struct pri *ctrl, const struct pri_party_id *mailbox,
int basic_service, int num_messages, const struct pri_party_id *caller_id,
const char *timestamp, int message_reference, int message_status);
/*!
* \brief Send a MWI indication on the specified D channel. (Take two)
*
* \param ctrl D channel controller.
* \param mailbox Party receiving notification.
* \param vm_id Voicemail system number (NULL if not present).
* \param basic_service Basic service enum (-1 if not present).
* \param num_messages NumberOfMessages (-1 if not present).
* \param caller_id Party leaving message (NULL if not present).
* \param timestamp When message left. (Generalized Time format, NULL if not present)
* \param message_reference Message reference number (-1 if not present).
* \param message_status Message status: added(0), removed(1).
*
* \retval 0 on success.
* \retval -1 on error.
*/
int pri_mwi_indicate_v2(struct pri *ctrl, const struct pri_party_id *mailbox,
const struct pri_party_id *vm_id, int basic_service, int num_messages,
const struct pri_party_id *caller_id, const char *timestamp, int message_reference,
int message_status);
/* Set service message support flag */
int pri_set_service_message_support(struct pri *pri, int supportflag);
@@ -1640,7 +1734,17 @@ int pri_progress(struct pri *pri, q931_call *c, int channel, int info);
int pri_progress_with_cause(struct pri *pri, q931_call *c, int channel, int info, int cause);
#define PRI_PROCEEDING_FULL
/* Send call proceeding */
/*!
* \brief Send the PROCEEDING message.
*
* \param pri D channel controller.
* \param c Q.931 call leg.
* \param channel Encoded channel id to use. If zero do not change channel id.
* \param info Nonzero to include a progress ie indicating inband audio available.
*
* \retval 0 on success.
* \retval -1 on error.
*/
int pri_proceeding(struct pri *pri, q931_call *c, int channel, int info);
/* Enable inband progress when a DISCONNECT is received */
@@ -1840,6 +1944,80 @@ int pri_transfer_rsp(struct pri *ctrl, q931_call *call, int invoke_id, int is_su
*/
void pri_aoc_events_enable(struct pri *ctrl, int enable);
enum pri_layer2_persistence {
PRI_L2_PERSISTENCE_DEFAULT,
/*! Immediately bring layer 2 back up if the peer brings layer 2 down. */
PRI_L2_PERSISTENCE_KEEP_UP,
/*! Leave layer 2 down if the peer brings layer 2 down. */
PRI_L2_PERSISTENCE_LEAVE_DOWN,
#if 0 /* Possible future option. Would need to define how long to idle before dropping. */
/*! Drop layer 2 on D channel idle. */
PRI_L2_PERSISTENCE_IDLE_DROP,
#endif
};
/*!
* \brief Set the layer2 persistence option.
*
* \param ctrl D channel controller.
* \param option Layer 2 persistence to apply.
*
* \note
* Not all values are supported by all modes.
*
* \return Nothing
*/
void pri_persistent_layer2_option(struct pri *ctrl, enum pri_layer2_persistence option);
#define PRI_DISPLAY_OPTION_BLOCK (1 << 0) /*!< Do not pass display text. */
#define PRI_DISPLAY_OPTION_NAME_INITIAL (1 << 1) /*!< Use display in SETUP/CONNECT for name. */
#define PRI_DISPLAY_OPTION_NAME_UPDATE (1 << 2) /*!< Use display in FACILITY/NOTIFY for COLP name if appropriate. */
#define PRI_DISPLAY_OPTION_TEXT (1 << 3) /*!< Pass arbitrary display text in INFORMATION messages during call. */
/*!
* \brief Set the display ie send policy options.
*
* \param ctrl D channel controller.
* \param flags Option flags to apply.
*
* \note
* If no flags set then legacy default behaviour.
*
* \note
* Not all options are supported by all switches.
*
* \return Nothing
*/
void pri_display_options_send(struct pri *ctrl, unsigned long flags);
/*!
* \brief Set the display ie receive policy options.
*
* \param ctrl D channel controller.
* \param flags Option flags to apply.
*
* \note
* If no flags set then legacy default behaviour.
*
* \note
* Not all options are supported by all switches.
*
* \return Nothing
*/
void pri_display_options_receive(struct pri *ctrl, unsigned long flags);
/*!
* \brief Send display text during a call.
*
* \param ctrl D channel controller.
* \param call Q.931 call leg
* \param display Display text to send.
*
* \retval 0 on success.
* \retval -1 on error.
*/
int pri_display_text(struct pri *ctrl, q931_call *call, const struct pri_subcmd_display_txt *display);
/*!
* \brief Set the call hold feature enable flag.
*
@@ -2001,6 +2179,27 @@ void pri_cc_status(struct pri *ctrl, long cc_id, int status);
int pri_cc_call(struct pri *ctrl, long cc_id, q931_call *call, struct pri_sr *req);
void pri_cc_cancel(struct pri *ctrl, long cc_id);
/* Date/time ie send policy option values. */
#define PRI_DATE_TIME_SEND_DEFAULT 0 /*!< Send date/time ie default. */
#define PRI_DATE_TIME_SEND_NO 1 /*!< Send date/time ie never. */
#define PRI_DATE_TIME_SEND_DATE 2 /*!< Send date/time ie date only. */
#define PRI_DATE_TIME_SEND_DATE_HH 3 /*!< Send date/time ie date and hour. */
#define PRI_DATE_TIME_SEND_DATE_HHMM 4 /*!< Send date/time ie date, hour, and minute. */
#define PRI_DATE_TIME_SEND_DATE_HHMMSS 5 /*!< Send date/time ie date, hour, minute, and second. */
/*!
* \brief Set the date/time ie send policy option.
*
* \param ctrl D channel controller.
* \param option Policy option to set.
*
* \note
* Only valid in NT mode.
*
* \return Nothing
*/
void pri_date_time_send_option(struct pri *ctrl, int option);
/* Get/Set PRI Timers */
#define PRI_GETSET_TIMERS
int pri_set_timer(struct pri *pri, int timer, int value);
@@ -2032,7 +2231,7 @@ enum PRI_TIMERS_AND_COUNTERS {
PRI_TIMER_T310, /*!< Maximum time between receiving a CALL_PROCEEDING and receiving a ALERT/CONNECT/DISCONNECT/PROGRESS */
PRI_TIMER_T313, /*!< Wait for CONNECT acknowledge, CPE side only */
PRI_TIMER_T314,
PRI_TIMER_T316, /*!< Maximum time between transmitting a RESTART and receiving a RESTART ACK */
PRI_TIMER_T316, /*!< Time to wait for a RESTART ACK before retransmitting RESTART. (Timer enabled if greater than zero.) */
PRI_TIMER_T317,
PRI_TIMER_T318,
PRI_TIMER_T319,
@@ -2073,6 +2272,9 @@ enum PRI_TIMERS_AND_COUNTERS {
PRI_TIMER_QSIG_CC_T3, /*!< Max time to wait for user A to respond to user B availability. */
PRI_TIMER_QSIG_CC_T4, /*!< Path reservation supervision timeout. */
PRI_TIMER_T312, /*!< Supervise broadcast SETUP message call reference retention. */
PRI_TIMER_N316, /*!< Number of times to transmit RESTART before giving up if T316 enabled. */
/* Must be last in the enum list */
PRI_MAX_TIMERS
};

426
pri.c
View File

@@ -77,9 +77,11 @@ static const struct pri_timer_table pri_timer[] = {
{ "T308", PRI_TIMER_T308, PRI_ALL_SWITCHES },
{ "T309", PRI_TIMER_T309, PRI_ALL_SWITCHES },
{ "T310", PRI_TIMER_T310, PRI_ALL_SWITCHES },
{ "T312", PRI_TIMER_T312, PRI_ALL_SWITCHES },
{ "T313", PRI_TIMER_T313, PRI_ALL_SWITCHES },
{ "T314", PRI_TIMER_T314, PRI_ALL_SWITCHES },
{ "T316", PRI_TIMER_T316, PRI_ALL_SWITCHES },
{ "N316", PRI_TIMER_N316, PRI_ALL_SWITCHES },
{ "T317", PRI_TIMER_T317, PRI_ALL_SWITCHES },
{ "T318", PRI_TIMER_T318, PRI_ALL_SWITCHES },
{ "T319", PRI_TIMER_T319, PRI_ALL_SWITCHES },
@@ -174,14 +176,19 @@ static void pri_default_timers(struct pri *ctrl, int switchtype)
ctrl->timers[PRI_TIMER_T200] = 1000; /* Time between SABME's */
ctrl->timers[PRI_TIMER_T201] = ctrl->timers[PRI_TIMER_T200];/* Time between TEI Identity Checks (Default same as T200) */
ctrl->timers[PRI_TIMER_T202] = 10 * 1000; /* Min time between transmission of TEI Identity request messages */
ctrl->timers[PRI_TIMER_T202] = 2 * 1000; /* Min time between transmission of TEI Identity request messages */
ctrl->timers[PRI_TIMER_T203] = 10 * 1000; /* Max time without exchanging packets */
ctrl->timers[PRI_TIMER_T303] = 4 * 1000; /* Length between SETUP retransmissions and timeout */
ctrl->timers[PRI_TIMER_T305] = 30 * 1000; /* Wait for DISCONNECT acknowledge */
ctrl->timers[PRI_TIMER_T308] = 4 * 1000; /* Wait for RELEASE acknowledge */
ctrl->timers[PRI_TIMER_T309] = 6 * 1000; /* Time to wait before clearing calls in case of D-channel transient event. Q.931 specifies 6-90 seconds */
ctrl->timers[PRI_TIMER_T312] = (4 + 2) * 1000;/* Supervise broadcast SETUP message call reference retention. T303 + 2 seconds */
ctrl->timers[PRI_TIMER_T313] = 4 * 1000; /* Wait for CONNECT acknowledge, CPE side only */
#if 0 /* Default disable the T316 timer otherwise the user cannot disable it. */
ctrl->timers[PRI_TIMER_T316] = 2 * 60 * 1000; /* RESTART retransmit timer */
#endif
ctrl->timers[PRI_TIMER_N316] = 2; /* Send RESTART this many times before giving up. */
ctrl->timers[PRI_TIMER_TM20] = 2500; /* Max time awaiting XID response - Q.921 Appendix IV */
ctrl->timers[PRI_TIMER_NM20] = 3; /* Number of XID retransmits - Q.921 Appendix IV */
@@ -288,6 +295,102 @@ static int __pri_write(struct pri *pri, void *buf, int buflen)
return res;
}
/*!
* \internal
* \brief Determine the default layer 2 persistence option.
*
* \param ctrl D channel controller.
*
* \return Default layer 2 persistence option. (legacy behaviour default)
*/
static enum pri_layer2_persistence pri_l2_persistence_option_default(struct pri *ctrl)
{
enum pri_layer2_persistence persistence;
if (PTMP_MODE(ctrl)) {
persistence = PRI_L2_PERSISTENCE_LEAVE_DOWN;
} else {
persistence = PRI_L2_PERSISTENCE_KEEP_UP;
}
return persistence;
}
/*!
* \internal
* \brief Determine the default display text send options.
*
* \param ctrl D channel controller.
*
* \return Default display text send options. (legacy behaviour defaults)
*/
static unsigned long pri_display_options_send_default(struct pri *ctrl)
{
unsigned long flags;
switch (ctrl->switchtype) {
case PRI_SWITCH_QSIG:
flags = PRI_DISPLAY_OPTION_BLOCK;
break;
case PRI_SWITCH_EUROISDN_E1:
case PRI_SWITCH_EUROISDN_T1:
if (ctrl->localtype == PRI_CPE) {
flags = PRI_DISPLAY_OPTION_BLOCK;
break;
}
flags = PRI_DISPLAY_OPTION_NAME_INITIAL;
break;
default:
flags = PRI_DISPLAY_OPTION_NAME_INITIAL;
break;
}
return flags;
}
/*!
* \internal
* \brief Determine the default display text receive options.
*
* \param ctrl D channel controller.
*
* \return Default display text receive options. (legacy behaviour defaults)
*/
static unsigned long pri_display_options_receive_default(struct pri *ctrl)
{
unsigned long flags;
switch (ctrl->switchtype) {
case PRI_SWITCH_QSIG:
flags = PRI_DISPLAY_OPTION_BLOCK;
break;
default:
flags = PRI_DISPLAY_OPTION_NAME_INITIAL;
break;
}
return flags;
}
/*!
* \internal
* \brief Determine the default date/time send option default.
*
* \param ctrl D channel controller.
*
* \return Default date/time send option.
*/
static int pri_date_time_send_default(struct pri *ctrl)
{
int date_time_send;
if (BRI_NT_PTMP(ctrl)) {
date_time_send = PRI_DATE_TIME_SEND_DATE_HHMM;
} else {
date_time_send = PRI_DATE_TIME_SEND_NO;
}
return date_time_send;
}
/*!
* \brief Destroy the given link.
*
@@ -476,12 +579,14 @@ static struct pri *pri_ctrl_new(int fd, int node, int switchtype, pri_io_cb rd,
ctrl->nsf = PRI_NSF_NONE;
ctrl->callpool = &ctrl->localpool;
pri_default_timers(ctrl, switchtype);
#ifdef LIBPRI_COUNTERS
ctrl->q921_rxcount = 0;
ctrl->q921_txcount = 0;
ctrl->q931_rxcount = 0;
ctrl->q931_txcount = 0;
#endif
ctrl->l2_persistence = pri_l2_persistence_option_default(ctrl);
ctrl->display_flags.send = pri_display_options_send_default(ctrl);
ctrl->display_flags.receive = pri_display_options_receive_default(ctrl);
switch (switchtype) {
case PRI_SWITCH_GR303_EOC:
ctrl->protodisc = GR303_PROTOCOL_DISCRIMINATOR;
@@ -508,6 +613,7 @@ static struct pri *pri_ctrl_new(int fd, int node, int switchtype, pri_io_cb rd,
tei);
break;
}
ctrl->date_time_send = pri_date_time_send_default(ctrl);
if (dummy_ctrl) {
/* Initialize the dummy call reference call record. */
ctrl->link.dummy_call = &dummy_ctrl->dummy_call;
@@ -833,7 +939,15 @@ int pri_need_more_info(struct pri *pri, q931_call *call, int channel, int nonisd
if (!pri || !pri_is_call_valid(pri, call)) {
return -1;
}
return q931_setup_ack(pri, call, channel, nonisdn);
return q931_setup_ack(pri, call, channel, nonisdn, 0);
}
int pri_setup_ack(struct pri *ctrl, q931_call *call, int channel, int nonisdn, int inband)
{
if (!ctrl || !pri_is_call_valid(ctrl, call)) {
return -1;
}
return q931_setup_ack(ctrl, call, channel, nonisdn, inband);
}
int pri_answer(struct pri *pri, q931_call *call, int channel, int nonisdn)
@@ -872,7 +986,7 @@ void pri_copy_party_name_to_q931(struct q931_party_name *q931_name, const struct
q931_party_name_init(q931_name);
if (pri_name->valid) {
q931_name->valid = 1;
q931_name->presentation = pri_name->presentation;
q931_name->presentation = pri_name->presentation & PRI_PRES_RESTRICTION;
q931_name->char_set = pri_name->char_set;
libpri_copy_string(q931_name->str, pri_name->str, sizeof(q931_name->str));
}
@@ -891,7 +1005,8 @@ void pri_copy_party_number_to_q931(struct q931_party_number *q931_number, const
q931_party_number_init(q931_number);
if (pri_number->valid) {
q931_number->valid = 1;
q931_number->presentation = pri_number->presentation;
q931_number->presentation = pri_number->presentation
& (PRI_PRES_RESTRICTION | PRI_PRES_NUMBER_TYPE);
q931_number->plan = pri_number->plan;
libpri_copy_string(q931_number->str, pri_number->str, sizeof(q931_number->str));
}
@@ -949,6 +1064,9 @@ int pri_connected_line_update(struct pri *ctrl, q931_call *call, const struct pr
{
struct q931_party_id party_id;
unsigned idx;
unsigned new_name;
unsigned new_number;
unsigned new_subaddress;
struct q931_call *subcall;
if (!ctrl || !pri_is_call_valid(ctrl, call)) {
@@ -957,13 +1075,14 @@ int pri_connected_line_update(struct pri *ctrl, q931_call *call, const struct pr
pri_copy_party_id_to_q931(&party_id, &connected->id);
q931_party_id_fixup(ctrl, &party_id);
if (!q931_party_id_cmp(&party_id, &call->local_id)) {
/* The local party information did not change so do nothing. */
return 0;
}
call->local_id = party_id;
/* Update all subcalls with new local_id. */
new_name = q931_party_name_cmp(&party_id.name, &call->local_id.name);
new_number = q931_party_number_cmp(&party_id.number, &call->local_id.number);
new_subaddress = party_id.subaddress.valid
&& q931_party_subaddress_cmp(&party_id.subaddress, &call->local_id.subaddress);
/* Update the call and all subcalls with new local_id. */
call->local_id = party_id;
if (call->outboundbroadcast && call->master_call == call) {
for (idx = 0; idx < ARRAY_LEN(call->subcalls); ++idx) {
subcall = call->subcalls[idx];
@@ -982,23 +1101,100 @@ int pri_connected_line_update(struct pri *ctrl, q931_call *call, const struct pr
* The local party transferred to someone else before
* the remote end answered.
*/
switch (ctrl->switchtype) {
case PRI_SWITCH_EUROISDN_E1:
case PRI_SWITCH_EUROISDN_T1:
if (BRI_NT_PTMP(ctrl)) {
/*
* NT PTMP mode
*
* We should not send these messages to the network if we are
* the CPE side since phones do not transfer calls within
* themselves. Well... If you consider handing the handset to
* someone else a transfer then how is the network to know?
*/
if (new_number) {
q931_notify_redirection(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,
&party_id.name, &party_id.number);
}
if (new_subaddress || (party_id.subaddress.valid && new_number)) {
q931_subaddress_transfer(ctrl, call);
}
} else if (PTP_MODE(ctrl)) {
/* PTP mode */
if (new_number) {
/* Immediately send EctInform APDU, callStatus=answered(0) */
send_call_transfer_complete(ctrl, call, 0);
}
if (new_subaddress || (party_id.subaddress.valid && new_number)) {
q931_subaddress_transfer(ctrl, call);
}
}
break;
case PRI_SWITCH_QSIG:
if (new_name || new_number) {
/* Immediately send CallTransferComplete APDU, callStatus=answered(0) */
send_call_transfer_complete(ctrl, call, 0);
}
if (new_subaddress
|| (party_id.subaddress.valid && (new_name || new_number))) {
q931_subaddress_transfer(ctrl, call);
}
break;
default:
break;
}
break;
case Q931_CALL_STATE_ACTIVE:
switch (ctrl->switchtype) {
case PRI_SWITCH_EUROISDN_E1:
case PRI_SWITCH_EUROISDN_T1:
if (PTMP_MODE(ctrl)) {
/* PTMP mode */
q931_notify_redirection(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,
&call->local_id.number);
} else {
if (BRI_NT_PTMP(ctrl)) {
/*
* NT PTMP mode
*
* We should not send these messages to the network if we are
* the CPE side since phones do not transfer calls within
* themselves. Well... If you consider handing the handset to
* someone else a transfer then how is the network to know?
*/
if (new_number) {
#if defined(USE_NOTIFY_FOR_ECT)
/*
* Some ISDN phones only handle the NOTIFY message that the
* EN 300-369 spec says should be sent only if the call has not
* connected yet.
*/
q931_notify_redirection(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,
&party_id.name, &party_id.number);
#else
q931_request_subaddress(ctrl, call, PRI_NOTIFY_TRANSFER_ACTIVE,
&party_id.name, &party_id.number);
#endif /* defined(USE_NOTIFY_FOR_ECT) */
}
if (new_subaddress || (party_id.subaddress.valid && new_number)) {
q931_subaddress_transfer(ctrl, call);
}
} else if (PTP_MODE(ctrl)) {
/* PTP mode */
/* Immediately send EctInform APDU, callStatus=answered(0) */
send_call_transfer_complete(ctrl, call, 0);
if (new_number) {
/* Immediately send EctInform APDU, callStatus=answered(0) */
send_call_transfer_complete(ctrl, call, 0);
}
if (new_subaddress || (party_id.subaddress.valid && new_number)) {
q931_subaddress_transfer(ctrl, call);
}
}
break;
case PRI_SWITCH_QSIG:
/* Immediately send CallTransferComplete APDU, callStatus=answered(0) */
send_call_transfer_complete(ctrl, call, 0);
if (new_name || new_number) {
/* Immediately send CallTransferComplete APDU, callStatus=answered(0) */
send_call_transfer_complete(ctrl, call, 0);
}
if (new_subaddress
|| (party_id.subaddress.valid && (new_name || new_number))) {
q931_subaddress_transfer(ctrl, call);
}
break;
default:
break;
@@ -1078,9 +1274,18 @@ int pri_redirecting_update(struct pri *ctrl, q931_call *call, const struct pri_p
case PRI_SWITCH_EUROISDN_E1:
case PRI_SWITCH_EUROISDN_T1:
if (PTMP_MODE(ctrl)) {
/* PTMP mode */
q931_notify_redirection(ctrl, call, PRI_NOTIFY_CALL_DIVERTING,
&call->redirecting.to.number);
if (NT_MODE(ctrl)) {
/*
* NT PTMP mode
*
* We should not send these messages to the network if we are
* the CPE side since phones do not redirect calls within
* themselves. Well... If you consider someone else picking up
* the handset a redirection then how is the network to know?
*/
q931_notify_redirection(ctrl, call, PRI_NOTIFY_CALL_DIVERTING, NULL,
&call->redirecting.to.number);
}
break;
}
/* PTP mode - same behaviour as Q.SIG */
@@ -1563,11 +1768,13 @@ char *pri_dump_info_str(struct pri *ctrl)
char *buf;
size_t buf_size;
size_t used;
#ifdef LIBPRI_COUNTERS
struct q921_frame *f;
struct q921_link *link;
struct pri_cc_record *cc_record;
struct q931_call *call;
unsigned num_calls;
unsigned num_globals;
unsigned q921outstanding;
#endif
unsigned idx;
unsigned long switch_bit;
@@ -1585,8 +1792,30 @@ char *pri_dump_info_str(struct pri *ctrl)
used = 0;
used = pri_snprintf(buf, used, buf_size, "Switchtype: %s\n",
pri_switch2str(ctrl->switchtype));
used = pri_snprintf(buf, used, buf_size, "Type: %s\n", pri_node2str(ctrl->localtype));
#ifdef LIBPRI_COUNTERS
used = pri_snprintf(buf, used, buf_size, "Type: %s%s%s\n",
ctrl->bri ? "BRI " : "",
pri_node2str(ctrl->localtype),
PTMP_MODE(ctrl) ? " PTMP" : "");
used = pri_snprintf(buf, used, buf_size, "Remote type: %s\n",
pri_node2str(ctrl->remotetype));
used = pri_snprintf(buf, used, buf_size, "Overlap Dial: %d\n", ctrl->overlapdial);
used = pri_snprintf(buf, used, buf_size, "Logical Channel Mapping: %d\n",
ctrl->chan_mapping_logical);
used = pri_snprintf(buf, used, buf_size, "Timer and counter settings:\n");
switch_bit = PRI_BIT(ctrl->switchtype);
for (idx = 0; idx < ARRAY_LEN(pri_timer); ++idx) {
if (pri_timer[idx].used_by & switch_bit) {
enum PRI_TIMERS_AND_COUNTERS tmr;
tmr = pri_timer[idx].number;
if (0 <= ctrl->timers[tmr]
|| tmr == PRI_TIMER_T316) {
used = pri_snprintf(buf, used, buf_size, " %s: %d\n",
pri_timer[idx].name, ctrl->timers[tmr]);
}
}
}
/* Remember that Q921 Counters include Q931 packets (and any retransmissions) */
used = pri_snprintf(buf, used, buf_size, "Q931 RX: %d\n", ctrl->q931_rxcount);
used = pri_snprintf(buf, used, buf_size, "Q931 TX: %d\n", ctrl->q931_txcount);
@@ -1600,30 +1829,37 @@ char *pri_dump_info_str(struct pri *ctrl)
used = pri_snprintf(buf, used, buf_size, "Q921 Outstanding: %u (TEI=%d)\n",
q921outstanding, link->tei);
}
#endif
#if 0
used = pri_snprintf(buf, used, buf_size, "Window Length: %d/%d\n",
ctrl->timers[PRI_TIMER_K], ctrl->window);
used = pri_snprintf(buf, used, buf_size, "Sentrej: %d\n", ctrl->sentrej);
used = pri_snprintf(buf, used, buf_size, "SolicitFbit: %d\n", ctrl->solicitfbit);
used = pri_snprintf(buf, used, buf_size, "Retrans: %d\n", ctrl->retrans);
used = pri_snprintf(buf, used, buf_size, "Busy: %d\n", ctrl->busy);
#endif
used = pri_snprintf(buf, used, buf_size, "Overlap Dial: %d\n", ctrl->overlapdial);
used = pri_snprintf(buf, used, buf_size, "Logical Channel Mapping: %d\n",
ctrl->chan_mapping_logical);
used = pri_snprintf(buf, used, buf_size, "Timer and counter settings:\n");
switch_bit = PRI_BIT(ctrl->switchtype);
for (idx = 0; idx < ARRAY_LEN(pri_timer); ++idx) {
if (pri_timer[idx].used_by & switch_bit) {
enum PRI_TIMERS_AND_COUNTERS tmr;
tmr = pri_timer[idx].number;
if (0 <= ctrl->timers[tmr]) {
used = pri_snprintf(buf, used, buf_size, " %s: %d\n",
pri_timer[idx].name, ctrl->timers[tmr]);
}
/* Count the call records in existance. Useful to check for unreleased calls. */
num_calls = 0;
num_globals = 0;
for (call = *ctrl->callpool; call; call = call->next) {
if (!(call->cr & ~Q931_CALL_REFERENCE_FLAG)) {
++num_globals;
continue;
}
++num_calls;
if (call->outboundbroadcast) {
used = pri_snprintf(buf, used, buf_size,
"Master call subcall count: %d\n", q931_get_subcall_count(call));
}
}
used = pri_snprintf(buf, used, buf_size, "Total active-calls:%u global:%u\n",
num_calls, num_globals);
/*
* List simplified call completion records.
*
* This should be last in the output because it could overflow
* the buffer.
*/
used = pri_snprintf(buf, used, buf_size, "CC records:\n");
for (cc_record = ctrl->cc.pool; cc_record; cc_record = cc_record->next) {
used = pri_snprintf(buf, used, buf_size,
" %ld A:%s B:%s state:%s\n", cc_record->record_id,
cc_record->party_a.number.valid ? cc_record->party_a.number.str : "",
cc_record->party_b.number.valid ? cc_record->party_b.number.str : "",
pri_cc_fsm_state_str(cc_record->state));
}
if (buf_size < used) {
@@ -1667,7 +1903,7 @@ void pri_enslave(struct pri *master, struct pri *slave)
/* Swap master and slave. */
swp = master;
master = slave;
slave = master;
slave = swp;
}
/*
@@ -1741,13 +1977,14 @@ int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int cal
q931_party_id_init(&sr->caller);
if (caller) {
sr->caller.number.valid = 1;
sr->caller.number.presentation = callerpres;
sr->caller.number.presentation = callerpres
& (PRI_PRES_RESTRICTION | PRI_PRES_NUMBER_TYPE);
sr->caller.number.plan = callerplan;
libpri_copy_string(sr->caller.number.str, caller, sizeof(sr->caller.number.str));
if (callername) {
sr->caller.name.valid = 1;
sr->caller.name.presentation = callerpres;
sr->caller.name.presentation = callerpres & PRI_PRES_RESTRICTION;
sr->caller.name.char_set = PRI_CHAR_SET_ISO8859_1;
libpri_copy_string(sr->caller.name.str, callername,
sizeof(sr->caller.name.str));
@@ -1771,7 +2008,8 @@ int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int
q931_party_redirecting_init(&sr->redirecting);
if (num && num[0]) {
sr->redirecting.from.number.valid = 1;
sr->redirecting.from.number.presentation = pres;
sr->redirecting.from.number.presentation = pres
& (PRI_PRES_RESTRICTION | PRI_PRES_NUMBER_TYPE);
sr->redirecting.from.number.plan = plan;
libpri_copy_string(sr->redirecting.from.number.str, num,
sizeof(sr->redirecting.from.number.str));
@@ -1965,3 +2203,83 @@ void pri_cc_retain_signaling_rsp(struct pri *ctrl, int signaling_retention)
ctrl->cc.option.signaling_retention_rsp = signaling_retention ? 1 : 0;
}
}
void pri_persistent_layer2_option(struct pri *ctrl, enum pri_layer2_persistence option)
{
if (!ctrl) {
return;
}
if (PTMP_MODE(ctrl)) {
switch (option) {
case PRI_L2_PERSISTENCE_DEFAULT:
ctrl->l2_persistence = pri_l2_persistence_option_default(ctrl);
break;
case PRI_L2_PERSISTENCE_KEEP_UP:
case PRI_L2_PERSISTENCE_LEAVE_DOWN:
ctrl->l2_persistence = option;
break;
}
if (ctrl->l2_persistence == PRI_L2_PERSISTENCE_KEEP_UP) {
q921_bring_layer2_up(ctrl);
}
}
}
void pri_display_options_send(struct pri *ctrl, unsigned long flags)
{
if (!ctrl) {
return;
}
if (!flags) {
flags = pri_display_options_send_default(ctrl);
}
ctrl->display_flags.send = flags;
}
void pri_display_options_receive(struct pri *ctrl, unsigned long flags)
{
if (!ctrl) {
return;
}
if (!flags) {
flags = pri_display_options_receive_default(ctrl);
}
ctrl->display_flags.receive = flags;
}
int pri_display_text(struct pri *ctrl, q931_call *call, const struct pri_subcmd_display_txt *display)
{
if (!ctrl || !display || display->length <= 0
|| sizeof(display->text) < display->length || !pri_is_call_valid(ctrl, call)) {
/* Parameter sanity checks failed. */
return -1;
}
return q931_display_text(ctrl, call, display);
}
void pri_date_time_send_option(struct pri *ctrl, int option)
{
if (!ctrl) {
return;
}
switch (option) {
case PRI_DATE_TIME_SEND_DEFAULT:
ctrl->date_time_send = pri_date_time_send_default(ctrl);
break;
default:
case PRI_DATE_TIME_SEND_NO:
ctrl->date_time_send = PRI_DATE_TIME_SEND_NO;
break;
case PRI_DATE_TIME_SEND_DATE:
case PRI_DATE_TIME_SEND_DATE_HH:
case PRI_DATE_TIME_SEND_DATE_HHMM:
case PRI_DATE_TIME_SEND_DATE_HHMMSS:
if (NT_MODE(ctrl)) {
/* Only networks may send date/time ie. */
ctrl->date_time_send = option;
} else {
ctrl->date_time_send = PRI_DATE_TIME_SEND_NO;
}
break;
}
}

View File

@@ -2219,8 +2219,7 @@ void pri_cc_ptp_request(struct pri *ctrl, q931_call *call, int msgtype, const st
party_a.number.presentation =
PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED;
} else {
party_a.number.presentation =
PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_UNSCREENED;
party_a.number.presentation = PRES_NUMBER_NOT_AVAILABLE;
}
} else {
party_a.number.presentation =
@@ -2504,14 +2503,13 @@ void pri_cc_qsig_exec_possible(struct pri *ctrl, q931_call *call, int msgtype, c
}
/*!
* \internal
* \brief Convert the given call completion state to a string.
*
* \param state CC state to convert to string.
*
* \return String version of call completion state.
*/
static const char *pri_cc_fsm_state_str(enum CC_STATES state)
const char *pri_cc_fsm_state_str(enum CC_STATES state)
{
const char *str;
@@ -2555,14 +2553,13 @@ static const char *pri_cc_fsm_state_str(enum CC_STATES state)
}
/*!
* \internal
* \brief Convert the given call completion event to a string.
*
* \param event CC event to convert to string.
*
* \return String version of call completion event.
*/
static const char *pri_cc_fsm_event_str(enum CC_EVENTS event)
const char *pri_cc_fsm_event_str(enum CC_EVENTS event)
{
const char *str;

View File

@@ -632,6 +632,9 @@ void rose_copy_presented_number_screened_to_q931(struct pri *ctrl,
rose_copy_number_to_q931(ctrl, q931_number,
&rose_presented->screened.number);
break;
case 2: /* numberNotAvailableDueToInterworking */
q931_number->presentation = PRES_NUMBER_NOT_AVAILABLE;
break;
default:
q931_number->presentation |= PRI_PRES_USER_NUMBER_UNSCREENED;
break;
@@ -660,6 +663,9 @@ void rose_copy_presented_number_unscreened_to_q931(struct pri *ctrl,
case 3: /* presentationRestrictedNumber */
rose_copy_number_to_q931(ctrl, q931_number, &rose_presented->number);
break;
case 2: /* numberNotAvailableDueToInterworking */
q931_number->presentation = PRES_NUMBER_NOT_AVAILABLE;
break;
default:
break;
}
@@ -693,6 +699,9 @@ void rose_copy_presented_address_screened_to_id_q931(struct pri *ctrl,
rose_copy_subaddress_to_q931(ctrl, &q931_address->subaddress,
&rose_presented->screened.subaddress);
break;
case 2: /* numberNotAvailableDueToInterworking */
q931_address->number.presentation = PRES_NUMBER_NOT_AVAILABLE;
break;
default:
q931_address->number.presentation |= PRI_PRES_USER_NUMBER_UNSCREENED;
break;
@@ -1746,11 +1755,11 @@ int mwi_message_send(struct pri *ctrl, q931_call *call, struct pri_sr *req, int
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode the facility ie contents.
* \param end End of facility ie contents encoding data buffer.
* \param mailbox Controlling party number (NULL if not present).
* \param vm_id Controlling party number (NULL if not present).
* \param basic_service Basic service enum (-1 if not present).
* \param num_messages NumberOfMessages (-1 if not present).
* \param caller_id Controlling party privided number (NULL if not present).
* \param timestamp Generalized Time format (NULL if not present).
* \param timestamp When message left. (Generalized Time format, NULL if not present)
* \param message_reference Message reference number (-1 if not present).
* \param message_status Message status: added(0), removed(1).
*
@@ -1758,7 +1767,7 @@ int mwi_message_send(struct pri *ctrl, q931_call *call, struct pri_sr *req, int
* \retval NULL on error.
*/
static unsigned char *enc_etsi_mwi_indicate_message(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct pri_party_id *mailbox, int basic_service,
unsigned char *end, const struct pri_party_id *vm_id, int basic_service,
int num_messages, const struct pri_party_id *caller_id, const char *timestamp,
int message_reference, int message_status)
{
@@ -1774,8 +1783,8 @@ static unsigned char *enc_etsi_mwi_indicate_message(struct pri *ctrl, unsigned c
msg.operation = ROSE_ETSI_MWIIndicate;
msg.invoke_id = get_invokeid(ctrl);
if (mailbox && mailbox->number.valid) {
pri_copy_party_number_to_q931(&number, &mailbox->number);
if (vm_id && vm_id->number.valid) {
pri_copy_party_number_to_q931(&number, &vm_id->number);
q931_copy_number_to_rose(ctrl, &msg.args.etsi.MWIIndicate.controlling_user_number,
&number);
}
@@ -1814,11 +1823,11 @@ static unsigned char *enc_etsi_mwi_indicate_message(struct pri *ctrl, unsigned c
*
* \param ctrl D channel controller.
* \param call Call leg to queue message.
* \param mailbox Controlling party number (NULL if not present).
* \param vm_id Voicemail system number (NULL if not present).
* \param basic_service Basic service enum (-1 if not present).
* \param num_messages NumberOfMessages (-1 if not present).
* \param caller_id Controlling party privided number (NULL if not present).
* \param timestamp Generalized Time format (NULL if not present).
* \param caller_id Party leaving message (NULL if not present).
* \param timestamp When message left. (Generalized Time format, NULL if not present)
* \param message_reference Message reference number (-1 if not present).
* \param message_status Message status: added(0), removed(1).
*
@@ -1826,14 +1835,14 @@ static unsigned char *enc_etsi_mwi_indicate_message(struct pri *ctrl, unsigned c
* \retval -1 on error.
*/
static int rose_mwi_indicate_encode(struct pri *ctrl, struct q931_call *call,
const struct pri_party_id *mailbox, int basic_service, int num_messages,
const struct pri_party_id *vm_id, int basic_service, int num_messages,
const struct pri_party_id *caller_id, const char *timestamp, int message_reference,
int message_status)
{
unsigned char buffer[255];
unsigned char *end;
end = enc_etsi_mwi_indicate_message(ctrl, buffer, buffer + sizeof(buffer), mailbox,
end = enc_etsi_mwi_indicate_message(ctrl, buffer, buffer + sizeof(buffer), vm_id,
basic_service, num_messages, caller_id, timestamp, message_reference,
message_status);
if (!end) {
@@ -1843,11 +1852,13 @@ static int rose_mwi_indicate_encode(struct pri *ctrl, struct q931_call *call,
return pri_call_apdu_queue(call, Q931_FACILITY, buffer, end - buffer, NULL);
}
int pri_mwi_indicate(struct pri *ctrl, const struct pri_party_id *mailbox,
int basic_service, int num_messages, const struct pri_party_id *caller_id,
const char *timestamp, int message_reference, int message_status)
int pri_mwi_indicate_v2(struct pri *ctrl, const struct pri_party_id *mailbox,
const struct pri_party_id *vm_id, int basic_service, int num_messages,
const struct pri_party_id *caller_id, const char *timestamp, int message_reference,
int message_status)
{
struct q931_call *call;
struct q931_party_id called;
if (!ctrl) {
return -1;
@@ -1868,9 +1879,11 @@ int pri_mwi_indicate(struct pri *ctrl, const struct pri_party_id *mailbox,
return -1;
}
if (rose_mwi_indicate_encode(ctrl, call, mailbox, basic_service, num_messages,
pri_copy_party_id_to_q931(&called, mailbox);
q931_party_id_fixup(ctrl, &called);
if (rose_mwi_indicate_encode(ctrl, call, vm_id, basic_service, num_messages,
caller_id, timestamp, message_reference, message_status)
|| q931_facility(ctrl, call)) {
|| q931_facility_called(ctrl, call, &called)) {
pri_message(ctrl,
"Could not schedule facility message for MWI indicate message.\n");
return -1;
@@ -1878,6 +1891,14 @@ int pri_mwi_indicate(struct pri *ctrl, const struct pri_party_id *mailbox,
return 0;
}
int pri_mwi_indicate(struct pri *ctrl, const struct pri_party_id *mailbox,
int basic_service, int num_messages, const struct pri_party_id *caller_id,
const char *timestamp, int message_reference, int message_status)
{
return pri_mwi_indicate_v2(ctrl, mailbox, mailbox, basic_service, num_messages,
caller_id, timestamp, message_reference, message_status);
}
/* End MWI */
/* EECT functions */
@@ -1907,7 +1928,7 @@ static unsigned char *enc_ni2_initiate_transfer(struct pri *ctrl, unsigned char
msg.operation = ROSE_NI2_InitiateTransfer;
msg.invoke_id = get_invokeid(ctrl);
/* Let's do the trickery to make sure the flag is correct */
msg.args.ni2.InitiateTransfer.call_reference = call->cr ^ 0x8000;
msg.args.ni2.InitiateTransfer.call_reference = call->cr ^ Q931_CALL_REFERENCE_FLAG;
pos = rose_encode_invoke(ctrl, pos, end, &msg);
return pos;
@@ -3355,8 +3376,18 @@ int pri_call_add_standard_apdus(struct pri *ctrl, q931_call *call)
*/
int send_call_transfer_complete(struct pri *ctrl, q931_call *call, int call_status)
{
if (rose_call_transfer_complete_encode(ctrl, call, call_status)
|| q931_facility(ctrl, call)) {
int status;
status = rose_call_transfer_complete_encode(ctrl, call, call_status);
if (!status) {
if (!call_status && call->local_id.number.valid
&& (ctrl->display_flags.send & PRI_DISPLAY_OPTION_NAME_UPDATE)) {
status = q931_facility_display_name(ctrl, call, &call->local_id.name);
} else {
status = q931_facility(ctrl, call);
}
}
if (status) {
pri_message(ctrl,
"Could not schedule facility message for call transfer completed.\n");
return -1;
@@ -3365,6 +3396,306 @@ int send_call_transfer_complete(struct pri *ctrl, q931_call *call, int call_stat
return 0;
}
/*!
* \internal
* \brief Encode the ETSI RequestSubaddress invoke message.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode the facility ie contents.
* \param end End of facility ie contents encoding data buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
static unsigned char *enc_etsi_request_subaddress(struct pri *ctrl, unsigned char *pos,
unsigned char *end)
{
struct rose_msg_invoke msg;
pos = facility_encode_header(ctrl, pos, end, NULL);
if (!pos) {
return NULL;
}
memset(&msg, 0, sizeof(msg));
msg.operation = ROSE_ETSI_RequestSubaddress;
msg.invoke_id = get_invokeid(ctrl);
pos = rose_encode_invoke(ctrl, pos, end, &msg);
return pos;
}
/*!
* \brief Encode and queue the RequestSubaddress invoke message.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param call Call leg from which to encode message.
*
* \retval 0 on success.
* \retval -1 on error.
*/
int rose_request_subaddress_encode(struct pri *ctrl, struct q931_call *call)
{
unsigned char buffer[256];
unsigned char *end;
switch (ctrl->switchtype) {
case PRI_SWITCH_EUROISDN_E1:
case PRI_SWITCH_EUROISDN_T1:
end = enc_etsi_request_subaddress(ctrl, buffer, buffer + sizeof(buffer));
break;
case PRI_SWITCH_QSIG:
default:
return -1;
}
if (!end) {
return -1;
}
return pri_call_apdu_queue(call, Q931_FACILITY, buffer, end - buffer, NULL);
}
/*!
* \internal
* \brief Encode the ETSI SubaddressTransfer invoke message.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode the facility ie contents.
* \param end End of facility ie contents encoding data buffer.
* \param call Call leg from which to encode message.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
static unsigned char *enc_etsi_subaddress_transfer(struct pri *ctrl, unsigned char *pos,
unsigned char *end, struct q931_call *call)
{
struct rose_msg_invoke msg;
pos = facility_encode_header(ctrl, pos, end, NULL);
if (!pos) {
return NULL;
}
memset(&msg, 0, sizeof(msg));
msg.operation = ROSE_ETSI_SubaddressTransfer;
msg.invoke_id = get_invokeid(ctrl);
if (!call->local_id.subaddress.valid) {
return NULL;
}
q931_copy_subaddress_to_rose(ctrl, &msg.args.etsi.SubaddressTransfer.subaddress,
&call->local_id.subaddress);
pos = rose_encode_invoke(ctrl, pos, end, &msg);
return pos;
}
/*!
* \internal
* \brief Encode the Q.SIG SubaddressTransfer invoke message.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode the facility ie contents.
* \param end End of facility ie contents encoding data buffer.
* \param call Call leg from which to encode message.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
static unsigned char *enc_qsig_subaddress_transfer(struct pri *ctrl,
unsigned char *pos, unsigned char *end, struct q931_call *call)
{
struct fac_extension_header header;
struct rose_msg_invoke msg;
memset(&header, 0, sizeof(header));
header.nfe_present = 1;
header.nfe.source_entity = 0; /* endPINX */
header.nfe.destination_entity = 0; /* endPINX */
header.interpretation_present = 1;
header.interpretation = 0; /* discardAnyUnrecognisedInvokePdu */
pos = facility_encode_header(ctrl, pos, end, &header);
if (!pos) {
return NULL;
}
memset(&msg, 0, sizeof(msg));
msg.operation = ROSE_QSIG_SubaddressTransfer;
msg.invoke_id = get_invokeid(ctrl);
if (!call->local_id.subaddress.valid) {
return NULL;
}
q931_copy_subaddress_to_rose(ctrl,
&msg.args.qsig.SubaddressTransfer.redirection_subaddress,
&call->local_id.subaddress);
pos = rose_encode_invoke(ctrl, pos, end, &msg);
return pos;
}
/*!
* \internal
* \brief Encode and queue the SubaddressTransfer invoke message.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param call Call leg from which to encode message.
*
* \retval 0 on success.
* \retval -1 on error.
*/
static int rose_subaddress_transfer_encode(struct pri *ctrl, struct q931_call *call)
{
unsigned char buffer[256];
unsigned char *end;
switch (ctrl->switchtype) {
case PRI_SWITCH_EUROISDN_E1:
case PRI_SWITCH_EUROISDN_T1:
end =
enc_etsi_subaddress_transfer(ctrl, buffer, buffer + sizeof(buffer), call);
break;
case PRI_SWITCH_QSIG:
end =
enc_qsig_subaddress_transfer(ctrl, buffer, buffer + sizeof(buffer), call);
break;
default:
return -1;
}
if (!end) {
return -1;
}
return pri_call_apdu_queue(call, Q931_FACILITY, buffer, end - buffer, NULL);
}
/*!
* \brief Send a FACILITY SubaddressTransfer.
*
* \param ctrl D channel controller.
* \param call Q.931 call leg
*
* \retval 0 on success.
* \retval -1 on error.
*/
int send_subaddress_transfer(struct pri *ctrl, struct q931_call *call)
{
if (rose_subaddress_transfer_encode(ctrl, call)
|| q931_facility(ctrl, call)) {
pri_message(ctrl,
"Could not schedule facility message for subaddress transfer.\n");
return -1;
}
return 0;
}
/*!
* \internal
* \brief Handle the received RequestSubaddress facility.
*
* \param ctrl D channel controller.
* \param call Q.931 call leg
*
* \return Nothing
*/
static void etsi_request_subaddress(struct pri *ctrl, struct q931_call *call)
{
struct q931_party_name name;
int changed = 0;
switch (call->notify) {
case PRI_NOTIFY_TRANSFER_ACTIVE:
if (q931_party_number_cmp(&call->remote_id.number, &call->redirection_number)) {
/* The remote party number information changed. */
call->remote_id.number = call->redirection_number;
changed = 1;
}
/* Fall through */
case PRI_NOTIFY_TRANSFER_ALERTING:
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
if (q931_display_name_get(call, &name)) {
if (q931_party_name_cmp(&call->remote_id.name, &name)) {
/* The remote party name information changed. */
call->remote_id.name = name;
changed = 1;
}
}
}
if (call->redirection_number.valid
&& q931_party_number_cmp(&call->remote_id.number, &call->redirection_number)) {
/* The remote party number information changed. */
call->remote_id.number = call->redirection_number;
changed = 1;
}
if (call->remote_id.subaddress.valid) {
/*
* Clear the subaddress as the remote party has been changed.
* Any new subaddress will arrive later.
*/
q931_party_subaddress_init(&call->remote_id.subaddress);
changed = 1;
}
if (changed) {
call->incoming_ct_state = INCOMING_CT_STATE_POST_CONNECTED_LINE;
}
break;
default:
break;
}
/* Send our subaddress back if we have one. */
if (call->local_id.subaddress.valid) {
send_subaddress_transfer(ctrl, call);
}
}
/*!
* \internal
* \brief Handle the received SubaddressTransfer facility subaddress.
*
* \param ctrl D channel controller.
* \param call Q.931 call leg
* \param subaddr Received subaddress of remote party.
*
* \return Nothing
*/
static void handle_subaddress_transfer(struct pri *ctrl, struct q931_call *call, const struct rosePartySubaddress *subaddr)
{
int changed = 0;
struct q931_party_name name;
struct q931_party_subaddress q931_subaddress;
q931_party_subaddress_init(&q931_subaddress);
rose_copy_subaddress_to_q931(ctrl, &q931_subaddress, subaddr);
if (q931_party_subaddress_cmp(&call->remote_id.subaddress, &q931_subaddress)) {
call->remote_id.subaddress = q931_subaddress;
changed = 1;
}
if (call->redirection_number.valid
&& q931_party_number_cmp(&call->remote_id.number, &call->redirection_number)) {
/* The remote party number information changed. */
call->remote_id.number = call->redirection_number;
changed = 1;
}
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
if (q931_display_name_get(call, &name)) {
if (q931_party_name_cmp(&call->remote_id.name, &name)) {
/* The remote party name information changed. */
call->remote_id.name = name;
changed = 1;
}
}
}
if (changed) {
call->incoming_ct_state = INCOMING_CT_STATE_POST_CONNECTED_LINE;
}
}
/*!
* \internal
* \brief Encode a plain facility ETSI error code.
@@ -3641,7 +3972,12 @@ int pri_rerouting_rsp(struct pri *ctrl, q931_call *call, int invoke_id, enum PRI
rose_err = ROSE_ERROR_Gen_ResourceUnavailable;
switch (code) {
case PRI_REROUTING_RSP_OK_CLEAR:
return rose_result_ok_encode(ctrl, call, Q931_DISCONNECT, invoke_id);
/*
* Send the response out on the next message which should be
* either Q931_DISCONNECT or Q931_RELEASE depending upon who
* initiates the disconnect first.
*/
return rose_result_ok_encode(ctrl, call, Q931_ANY_MESSAGE, invoke_id);
case PRI_REROUTING_RSP_OK_RETAIN:
return send_facility_result_ok(ctrl, call, invoke_id);
case PRI_REROUTING_RSP_NOT_SUBSCRIBED:
@@ -4238,8 +4574,7 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
party_id.number.presentation =
PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED;
} else {
party_id.number.presentation =
PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_UNSCREENED;
party_id.number.presentation = PRES_NUMBER_NOT_AVAILABLE;
}
} else {
q931_party_number_init(&party_id.number);
@@ -4382,12 +4717,12 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
}
break;
case ROSE_ETSI_RequestSubaddress:
/* Ignore since we are not handling subaddresses yet. */
etsi_request_subaddress(ctrl, call);
break;
#if 0 /* Not handled yet */
case ROSE_ETSI_SubaddressTransfer:
handle_subaddress_transfer(ctrl, call,
&invoke->args.etsi.SubaddressTransfer.subaddress);
break;
#endif /* Not handled yet */
case ROSE_ETSI_EctLinkIdRequest:
if (!ctrl->transfer_support) {
send_facility_error(ctrl, call, invoke->invoke_id,
@@ -4404,17 +4739,33 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
send_ect_link_id_rsp(ctrl, call, invoke->invoke_id);
break;
case ROSE_ETSI_EctInform:
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
q931_display_name_get(call, &call->remote_id.name);
}
/* redirectionNumber is put in remote_id.number */
if (invoke->args.etsi.EctInform.redirection_present) {
rose_copy_presented_number_unscreened_to_q931(ctrl,
&call->remote_id.number, &invoke->args.etsi.EctInform.redirection);
}
/*
* Clear the subaddress as the remote party has been changed.
* Any new subaddress will arrive later.
*/
q931_party_subaddress_init(&call->remote_id.subaddress);
if (!invoke->args.etsi.EctInform.status) {
/* The remote party for the transfer has not answered yet. */
call->incoming_ct_state = INCOMING_CT_STATE_EXPECT_CT_ACTIVE;
} else {
call->incoming_ct_state = INCOMING_CT_STATE_POST_CONNECTED_LINE;
}
/* Send our subaddress back if we have one. */
if (call->local_id.subaddress.valid) {
send_subaddress_transfer(ctrl, call);
}
break;
case ROSE_ETSI_EctLoopTest:
/*
@@ -4710,6 +5061,10 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
break;
#endif /* Not handled yet */
case ROSE_QSIG_CallingName:
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
q931_display_name_get(call, &call->remote_id.name);
}
/* CallingName is put in remote_id.name */
rose_copy_name_to_q931(ctrl, &call->remote_id.name,
&invoke->args.qsig.CallingName.name);
@@ -4731,6 +5086,10 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
}
break;
case ROSE_QSIG_CalledName:
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
q931_display_name_get(call, &call->remote_id.name);
}
/* CalledName is put in remote_id.name */
rose_copy_name_to_q931(ctrl, &call->remote_id.name,
&invoke->args.qsig.CalledName.name);
@@ -4752,6 +5111,10 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
}
break;
case ROSE_QSIG_ConnectedName:
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
q931_display_name_get(call, &call->remote_id.name);
}
/* ConnectedName is put in remote_id.name */
rose_copy_name_to_q931(ctrl, &call->remote_id.name,
&invoke->args.qsig.ConnectedName.name);
@@ -4803,6 +5166,10 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
break;
#endif /* Not handled yet */
case ROSE_QSIG_CallTransferActive:
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
q931_display_name_get(call, &call->remote_id.name);
}
call->incoming_ct_state = INCOMING_CT_STATE_POST_CONNECTED_LINE;
/* connectedAddress is put in remote_id */
@@ -4816,6 +5183,10 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
}
break;
case ROSE_QSIG_CallTransferComplete:
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
q931_display_name_get(call, &call->remote_id.name);
}
/* redirectionNumber is put in remote_id.number */
rose_copy_presented_number_screened_to_q931(ctrl, &call->remote_id.number,
&invoke->args.qsig.CallTransferComplete.redirection);
@@ -4826,16 +5197,31 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
&invoke->args.qsig.CallTransferComplete.redirection_name);
}
/*
* Clear the subaddress as the remote party has been changed.
* Any new subaddress will arrive later.
*/
q931_party_subaddress_init(&call->remote_id.subaddress);
if (invoke->args.qsig.CallTransferComplete.call_status == 1) {
/* The remote party for the transfer has not answered yet. */
call->incoming_ct_state = INCOMING_CT_STATE_EXPECT_CT_ACTIVE;
} else {
call->incoming_ct_state = INCOMING_CT_STATE_POST_CONNECTED_LINE;
}
/* Send our subaddress back if we have one. */
if (call->local_id.subaddress.valid) {
send_subaddress_transfer(ctrl, call);
}
break;
case ROSE_QSIG_CallTransferUpdate:
party_id = call->remote_id;
if (ctrl->display_flags.receive & PRI_DISPLAY_OPTION_NAME_UPDATE) {
q931_display_name_get(call, &party_id.name);
}
/* redirectionNumber is put in party_id.number */
rose_copy_presented_number_screened_to_q931(ctrl, &party_id.number,
&invoke->args.qsig.CallTransferUpdate.redirection);
@@ -4858,10 +5244,10 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
}
}
break;
#if 0 /* Not handled yet */
case ROSE_QSIG_SubaddressTransfer:
handle_subaddress_transfer(ctrl, call,
&invoke->args.qsig.SubaddressTransfer.redirection_subaddress);
break;
#endif /* Not handled yet */
case ROSE_QSIG_PathReplacement:
anfpr_pathreplacement_respond(ctrl, call, ie);
break;
@@ -5167,8 +5553,9 @@ void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie
#endif /* Not handled yet */
default:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, "!! ROSE invoke operation not handled! %s\n",
rose_operation2str(invoke->operation));
pri_message(ctrl,
"!! ROSE invoke operation not handled on switchtype:%s! %s\n",
pri_switch2str(ctrl->switchtype), rose_operation2str(invoke->operation));
}
break;
}

View File

@@ -221,6 +221,8 @@ int qsig_cf_callrerouting(struct pri *pri, q931_call *c, const char* dest, const
int send_reroute_request(struct pri *ctrl, q931_call *call, const struct q931_party_id *caller, const struct q931_party_redirecting *deflection, int subscription_option);
int send_call_transfer_complete(struct pri *pri, q931_call *call, int call_status);
int rose_request_subaddress_encode(struct pri *ctrl, struct q931_call *call);
int send_subaddress_transfer(struct pri *ctrl, struct q931_call *call);
int rose_diverting_leg_information1_encode(struct pri *pri, q931_call *call);
int rose_diverting_leg_information3_encode(struct pri *pri, q931_call *call, int messagetype);

View File

@@ -60,6 +60,9 @@ struct pri_sched {
/*! Maximum number of facility ie's to handle per incoming message. */
#define MAX_FACILITY_IES 8
/*! Maximum length of sent display text string. (No null terminator.) */
#define MAX_DISPLAY_TEXT 80
/*! Accumulated pri_message() line until a '\n' is seen on the end. */
struct pri_msg_line {
/*! Accumulated buffer used. */
@@ -87,6 +90,8 @@ struct pri {
unsigned num_slots;
/*! Maximum timer slots currently needed. */
unsigned max_used;
/*! First timer id in this timer pool. */
unsigned first_id;
} sched;
int debug; /* Debug stuff */
int state; /* State of D-channel */
@@ -115,6 +120,8 @@ struct pri {
/*! Layer 2 link control for D channel. */
struct q921_link link;
/*! Layer 2 persistence option. */
enum pri_layer2_persistence l2_persistence;
/*! T201 TEI Identity Check timer. */
int t201_timer;
/*! Number of times T201 has expired. */
@@ -135,13 +142,11 @@ struct pri {
struct q931_call **callpool;
struct q931_call *localpool;
#ifdef LIBPRI_COUNTERS
/* q921/q931 packet counters */
unsigned int q921_txcount;
unsigned int q921_rxcount;
unsigned int q931_txcount;
unsigned int q931_rxcount;
#endif
short last_invoke; /* Last ROSE invoke ID (Valid in master record only) */
@@ -179,6 +184,15 @@ struct pri {
/*! Number of facility ie's in the array from the current received message. */
unsigned char count;
} facility;
/*! Display text policy handling options. */
struct {
/*! Send display text policy option flags. */
unsigned long send;
/*! Receive display text policy option flags. */
unsigned long receive;
} display_flags;
/*! Configured date/time ie send policy option. */
int date_time_send;
};
/*! \brief Maximum name length plus null terminator (From ECMA-164) */
@@ -532,9 +546,9 @@ struct q931_call {
/*! \brief Incoming call transfer state. */
enum INCOMING_CT_STATE incoming_ct_state;
/*! Call hold supplementary state. */
/*! Call hold supplementary state. Valid on master call record only. */
enum Q931_HOLD_STATE hold_state;
/*! Call hold event timer */
/*! Call hold event timer. Valid on master call record only. */
int hold_timer;
int deflection_in_progress; /*!< CallDeflection for NT PTMP in progress. */
@@ -568,11 +582,14 @@ struct q931_call {
0,2-7 - Reserved for future use */
int t303_timer;
int t303_expirycnt;
int t312_timer;
int fake_clearing_timer;
int hangupinitiated;
/*! \brief TRUE if we broadcast this call's SETUP message. */
int outboundbroadcast;
int performing_fake_clearing;
/*! TRUE if the master call is processing a hangup. Don't destroy it now. */
int master_hanging_up;
/*!
* \brief Master call controlling this call.
* \note Always valid. Master and normal calls point to self.
@@ -605,8 +622,59 @@ struct q931_call {
unsigned char initially_redirected;
} cc;
/* AOC charge requesting on Setup */
/*! Display text ie contents. */
struct {
/*! Display ie text. NULL if not present or consumed as remote name. */
const unsigned char *text;
/*! Full IE code of received display text */
int full_ie;
/*! Length of display text. */
unsigned char length;
/*!
* \brief Character set the text is using.
* \details
* unknown(0),
* iso8859-1(1),
* enum-value-withdrawn-by-ITU-T(2)
* iso8859-2(3),
* iso8859-3(4),
* iso8859-4(5),
* iso8859-5(6),
* iso8859-7(7),
* iso10646-BmpString(8),
* iso10646-utf-8String(9)
*/
unsigned char char_set;
} display;
/*! AOC charge requesting on Setup */
int aoc_charging_request;
/*! TRUE if the slotmap is E1 (32 bits). */
unsigned int slotmap_size:1;
/*! TRUE if need to see the channel id ie in first response to SETUP. */
unsigned int channel_id_ie_mandatory:1;
/*! Control the RESTART reception to the upper layer. */
struct {
/*! Timer ID of RESTART notification events to upper layer. */
int timer;
/*! Current RESTART notification index. */
int idx;
/*! Number of channels in the channel ID list. */
int count;
/*! Channel ID list */
char chan_no[32];
} restart;
/*! Control the RESTART retransmissions. */
struct {
/*! T316 RESTART retransmit timer. */
int t316_timer;
/*! Number of times remaining that RESTART can be transmitted. */
int remain;
/*! Encoded RESTART channel id. */
int channel;
} restart_tx;
};
enum CC_STATES {
@@ -875,12 +943,12 @@ struct link_dummy {
int q931_is_call_valid(struct pri *ctrl, struct q931_call *call);
int q931_is_call_valid_gripe(struct pri *ctrl, struct q931_call *call, const char *func_name, unsigned long func_line);
extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);
unsigned pri_schedule_event(struct pri *ctrl, int ms, void (*function)(void *data), void *data);
extern pri_event *pri_schedule_run(struct pri *pri);
extern void pri_schedule_del(struct pri *pri, int ev);
int pri_schedule_check(struct pri *ctrl, int id, void (*function)(void *data), void *data);
void pri_schedule_del(struct pri *ctrl, unsigned id);
int pri_schedule_check(struct pri *ctrl, unsigned id, void (*function)(void *data), void *data);
extern pri_event *pri_mkerror(struct pri *pri, char *errstr);
@@ -940,9 +1008,16 @@ void pri_copy_party_id_to_q931(struct q931_party_id *q931_id, const struct pri_p
void q931_party_id_fixup(const struct pri *ctrl, struct q931_party_id *id);
int q931_party_id_presentation(const struct q931_party_id *id);
int q931_display_name_get(struct q931_call *call, struct q931_party_name *name);
int q931_display_text(struct pri *ctrl, struct q931_call *call, const struct pri_subcmd_display_txt *display);
int q931_facility_display_name(struct pri *ctrl, struct q931_call *call, const struct q931_party_name *name);
int q931_facility_called(struct pri *ctrl, struct q931_call *call, const struct q931_party_id *called);
const char *q931_call_state_str(enum Q931_CALL_STATE callstate);
const char *msg2str(int msg);
int q931_get_subcall_count(struct q931_call *master);
struct q931_call *q931_find_winning_call(struct q931_call *call);
int q931_master_pass_event(struct pri *ctrl, struct q931_call *subcall, int msg_type);
struct pri_subcommand *q931_alloc_subcommand(struct pri *ctrl);
@@ -950,13 +1025,17 @@ struct pri_subcommand *q931_alloc_subcommand(struct pri *ctrl);
struct q931_call *q931_find_link_id_call(struct pri *ctrl, int link_id);
struct q931_call *q931_find_held_active_call(struct pri *ctrl, struct q931_call *held_call);
int q931_notify_redirection(struct pri *ctrl, q931_call *call, int notify, const struct q931_party_number *number);
int q931_request_subaddress(struct pri *ctrl, struct q931_call *call, int notify, const struct q931_party_name *name, const struct q931_party_number *number);
int q931_subaddress_transfer(struct pri *ctrl, struct q931_call *call);
int q931_notify_redirection(struct pri *ctrl, struct q931_call *call, int notify, const struct q931_party_name *name, const struct q931_party_number *number);
struct pri_cc_record *pri_cc_find_by_reference(struct pri *ctrl, unsigned reference_id);
struct pri_cc_record *pri_cc_find_by_linkage(struct pri *ctrl, unsigned linkage_id);
struct pri_cc_record *pri_cc_find_by_addressing(struct pri *ctrl, const struct q931_party_address *party_a, const struct q931_party_address *party_b, unsigned length, const unsigned char *q931_ies);
struct pri_cc_record *pri_cc_new_record(struct pri *ctrl, q931_call *call);
void pri_cc_qsig_determine_available(struct pri *ctrl, q931_call *call);
const char *pri_cc_fsm_state_str(enum CC_STATES state);
const char *pri_cc_fsm_event_str(enum CC_EVENTS event);
int pri_cc_event(struct pri *ctrl, q931_call *call, struct pri_cc_record *cc_record, enum CC_EVENTS event);
int q931_cc_timeout(struct pri *ctrl, struct pri_cc_record *cc_record, enum CC_EVENTS event);
void q931_cc_indirect(struct pri *ctrl, struct pri_cc_record *cc_record, void (*func)(struct pri *ctrl, q931_call *call, struct pri_cc_record *cc_record));
@@ -970,7 +1049,7 @@ void q931_cc_indirect(struct pri *ctrl, struct pri_cc_record *cc_record, void (*
*/
static inline struct pri *PRI_NFAS_MASTER(struct pri *ctrl)
{
while (ctrl->master) {
if (ctrl->master) {
ctrl = ctrl->master;
}
return ctrl;

View File

@@ -163,11 +163,17 @@ typedef union {
struct q921_header h;
} q921_h;
enum q921_tx_frame_status {
Q921_TX_FRAME_NEVER_SENT,
Q921_TX_FRAME_PUSHED_BACK,
Q921_TX_FRAME_SENT,
};
typedef struct q921_frame {
struct q921_frame *next; /* Next in list */
int len; /* Length of header + body */
int transmitted; /* Have we been transmitted */
q921_i h;
struct q921_frame *next; /*!< Next in list */
int len; /*!< Length of header + body */
enum q921_tx_frame_status status; /*!< Tx frame status */
q921_i h; /*!< Actual frame contents. */
} q921_frame;
#define Q921_INC(j) (j) = (((j) + 1) % 128)
@@ -246,7 +252,7 @@ struct q921_link {
int n202_counter;
/*! Max idle time */
int t203_timer;
/*! PTP restart delay timer */
/*! Layer 2 persistence restart delay timer */
int restart_timer;
/* MDL variables */
@@ -267,10 +273,11 @@ static inline int Q921_ADD(int a, int b)
}
/* Dumps a *known good* Q.921 packet */
extern void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx);
extern void q921_dump(struct pri *pri, q921_h *h, int len, int debugflags, int txrx);
/* Bring up the D-channel */
void q921_start(struct q921_link *link);
void q921_bring_layer2_up(struct pri *ctrl);
//extern void q921_reset(struct pri *pri, int reset_iqueue);

View File

@@ -138,9 +138,6 @@ typedef struct q931_ie {
#define SERVICE_CHANGE_STATUS_REQCONTINUITYCHECK 3 /* not supported */
#define SERVICE_CHANGE_STATUS_SHUTDOWN 4 /* not supported */
/* Special codeset 0 IE */
#define NATIONAL_CHANGE_STATUS 0x1
/* Q.931 / National ISDN Information Elements */
#define Q931_LOCKING_SHIFT 0x90
#define Q931_NON_LOCKING_SHIFT 0x98
@@ -443,6 +440,8 @@ enum Q931_RANKED_CALL_STATE {
Q931_RANKED_CALL_STATE_CONNECT,
/*! Call is in some non-call establishment state (likely disconnecting). */
Q931_RANKED_CALL_STATE_OTHER,
/*! Master call is aborting. */
Q931_RANKED_CALL_STATE_ABORT,
};
/* EuroISDN */
@@ -466,7 +465,7 @@ extern int q931_notify(struct pri *pri, q931_call *call, int channel, int info);
extern int q931_call_proceeding(struct pri *pri, q931_call *call, int channel, int info);
extern int q931_setup_ack(struct pri *pri, q931_call *call, int channel, int nonisdn);
extern int q931_setup_ack(struct pri *ctrl, q931_call *c, int channel, int nonisdn, int inband);
extern int q931_information(struct pri *pri, q931_call *call, char digit);

View File

@@ -42,7 +42,7 @@
#include <sys/ioctl.h>
#include <sys/select.h>
#include <sys/types.h>
#include <zaptel/zaptel.h>
#include <dahdi/user.h>
#include "libpri.h"
#include "pri_q921.h"
#include "pri_q931.h"
@@ -50,18 +50,18 @@
static int pri_open(char *dev)
{
int dfd;
struct zt_params p;
struct dahdi_params p;
dfd = open(dev, O_RDWR);
if (dfd < 0) {
fprintf(stderr, "Failed to open dchannel '%s': %s\n", dev, strerror(errno));
return -1;
}
if (ioctl(dfd, ZT_GET_PARAMS, &p)) {
if (ioctl(dfd, DAHDI_GET_PARAMS, &p)) {
fprintf(stderr, "Unable to get parameters on '%s': %s\n", dev, strerror(errno));
return -1;
}
if ((p.sigtype != ZT_SIG_HDLCRAW) && (p.sigtype != ZT_SIG_HDLCFCS)) {
if ((p.sigtype != DAHDI_SIG_HDLCRAW) && (p.sigtype != DAHDI_SIG_HDLCFCS)) {
fprintf(stderr, "%s is in %d signalling, not FCS HDLC or RAW HDLC mode\n", dev, p.sigtype);
return -1;
}
@@ -71,7 +71,7 @@ static int pri_open(char *dev)
static void dump_packet(struct pri *pri, char *buf, int len, int txrx)
{
q921_h *h = (q921_h *)buf;
q921_dump(pri, h, len, 1, txrx);
q921_dump(pri, h, len, PRI_DEBUG_ALL, txrx);
if (!((h->h.data[0] & Q921_FRAMETYPE_MASK) & 0x3)) {
q931_dump(pri, h->h.tei, (q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx);
}
@@ -80,7 +80,7 @@ static void dump_packet(struct pri *pri, char *buf, int len, int txrx)
}
static int pri_bridge(int d1, int d2)
static void pri_bridge(int d1, int d2)
{
char buf[1024];
fd_set fds;
@@ -94,8 +94,8 @@ static int pri_bridge(int d1, int d2)
max = d1;
if (max < d2)
max = d2;
ioctl(d1, ZT_GETEVENT, &e);
ioctl(d2, ZT_GETEVENT, &e);
ioctl(d1, DAHDI_GETEVENT, &e);
ioctl(d2, DAHDI_GETEVENT, &e);
res = select(max + 1, &fds, NULL, NULL, NULL);
if (res < 0) {
fprintf(stderr, "Select returned %d: %s\n", res, strerror(errno));

View File

@@ -38,13 +38,15 @@
/*! Initial number of scheduled timer slots. */
#define SCHED_EVENTS_INITIAL 128
/*!
* Maximum number of scheduled timer slots.
* Should be a power of 2 multiple of SCHED_EVENTS_INITIAL.
* \brief Maximum number of scheduled timer slots.
* \note Should be a power of 2 and at least SCHED_EVENTS_INITIAL.
*/
#define SCHED_EVENTS_MAX 8192
/*! \brief The maximum number of timers that were active at once. */
static unsigned maxsched = 0;
/*! Last pool id */
static unsigned pool_id = 0;
/* Scheduler routines */
@@ -87,6 +89,23 @@ static int pri_schedule_grow(struct pri *ctrl)
memcpy(timers, ctrl->sched.timer,
ctrl->sched.num_slots * sizeof(struct pri_sched));
free(ctrl->sched.timer);
} else {
/* Creating the timer pool. */
pool_id += SCHED_EVENTS_MAX;
if (pool_id < SCHED_EVENTS_MAX
|| pool_id + (SCHED_EVENTS_MAX - 1) < SCHED_EVENTS_MAX) {
/*
* Not likely to happen.
*
* Timer id's may be aliased if this D channel is used in an
* NFAS group with redundant D channels. Another D channel in
* the group may have the same pool_id.
*/
pri_error(ctrl,
"Pool_id wrapped. Please ignore if you are not using NFAS with backup D channels.\n");
pool_id = SCHED_EVENTS_MAX;
}
ctrl->sched.first_id = pool_id;
}
/* Put the new timer table in place. */
@@ -106,7 +125,7 @@ static int pri_schedule_grow(struct pri *ctrl)
* \retval 0 if scheduler table is full and could not schedule the event.
* \retval id Scheduled event id.
*/
int pri_schedule_event(struct pri *ctrl, int ms, void (*function)(void *data), void *data)
unsigned pri_schedule_event(struct pri *ctrl, int ms, void (*function)(void *data), void *data)
{
unsigned max_used;
unsigned x;
@@ -138,7 +157,7 @@ int pri_schedule_event(struct pri *ctrl, int ms, void (*function)(void *data), v
ctrl->sched.timer[x].when = tv;
ctrl->sched.timer[x].callback = function;
ctrl->sched.timer[x].data = data;
return x + 1;
return ctrl->sched.first_id + x;
}
/*!
@@ -231,18 +250,35 @@ pri_event *pri_schedule_run(struct pri *ctrl)
* \param ctrl D channel controller.
* \param id Scheduled event id to delete.
* 0 is a disabled/unscheduled event id that is ignored.
* 1 - MAX_SCHED is a valid event id.
*
* \return Nothing
*/
void pri_schedule_del(struct pri *ctrl, int id)
void pri_schedule_del(struct pri *ctrl, unsigned id)
{
if (0 < id && id <= ctrl->sched.num_slots) {
ctrl->sched.timer[id - 1].callback = NULL;
} else if (id) {
pri_error(ctrl, "Asked to delete sched id %d??? num_slots=%d\n", id,
ctrl->sched.num_slots);
struct pri *nfas;
if (!id) {
/* Disabled/unscheduled event id. */
return;
}
if (ctrl->sched.first_id <= id
&& id <= ctrl->sched.first_id + (SCHED_EVENTS_MAX - 1)) {
ctrl->sched.timer[id - ctrl->sched.first_id].callback = NULL;
return;
}
if (ctrl->nfas) {
/* Try to find the timer on another D channel. */
for (nfas = PRI_NFAS_MASTER(ctrl); nfas; nfas = nfas->slave) {
if (nfas->sched.first_id <= id
&& id <= nfas->sched.first_id + (SCHED_EVENTS_MAX - 1)) {
nfas->sched.timer[id - nfas->sched.first_id].callback = NULL;
return;
}
}
}
pri_error(ctrl,
"Asked to delete sched id 0x%08x??? first_id=0x%08x, num_slots=0x%08x\n", id,
ctrl->sched.first_id, ctrl->sched.num_slots);
}
/*!
@@ -251,22 +287,36 @@ void pri_schedule_del(struct pri *ctrl, int id)
* \param ctrl D channel controller.
* \param id Scheduled event id to check.
* 0 is a disabled/unscheduled event id.
* 1 - MAX_SCHED is a valid event id.
* \param function Callback function to call when timeout.
* \param data Value to give callback function when timeout.
*
* \return TRUE if scheduled event has the callback.
*/
int pri_schedule_check(struct pri *ctrl, int id, void (*function)(void *data), void *data)
int pri_schedule_check(struct pri *ctrl, unsigned id, void (*function)(void *data), void *data)
{
if (0 < id && id <= ctrl->sched.num_slots) {
if (ctrl->sched.timer[id - 1].callback == function
&& ctrl->sched.timer[id - 1].data == data) {
return 1;
}
} else if (id) {
pri_error(ctrl, "Asked to check sched id %d??? num_slots=%d\n", id,
ctrl->sched.num_slots);
struct pri *nfas;
if (!id) {
/* Disabled/unscheduled event id. */
return 0;
}
if (ctrl->sched.first_id <= id
&& id <= ctrl->sched.first_id + (SCHED_EVENTS_MAX - 1)) {
return ctrl->sched.timer[id - ctrl->sched.first_id].callback == function
&& ctrl->sched.timer[id - ctrl->sched.first_id].data == data;
}
if (ctrl->nfas) {
/* Try to find the timer on another D channel. */
for (nfas = PRI_NFAS_MASTER(ctrl); nfas; nfas = nfas->slave) {
if (nfas->sched.first_id <= id
&& id <= nfas->sched.first_id + (SCHED_EVENTS_MAX - 1)) {
return nfas->sched.timer[id - nfas->sched.first_id].callback == function
&& nfas->sched.timer[id - nfas->sched.first_id].data == data;
}
}
}
pri_error(ctrl,
"Asked to check sched id 0x%08x??? first_id=0x%08x, num_slots=0x%08x\n", id,
ctrl->sched.first_id, ctrl->sched.num_slots);
return 0;
}

View File

@@ -68,7 +68,10 @@ static void do_channel(int fd)
int i=0;
while ((res = read(fd, buf, READ_SIZE)) > 0 && (i++ < 1000)) {
write(fd, buf, res);
if (write(fd, buf, res) == -1) {
fprintf(stderr, "--!! Failed write: %d\n", errno);
break;
}
}
}

736
q921.c

File diff suppressed because it is too large Load Diff

2858
q931.c

File diff suppressed because it is too large Load Diff

54
rose.c
View File

@@ -1237,6 +1237,34 @@ static const struct rose_convert_msg rose_dms100_msgs[] = {
rose_enc_dms100_RLT_ThirdParty_ARG, NULL,
rose_dec_dms100_RLT_ThirdParty_ARG, NULL
},
/* DMS-100 seems to have pirated some Q.SIG messages */
/*
* localValue's from Q.SIG Name-Operations
* { iso(1) standard(0) pss1-name(13868) name-operations(0) }
*/
{
ROSE_QSIG_CallingName, NULL, 0,
rose_enc_qsig_CallingName_ARG, NULL,
rose_dec_qsig_CallingName_ARG, NULL
},
#if 0 /* ROSE_DMS100_RLT_OPERATION_IND, and ROSE_DMS100_RLT_THIRD_PARTY conflict! */
{
ROSE_QSIG_CalledName, NULL, 1,
rose_enc_qsig_CalledName_ARG, NULL,
rose_dec_qsig_CalledName_ARG, NULL
},
{
ROSE_QSIG_ConnectedName, NULL, 2,
rose_enc_qsig_ConnectedName_ARG, NULL,
rose_dec_qsig_ConnectedName_ARG, NULL
},
{
ROSE_QSIG_BusyName, NULL, 3,
rose_enc_qsig_BusyName_ARG, NULL,
rose_dec_qsig_BusyName_ARG, NULL
},
#endif
/* *INDENT-ON* */
};
@@ -1292,6 +1320,19 @@ static const struct rose_convert_msg rose_ni2_msgs[] = {
* encode_invoke_args, encode_result_args,
* decode_invoke_args, decode_result_args
*/
{
ROSE_NI2_InformationFollowing, &rose_ni2_oid, 4,
rose_enc_ni2_InformationFollowing_ARG, NULL,
rose_dec_ni2_InformationFollowing_ARG, NULL
},
/* Also used by PRI_SWITCH_ATT4ESS and PRI_SWITCH_LUCENT5E */
{
ROSE_NI2_InitiateTransfer, &rose_ni2_oid, 8,
rose_enc_ni2_InitiateTransfer_ARG, NULL,
rose_dec_ni2_InitiateTransfer_ARG, NULL
},
/* NI2 seems to have pirated several Q.SIG messages */
/*
* localValue's from Q.SIG Name-Operations
@@ -1317,19 +1358,6 @@ static const struct rose_convert_msg rose_ni2_msgs[] = {
rose_enc_qsig_BusyName_ARG, NULL,
rose_dec_qsig_BusyName_ARG, NULL
},
{
ROSE_NI2_InformationFollowing, &rose_ni2_oid, 4,
rose_enc_ni2_InformationFollowing_ARG, NULL,
rose_dec_ni2_InformationFollowing_ARG, NULL
},
/* Also used by PRI_SWITCH_ATT4ESS and PRI_SWITCH_LUCENT5E */
{
ROSE_NI2_InitiateTransfer, &rose_ni2_oid, 8,
rose_enc_ni2_InitiateTransfer_ARG, NULL,
rose_dec_ni2_InitiateTransfer_ARG, NULL
},
/* *INDENT-ON* */
};

View File

@@ -48,13 +48,10 @@
#include <sys/time.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <zaptel/zaptel.h>
#ifndef SOLARIS
#include <zap.h>
#endif
#include <pthread.h>
#include <sys/select.h>
#include "libpri.h"
#include "pri_q921.h"
#include "pri_q931.h"
#ifndef AF_LOCAL
@@ -66,7 +63,7 @@
#define PRI_DEF_NODETYPE PRI_CPE
#define PRI_DEF_SWITCHTYPE PRI_SWITCH_NI2
static struct pri *first, *cur;
static struct pri *first;
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
@@ -159,9 +156,9 @@ static void testmsg(struct pri *pri, char *s)
*c = '\0';
c++;
}
if (keeplast)
if (keeplast || !pri)
printf("%s", s);
else if (cur == first)
else if (pri == first)
printf("-1 %s", s);
else
printf("-2 %s", s);
@@ -185,9 +182,9 @@ static void testerr(struct pri *pri, char *s)
*c = '\0';
c++;
}
if (keeplast)
if (keeplast || !pri)
printf("%s", s);
else if (cur == first)
else if (pri == first)
printf("=1 %s", s);
else
printf("=2 %s", s);
@@ -207,7 +204,7 @@ static void *dchan(void *data)
/* Joint D-channel */
struct pri *pri = data;
struct timeval *next, tv;
pri_event *e;
pri_event *e = NULL;
fd_set fds;
int res;
for(;;) {
@@ -228,7 +225,6 @@ static void *dchan(void *data)
FD_SET(pri_fd(pri), &fds);
res = select(pri_fd(pri) + 1, &fds, NULL, NULL, next ? &tv : NULL);
pthread_mutex_lock(&lock);
cur = pri;
if (res < 0) {
perror("select");
} else if (!res) {
@@ -238,9 +234,9 @@ static void *dchan(void *data)
}
if (e) {
if (first == pri) {
event1(e->gen.pri, e);
event1(pri, e);
} else {
event2(e->gen.pri, e);
event2(pri, e);
}
}
pthread_mutex_unlock(&lock);