Commit Graph

100 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
517e5ac5ce Asterisk is getting a "No D-channels available!" warning message every 4 seconds.
For PTP links, libpri generated the PRI_EVENT_DCHAN_DOWN event every time
it failed to bring layer 2 up because the physical layer is down.

For PTP links, made generate the PRI_EVENT_DCHAN_UP/PRI_EVENT_DCHAN_DOWN
only when it enters/exits the Q.921 superstate consisting of states
7(Q921_MULTI_FRAME_ESTABLISHED) and 8(Q921_TIMER_RECOVERY).

Also changed the PTP link restart delay to be link specific instead of D
channel specific because the GR-303 PTP switch types have more than one
Q.921 link.

(closes issue #17270)
Reported by: jmls


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2113 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-11-12 02:31:24 +00:00
Richard Mudgett
12805eb71f SABME flood on backup D-channel in NFAS configuration.
Made delay restarting the PTP layer 2 link by the T200 time instead of
immediately.  Q.921 does not specify any particular time to restart the
layer 2 link.  Q.921 leaves it up to the upper layers to decide when or if
another attempt to bring layer 2 up is made.  Earlier versions of libpri
used the T200 time to restart the link.

This is a reimplementaion of -r1878.

(closes issue #18255)
Reported by: bklang

JIRA SWP-2508


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2111 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-11-11 00:30:33 +00:00
Richard Mudgett
230e2d9013 Added TEI identity check feature to reclaim dead TEIs.
This is the new feature portion of JIRA LIBPRI-51/SWP-2453.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2105 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-11-05 20:05:25 +00:00
Richard Mudgett
7f55b600e0 Fixes CC agents not automatically clearing if T309 clears the original call.
Incoming calls with CC enabled will not automatically clear the CC offer
record when the call is aborted by T309 processing.  All CC agent FSM's
have this problem (PTMP, PTP, and Q.SIG).

To reproduce:
1) Place incoming call to Asterisk/libpri
2) Either before or after the call is answered, bring the ISDN link down.
3) T309 processing, T309 timeout, or TEI removal will leave the CC agent
FSM in the CC available state.

The problem is indicated by the "cc report status" CLI command showing a
status of CC offered to caller but it will never timeout.

The FSM's can be manually cleared by using the "cc cancel all" or "cc
cancel core" CLI commands.

JIRA LIBPRI-46
JIRA SWP-2241


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2079 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-10-21 18:00:03 +00:00
Richard Mudgett
5923df047d Partial support for dynamic interfaces with NFAS.
To have some support for dynamic interfaces, the master NFAS D channel
control structure will always exist even if it is abandoned/deleted by the
upper layer.  The master/slave pointers ensure that the correct master
will be used.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2078 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-10-21 17:32:39 +00:00
Richard Mudgett
f9c3c8d026 Extract the layer 2 link structure out of struct pri.
This completes the layer 2 link and Q.931 call control restructuring.
Some code is now simplified since there is only one D channel control
structure and the amount of allocated memory is reduced.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2077 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-10-21 17:30:41 +00:00
Richard Mudgett
53c142990f Restructure the Q.931 call record to layer 2 link association.
This is in anticipation of extracting a layer 2 link structure out of
struct pri.

Also completes fixing timer value access for the rest of libpri.  The
timer access must always be on the D channel control structure (Master).

May have fixed some events from timeouts not being passed to the upper
layer.  The timeout events must always be on the D channel control
structure (Master).


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2070 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-10-21 16:37:10 +00:00
Richard Mudgett
31b4b63b40 Create two versions of call ptr verify. One gripes and one does not.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2027 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-10-15 16:39:10 +00:00
Richard Mudgett
2045db6a69 Segfault in pri_schedule_del() - ctrl value is invalid.
Validate the given call pointer in libpri API calls.  If the call pointer
is not an active call record then a complaint message is issued and the
API call aborts.  The call pointer is likely stale.

This patch is defensive.  More information is needed to figure out why
Asterisk still has a call pointer during its hangup sequence.

(closes issue #17522)
(closes issue #18032)
Reported by: schmoozecom
Patches:
      issue_18032_v1.4.patch uploaded by rmudgett (license 664)
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@2015 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-10-14 17:09:40 +00:00
Richard Mudgett
05158ec5fb BRI PTMP: Active channels not cleared when the interface goes down.
If the connection to the terminal is lost while there are open channels
on the interface, red alarm is reported, but the open channels are never
cleared.  Additionally, if you manually try to channel request hangup,
Asterisk crashes.

For PTMP, the T309 processing was not searching the call pool on the
master control record.  Additionally, for NT PTMP, the timeout events were
not passed to the upper layer because the events were not put on the
master control record where timer processing expects them.

(closes issue #17865)
Reported by: wimpy
Patches:
      issue17865_v1.4.patch uploaded by rmudgett (license 664)
Tested by: rmudgett, wimpy


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1982 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-09-13 16:07:24 +00:00
Richard Mudgett
c5fce8da41 [regression] Calling Number assignment logic change in libpri 1.4.11.
Restored the old behaviour if there is more than one calling number in the
incoming SETUP message.  A network provided number is reported as ANI.

(closes issue #17495)
Reported by: ibercom
Patches:
      issue_17495_v1.4.11.2.patch uploaded by rmudgett (license 664)
      issue_17495_v1.4.patch uploaded by rmudgett (license 664)
Tested by: ibercom


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1823 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-29 16:15:03 +00:00
David Vossel
660609c45b support for sending ETSI advice of charge
Review: https://reviewboard.asterisk.org/r/619/


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1776 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-28 22:34:24 +00:00
Richard Mudgett
0b28bf0aab ETSI Malicious Call ID support.
Add the ability to report malicious callers.

Relevant specification: EN 300 180

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1757 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-28 20:26:23 +00:00
Richard Mudgett
e4b8bed7e9 ETSI Call Waiting support.
Add the ability to announce a call to an endpoint when there are no B
channels available.  A call waiting call is a SETUP message with no B
channel selected.

Relevant specification: EN 300 056, EN 300 057, EN 300 058

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1746 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-28 18:43:57 +00:00
Richard Mudgett
9bb285fdc1 ETSI Advice Of Charge (AOC) event reporting.
This feature passes ETSI AOC-S, AOC-D, and AOC-E message information to
the upper layer (i.e.  Asterisk) for processing.

Relevant specification: EN 300 182

Consideration was made for the possible future addition of Q.SIG AOC
support (ECMA-212) with the events passed to the upper layer.

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1737 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-28 18:03:38 +00:00
Richard Mudgett
382e7e5c86 Added ETSI Explicit Call Transfer (ECT) support.
Added ability to send and receive ETSI ECT messages to eliminate tromboned
calls.

Added ETSI support to an existing API call to send ECT messages when the
upper level indicates to transfer specified calls.

The libpri API was extended to indicate to the upper layer that the far
end requests the transfer of the indicated calls.

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1723 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-28 15:19:08 +00:00
Richard Mudgett
6829faae06 Add Call Completion Suppplementary Service
Call Completion Supplementary Service (CCSS) added for the following 
switch types: ETSI PTMP, ETSI PTP, Q.SIG.  

Specifications:
ETS 300 359 CCBS for PTMP and PTP
ETS 301 065 CCNR for PTMP and PTP
ECMA-186 Call Completion for Q.SIG

Several support services were added to support CC:
Dummy Call Reference.
Q.931 REGISTER message.
Dynamic expansion of the number of available timers (up to 8192).
Enhanced facility message handling.

Current implementation limitations preclude the following:
CC service retention is not supported.
Q.SIG path reservation is not supported.

(closes issue #14292)
Reported by: tomaso
Tested by: rmudgett

JIRA SWP-1493

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1714 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-26 16:01:10 +00:00
Richard Mudgett
d808143f8f Dialing an invalid extension causes incomplete hangup sequence.
Revision -r1489 corrected a deviation from Q.931 Section 5.3.2.  However,
this resulted in an unexpected behaviour change to the upper layer
(Asterisk).

This change restores the legacy hangup behaviour if the new API call is
not used.  Use pri_hangup_fix_enable() to follow Q.931 Section 5.3.2 call
hangup better.

(closes issue #17104)
Reported by: shawkris
Tested by: rmudgett


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1688 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-11 22:14:15 +00:00
Richard Mudgett
e42108aaae PTMP NT mode call reference value ambiguity.
Since the TE side can pick CR values independently, the TE CR needs to be
qualified by TEI to distinguish CR values from other devices.  Without
doing this, multiple phones on the BRI line will have intermittent call
failures.

JIRA LIBPRI-30

Also eliminated some wierdness in q931_status() and several places where
it is called.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1630 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-04-19 22:40:41 +00:00
Richard Mudgett
5ff4710e77 Make some internal routines available to other libpri components.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1596 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-04-15 18:43:37 +00:00
Richard Mudgett
d5d69dddac Miscellaneous simple reorganization.
1) Make PRI_MASTER() no longer check for a NULL parameter.  It is the
caller's responsibility.  Not many callers could have passed a NULL
without crashing before or after anyway.

2) Replace calls to q931_is_ptmp() with PTMP_MODE().  They were
equivalent.

3) Made the following boolean config options bit fields: sendfacility,
overlapdial, chan_mapping_logical, and service_message_support.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1534 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-03-17 17:47:53 +00:00
Richard Mudgett
68a107a3e3 Restore ability to change the Q.921 K value.
The Q.921 rewrite only used value of PRI_TIMER_K right after it was set to
the default.  The Q.921 window size was thus no longer alterable by the
user.

(closes issue #16909)
Reported by: alecdavis
Patches:
      pritimer.libpri.diff.txt uploaded by alecdavis (license 585)
Tested by: alecdavis


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1511 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-03-02 23:47:12 +00:00
Matthew Fredrickson
4d3bb14731 Merge of Q.921 rewrite branch for wider testing.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1406 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-01-13 19:37:59 +00:00
Richard Mudgett
46df6d2cd4 Fix debug output so built up output lines are readable again.
A recent change to Asterisk put the span number at the begining of each
line.  This is a good thing if you need to debug multiple spans or forget
which span you are debugging.  Unfortunately, any pri_message() output
that is not a complete line is messed up.

The pri_message() function now will accumulate line output until a '\n' is
seen on the end.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1351 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-21 02:40:23 +00:00
Richard Mudgett
b9397c7541 Delay processing of facility ie's after all other ie's are processed.
*  Some ROSE message processing depends on the presence of other ies.  The
DivertingLegInformation1, and 3 messages will be used as the default
connected line number if the connected number ie is not present.  The
redirecting number ie is used as a default to the redirecting number in
the DivertingLegInformation2 message if the ROSE message does not contain
it and the redirecting number ie is present.

*  Some ROSE message processing depends upon other ie values.  The
StatusRequest, CCBS-T-Call, and CcRingout messages collectively need the
BC, HLC, LLC, called number, called subaddress, calling number, and
calling subaddress ie information to be available.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1345 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-20 23:42:40 +00:00
Richard Mudgett
b698032e04 Reimplement callback mechanism to handle APDU response messages that we care about.
1) No sent messages will remain in the APDU queue unless they have an
active timer to remove them.  The dummy call reference call and global
call reference call structures will not act like a memory leak to sent
messages.

2) The new T-RESPONSE timer will be the generic response guard if the
standards do not otherwise specify a timer for a message response.

3) The callback will be called.  If it is called because of a response
message, then the callback has an opportunity to indicate if more
responses are expected.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1322 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-14 00:20:53 +00:00
Richard Mudgett
d305dbc609 There must be only one source for the invoke id values per D channel group.
If there are potentially multiple sources for the invoke id sequence then
we could get confused if there are multiple outstanding messages with the
same invoke id that get responses.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1310 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-13 22:59:35 +00:00
Matthew Fredrickson
80c8c46b89 Make sure we also revive links for PRIs, not just PTMP TE BRIs when we get a disconnect message
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1291 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-11 00:22:47 +00:00
Richard Mudgett
6a121d4c74 The facility ie queue needs to remove facilities that have been sent.
The facility ie queue needs to remove facilities that have been sent.
Otherwise, the queue just grows until the call is terminated.  AOC
messages can clog the queue during a long call and the dummy call
reference may never be deleted.

Also removed unneeded elements of struct apdu_event.  The callback
function was not a good idea since many facility messages do not have
responses and the callback would prevents removal of events from the list.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1283 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-10 21:51:26 +00:00
Richard Mudgett
e23ea9568c Add dummy call reference support.
Fixes problem where PTMP NT mode responds erroneously to a FACILITY
message from a phone on the dummy call reference.  LibPRI behaved as if
the dummy call reference were an invalid call reference and proceeded to
respond on the global call reference.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1275 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-10 19:27:34 +00:00
Richard Mudgett
c7c670aa85 Remove unused callingsubaddr[].
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1268 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-09 20:53:10 +00:00
Richard Mudgett
16f2f02ce8 Add subaddress handling to existing messages and functions.
Connected line updates when transfering calls does not completely support
subaddresses yet.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1249 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-23 23:47:58 +00:00
Richard Mudgett
a2dcb6adba Add BRI PTMP NT mode, HOLD/RETRIEVE, Call rerouting/deflection, and keypad facility support.
* Added support for BRI PTMP NT mode.  (Overlap dialing NT -> TE not supported.)
* Added handling of received HOLD/RETRIEVE messages and the optional ability
  to transfer a held call on disconnect similar to an analog phone.
* Added CallRerouting/CallDeflection support for Q.SIG, ETSI PTP, ETSI PTMP.
  Will reroute/deflect an outgoing call when receive the message.
  Can use the DAHDISendCallreroutingFacility to send the message for the
  supported switches.
* Added ability to send/receive keypad digits in the SETUP message.
  Send keypad digits in SETUP message: Dial(DAHDI/g1[/K<keypad_digits>][/extension])
  Access any received keypad digits in SETUP message by: ${CHANNEL(keypad_digits)}

(closes issue #15048)
Tested by: rmudgett, mattf


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1242 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-23 19:50:45 +00:00
Richard Mudgett
a78ee730c9 Add support for calling and called subaddress. Partial support for COLP subaddress.
The Telecom Specs in NZ suggests that SUB ADDRESS is always on, so doing
"desk to desk" between offices each with an asterisk box over the ISDN
should then be possible, without a whole load of DDI numbers required.

(closes issue #15604)
Reported by: alecdavis
Patches:
      libpri_subaddr_trunk.diff11.txt uploaded by alecdavis (license 585)
      Some minor modificatons were made.
Tested by: alecdavis, rmudgett

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1230 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-22 16:16:50 +00:00
Richard Mudgett
296c64df23 Miscellaneous changes:
*  Removed unnecessary Q931_IE_CONNECTED_NUM ie from setup_ack_ies[].
*  Added internal state Q931_CALL_STATE_NOT_SET to Q.931 state enum.
*  Made q931_is_ptmp() take a const pointer.
*  pri_facility.c: Some preparations for subaddressing.
*  pri.c: Eliminate use of a magic number.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1177 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-12 17:17:48 +00:00
Richard Mudgett
c3074dafc1 Converted Q931_CALL_STATE_xxx defines to an enum.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1061 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-02 20:19:40 +00:00