Compare commits

...

365 Commits

Author SHA1 Message Date
Richard Mudgett
c286f741be Update ChangeLog to what is in 1.4.11.4.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1951 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 23:37:01 +00:00
Richard Mudgett
183cd86a8d Merged revisions 1923,1928-1929 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1923 | rmudgett | 2010-08-30 14:31:46 -0500 (Mon, 30 Aug 2010) | 18 lines
  
  Q.921 improvements from comparing Q.921 SDL diagrams with implementation.
  
  * Handle sending and receiving DM response frames as needed.
  
  * Added handling of received FRMR frames.
  
  * Completed implementation of Q921_AWAITING_RELEASE state.  (State is
  currently unreachable since we have no API to initiate sending the DISC
  message.)
  
  * Better NT PTMP TEI allocation.
  
  * Reduced more ERROR level severity messages so users will stop panicking
  when they see ERROR.  This is especially true for the Q.921 MDL-ERROR
  messages.
  
  * Added better Q.921 visibility when normal debug message level is enabled.
........
  r1928 | rmudgett | 2010-08-30 15:30:59 -0500 (Mon, 30 Aug 2010) | 9 lines
  
  Q.921/Q.931 message debug output improvements.
  
  The Q.931 message decode debug output now will follow the correct Q.921
  header decode if Q.921 message dumping is enabled.  Also the Q.931 message
  decode will happen when the message actually goes out on the line instead
  of when Q.931 passes the message to Q.921.  Q.921 may have to request a
  TEI, bring the connection up, or retransmit previous frames before it can
  actually send the new message.
........
  r1929 | rmudgett | 2010-08-30 15:49:11 -0500 (Mon, 30 Aug 2010) | 2 lines
  
  Reduced fake MDL-ERROR (Z) message severity to be visible only when debugging enabled.
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1949 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:34:43 +00:00
Richard Mudgett
c955ba2510 Merged revisions 1918 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1918 | rmudgett | 2010-08-30 12:53:33 -0500 (Mon, 30 Aug 2010) | 41 lines
  
  ISDN BRI does not recover from line faults
  
  Q.921 was getting stuck in state 2 (Q921_ASSIGN_AWAITING_TEI).  For some
  reason the network was removing the TEI.  Libpri then immediately tried to
  get a new TEI assigned.  The network did not reply to the N202(3) attempts
  to get a new TEI.  Libpri then just gave up trying but did not leave the
  state.  Some paths in Q.921 Figure B.3 were not implemented.
  
  Q.921 now transitions to the Q921_TEI_UNASSIGNED state when the N202 count
  is exceeded.  Q.921 will wait there until an incoming or outgoing call is
  attempted.
  
  * Fixed initializing the n202_counter.  Not initializing the n202_counter
  would cause the Q921_TEI_IDENTITY_REQUEST to unexpectedly not go out and
  due to how state transitions were done, Q.921 would get stuck in the
  Q921_ASSIGN_AWAITING_TEI state.
  
  * Fixed start T202 timer fail causing Q.921 to get stuck in the
  Q921_ASSIGN_AWAITING_TEI state if the network did not respond to the
  request.
  
  * Fixed handling of Q921_TEI_IDENTITY_REMOVE to do the MDL-REMOVE
  primitive (q921_mdl_remove()) instead of transitioning directly to the
  Q921_TEI_UNASSIGNED state.  Necessary state clean-up was not getting done.
  
  * Minor tweaks to q921_mdl_remove().  The worst problem was erroneously
  generating an error message.
  
  * Fixed potential for sending I-frames with an invalid TEI.  The I-frame
  could have been queued when Q.921 did not have an assigned TEI.
  
  * Fixed testing of the q931_receive() return value when a UI-frame is
  received.
  
  (closes issue #17570)
  Reported by: jcovert
  Patches:
        issue17570_v1.4.11.3_v3.patch uploaded by rmudgett (license 664)
        issue17570_v1.4_v3.patch uploaded by rmudgett (license 664)
  Tested by: jcovert, rmudgett
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1948 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:31:41 +00:00
Richard Mudgett
a0c05f9908 Merged revisions 1904 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1904 | rmudgett | 2010-08-27 10:54:17 -0500 (Fri, 27 Aug 2010) | 15 lines
  
  Add support to receive ECMA-164 2nd edition OID name ROSE messages.
  
  NOTE: To add support to send the old style name messages will require
  implementing them as new ROSE operation message types.
  
  NOTE: To actually use them would likely require implementing another
  version of the Q.SIG switch type.  Like (NI1 & NI2) and (4ess & 5ess) for
  example.
  
  Patches:
        libpri37.patch uploaded by rmudgett (license 664)
  
  JIRA SWP-2100
  JIRA LIBPRI-37
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1947 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:29:56 +00:00
Richard Mudgett
9b5066cc78 Merged revisions 1878,1883-1884,1894 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1878 | mattf | 2010-08-23 17:13:44 -0500 (Mon, 23 Aug 2010) | 1 line
  
  Add silly fake MDL error Z for kicking L2 to reactivate if a DISC or DM is received in proper states on PTP links.
........
  r1883 | rmudgett | 2010-08-25 11:38:29 -0500 (Wed, 25 Aug 2010) | 2 lines
  
  Don't silently fail to post our fake MDL-ERROR(Z).
........
  r1884 | rmudgett | 2010-08-25 12:17:09 -0500 (Wed, 25 Aug 2010) | 2 lines
  
  Added gripe check to rosetest for invalid operation and error codes.
........
  r1894 | rmudgett | 2010-08-26 18:26:16 -0500 (Thu, 26 Aug 2010) | 1 line
  
  Make pri_dump_event() only print the event name.
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1946 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:25:33 +00:00
Richard Mudgett
9648194287 Merged revisions 1853 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1853 | rmudgett | 2010-08-06 13:35:35 -0500 (Fri, 06 Aug 2010) | 18 lines
  
  No audio on inbound J1 calls.
  
  Incoming calls specifying the channel using a slot map could not negotiate
  a B channel correctly.  Libpri historically has handled this as an any
  channel request.  However, when chan_dahdi picked a new channel, libpri
  sent out the recorded slot map and not the new channel selected.  Thus the
  two endpoints would be attached to different B channels and the parties
  would not hear anything or would hear the wrong parties.
  
  This patch restores the historical preference of sending out the channel
  id using the channel number method if a channel number is available.
  
  JIRA LIBPRI-35
  Patches:
        libpri-35_v1.4.11.3.patch uploaded by rmudgett (license 664)
        libpri-35_v1.4.patch uploaded by rmudgett (license 664)
  Tested by: rmudgett
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1945 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:21:52 +00:00
Richard Mudgett
ff36053fdd Merged revisions 1848,1852 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1848 | rmudgett | 2010-08-03 18:04:52 -0500 (Tue, 03 Aug 2010) | 11 lines
  
  Improved Q.921/Q.931 debug output.
  
  * Debug output for a sent Q.931 message in TE PTMP now uses the best
  available TEI number instead of always using 127.  It could still be wrong
  if layer 2 does not have a TEI assigned.
  
  * Q.921 debug output is grouped better so a decoded message is not split
  by a blank line.
  
  * The Q.921 state is also decoded to a name.
........
  r1852 | rmudgett | 2010-08-06 13:22:39 -0500 (Fri, 06 Aug 2010) | 1 line
  
  Learn (AGAIN!) why state 7 and state 8 transitions were suppressed.
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1942 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:20:36 +00:00
Richard Mudgett
d9276a9c5e Merged revisions 1845 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1845 | rmudgett | 2010-08-03 12:33:54 -0500 (Tue, 03 Aug 2010) | 10 lines
  
  Q921_TIMER_RECOVERY SDL issue in q921_rnr_rx()
  
  Added missing code specified by Q.921 (Figure B.8 Page 85) when receive
  RNR in "Timer Recovery" state.
  
  (closes issue #16791)
  Reported by: alecdavis
  Patches:
        rnr_timer_recovery.diff.txt uploaded by alecdavis (license 585)
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1941 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:18:20 +00:00
Richard Mudgett
c3cc1ed5b0 Merged revisions 1829-1830,1842 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1829 | rmudgett | 2010-07-16 12:15:07 -0500 (Fri, 16 Jul 2010) | 1 line
  
  Added a libpri version output line as a sanity check for rosetest.
........
  r1830 | rmudgett | 2010-07-16 12:20:21 -0500 (Fri, 16 Jul 2010) | 1 line
  
  Only need to output one version of the version message.
........
  r1842 | rmudgett | 2010-08-02 13:47:10 -0500 (Mon, 02 Aug 2010) | 5 lines
  
  Renamed local struct pri *pri variables to struct pri *ctrl in q921.c.
  
  The context tagging for my editor is much happier now that the struct and
  the variable do not have the same name.  (At least for this file.)
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1940 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:17:07 +00:00
Richard Mudgett
cd8d727df8 Merged revisions 1828 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.4

........
  r1828 | rmudgett | 2010-07-16 11:37:07 -0500 (Fri, 16 Jul 2010) | 18 lines
  
  Calling name not successfully processed on inbound QSIG PRI calls from Mitel PBX
  
  The alternate form of the Q.SIG Name sequence that allows manufacturer
  extensions for CallingName, CalledName, ConnectedName, and BusyName was
  not consuming the next ASN.1 tag.  The code that processed the ASN.1 Name
  structure was then using a stale tag value.  The stale tag value was then
  rejected with the "Did not expect" message.
  
  I have added a test case using the supplied PRI debug output to the
  rosetest utility to verify that this alternate encoding is tested in the
  future.
  
  (closes issue #17619)
  Reported by: jims8650
  Patches:
        issue17619_v1.4.11.3.patch uploaded by rmudgett (license 664)
  Tested by: rmudgett
........


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1939 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 22:13:16 +00:00
Leif Madsen
4e591eb689 Update .version and ChangeLog
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1931 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 20:56:15 +00:00
Leif Madsen
eb0586daa1 Create libpri 1.4.11.4 from 1.4.11.3.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.4@1930 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-08-30 20:55:21 +00:00
Richard Mudgett
7dca4921d2 Update ChangeLog
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.3@1827 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-29 16:23:42 +00:00
Richard Mudgett
b14525f475 [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/tags/1.4.11.3@1824 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-29 16:17:54 +00:00
Leif Madsen
5feca71b83 Update ChangeLog and .version files.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.3@1822 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-29 15:40:28 +00:00
Leif Madsen
8d5be5281a Copy libpri 1.4.11.2 to 1.4.11.3
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.3@1821 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-29 15:38:39 +00:00
Leif Madsen
ef3a4f1b5a Minor typo.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.2@1817 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-07 17:45:35 +00:00
Richard Mudgett
969b121c9b Our software isn't released. It escapes\!
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.2@1816 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-07 16:00:14 +00:00
Richard Mudgett
b32ccb3fdd Merged revision 1810 from
https://origsvn.digium.com/svn/libpri/branches/1.4

..........
  r1810 | rmudgett | 2010-06-04 17:45:59 -0500 (Fri, 04 Jun 2010) | 13 lines

  Q.SIG calling name in FACILITY message not reported to the upper layer.

  Q.SIG can send the CallingName, CalledName, and ConnectedName in stand
  alone FACILITY messages.  If the CallingName was not sent in the SETUP
  message, the caller id name was not reported to the upper layer.

  (closes issue #17458)
  Reported by: jsmith
  Patches:
      issue17458_post_qsig_name.patch uploaded by rmudgett (license 664)
      issue17458_post_qsig_name_v1.4.11.1.patch uploaded by rmudgett (license 664)
  Tested by: rmudgett, jsmith


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.2@1815 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-07 15:54:55 +00:00
Leif Madsen
9b04f86bf6 Update .version and ChangeLog.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.2@1814 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-07 15:19:05 +00:00
Leif Madsen
2d986a8567 Create 1.4.11.2 from 1.4.11.1.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.2@1813 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-07 15:18:16 +00:00
Richard Mudgett
399513b13b Updated ChangeLog for release.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.1@1807 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-02 16:38:59 +00:00
Richard Mudgett
ea17cdae4f Inband disconnect setting does nothing on BRI spans.
The acceptinbanddisconnect flag is not inherited when creating a new TEI
and thus rendering the setting (and its respective equivalent in Asterisk)
a no-op on BRI setups.

(closes issue #15265)
Reported by: paravoid
Patches:
      inband-bri.diff uploaded by paravoid (license 200)
Tested by: paravoid


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.1@1806 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-02 16:26:40 +00:00
Richard Mudgett
d878403e92 Multi component FACILITY messages only process the first component.
The code was only processing the first ROSE component in the facility
message.  I also updated rosetest.c to have a multiple component ROSE
message test.

(closes issue #17428)
Reported by: patrol-cz
Patches:
      issue17428.patch uploaded by rmudgett (license 664)
Tested by: rmudgett, patrol-cz


git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.1@1805 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-02 16:24:17 +00:00
Leif Madsen
12c20f0f91 Update .version and ChangeLog.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.1@1804 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-02 16:10:41 +00:00
Leif Madsen
fb53af3a71 Create 1.4.11.1 from 1.4.11
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11.1@1803 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-06-02 16:08:30 +00:00
Russell Bryant
585c016da8 Importing files for 1.4.11 release.
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11@1713 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-20 19:32:32 +00:00
Russell Bryant
f86ab05045 Creating tag for the release of libpri-1.4.11
git-svn-id: https://origsvn.digium.com/svn/libpri/tags/1.4.11@1712 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-20 19:31:50 +00:00
Richard Mudgett
07b3f1dc45 T309 should not do anything with the global call reference call record.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1703 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-19 21:50:34 +00:00
Matthew Fredrickson
3d5f9e762a It's amazing what a tiny bug in the Q.921 SDL diagram can do to cause trouble.... Fix issue where V_R was not reset and N_R was consequentially transmitted incorrectly. Particularly in layer 2 initiated re-establishments.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1702 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-05-19 21:30:34 +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
14c3616e02 Simplified some protocol discriminator handling code.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1675 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-04-26 19:54:00 +00:00
Richard Mudgett
bfcab2eabe Garbage on the end of Q.931 messages causing calls to fail to connect.
The DAHDI driver had a bug where an extra byte appeared on the end of
Q.931 messages.  This garbage byte caused the message to be discarded with
the diagnostic "XXX Message longer than it should be??  XXX".  The Q.931
message will no longer be discarded if there were earlier ie's in the
message.

This patch also addresses the potential problem of reading beyond the
buffer when trying to parse the garbage data.

Thanks to roeften for the base patch.

(closes issue #14378)
Reported by: timking


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1674 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-04-26 19:39:28 +00:00
Richard Mudgett
ca0fc1a99d Avoid using a cast.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1665 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-04-26 16:59:05 +00:00
Richard Mudgett
d933b7e7e6 Cleanup some pri debug output line presentation.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1664 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-04-26 16:57:57 +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
7babaeb2fe Fix potential crash when pridump.c calls q921_dump() with NULL pri ptr.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1625 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-04-19 22:08:50 +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
9a7686d792 Only one PROCEEDING message per call please.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1577 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-04-09 21:43:42 +00:00
Richard Mudgett
ba4d759752 Move a comment closer to where it has relevance.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1547 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-03-18 15:50:19 +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
Richard Mudgett
307264f7c6 Must send DISCONNECT if we have sent a response to a SETUP message.
Q.931 Section 5.3.2 a) says we send a RELEASE_COMPLETE to reject a call
SETUP if we have not already sent a message in response to the SETUP
message.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1489 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-02-11 21:47:24 +00:00
Richard Mudgett
2ec071bae6 Minor comment changes.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1488 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-02-11 21:40:35 +00:00
Wendell Thompson
d4354b4873 Added CPUARCH option for selecting a 32-bit build from the command line.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1482 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-02-11 17:35:49 +00:00
Matthew Fredrickson
9d9412e681 Revert useless check of pri->t200_timer value, since scheduler routines check the value anyways.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1476 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-02-08 23:29:51 +00:00
Matthew Fredrickson
a09da00b0a Make sure we set the l3initiated flag when PTP links are attempted to be re-established
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1470 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-02-08 22:14:17 +00:00
Richard Mudgett
748c69e160 pri_restart() is no longer needed since the Q.921 rewrite.
Don't output error message for a deprecated function.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1464 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-02-05 23:34:54 +00:00
Matthew Fredrickson
6443238ed0 Sense of statement was inverted from what it should have been. Might have caused false T200 operation on reception of I-frames.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1457 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-01-29 21:55:52 +00:00
Richard Mudgett
f80fa82b33 Only set eres if there actually is an event to pass up.
(issue 16713)


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1451 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-01-29 19:32:58 +00:00
Matthew Fredrickson
3995397fa3 Fix bug in which an event was lost if an I-frame was received during a timer recovery state (related to #16713)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1445 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-01-29 17:27:43 +00:00
Richard Mudgett
cec71a81e5 Don't be so noisy when D channel is down.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1439 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-01-26 21:04:48 +00:00
Richard Mudgett
7dd6494c61 Fix TE PTMP side sending FACILITY messages on the dummy call reference.
Only the NT PTMP side can send Q.931 broadcast messages.

Also removed an inaccurate comment in Q.921 and made
q921_mdl_handle_error_callback() call the correct struct pri free
function.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1426 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-01-19 21:53:31 +00:00
Richard Mudgett
79fbecc5ae Make some debugging messages conditional and some minor reformating changes.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1414 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2010-01-15 18:28:54 +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
14f04072c8 Extracted q931_fill_ring_event() from post_handle_q931_message().
Done so it is easier to see what was done in ccbs branch.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1374 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-12-09 20:59:16 +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
04d911112d Merged revision 1328 from
https://origsvn.digium.com/svn/libpri/team/mattf/libpri-1.4-q921-rewrite

..........
  r1328 | mattf | 2009-11-17 15:16:11 -0600 (Tue, 17 Nov 2009) | 1 line

  outboundbroadcast isn't set at this time, since it is set after the
  message is transmited, so we must use other criteria to determine the need
  for broadcast on a setup
..........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1331 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-18 00:36:20 +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
62d35faf6b We now have 32 timers. No need to reserve minimum space anymore.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1316 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-13 23:46:57 +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
Matthew Fredrickson
44ad020fe8 Re-add back in support for TE initiated layer 2 activation
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1276 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-10 20:25:02 +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
618acf9d53 Unknown IE 50 (cs5, Unknown Information Element)
Add code to recognize the code set 5 ie 50 (calling party category) to
suppress the unknown IE message.

(closes issue #13828)
Reported by: fdecher
Patches:
      libpri_ie50_cs5-trunk.diff3.txt uploaded by alecdavis (license 585)
Tested by: alecdavis


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1261 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-03 17:19:20 +00:00
Richard Mudgett
9f39144986 NT PTMP did not report busy when calling a busy phone.
The caller would not get a busy indication when calling a busy phone.
Timer T303 is not supposed to be stopped when RELEASE_COMPLETE received.
When T303 expires we will now report the last clearing cause code to the
caller if we received one.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1255 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-11-02 23:28:59 +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
6cb01561eb Fix call state ie transmission.
Sending a STATUS message failed to include the call state ie for some
reason.  We will now always send a call state ie when a message ie list
includes one.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1220 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-19 22:49:59 +00:00
Richard Mudgett
5537dbec1d Fix comparision of invalid party name and number structs in comparison functions.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1219 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-19 22:38:32 +00:00
Richard Mudgett
0c210c19fa Take diverted-to-number from DivLegInfo1 and use it as connected number.
If no connected number is signaled in the CONNECT message we will use the
last diverted to number.

(issue #14292)
Reported by: tomaso
Patches:
      divleginfo1_to_connectednum.patch uploaded by tomaso (license 564)
      (Used as a guide since it no longer will apply.)
      (This patch is unrelated to the issue.)


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1212 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-15 22:34:52 +00:00
Richard Mudgett
92c277dae5 In q931_getcall(): Simplify test and add related switch types.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1205 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-14 19:03:49 +00:00
Richard Mudgett
28e7e1cdfe Reduce future conflicts when adding ie's to the SETUP message.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1191 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-13 19:06:26 +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
ab1580de67 Conditional out noisy and redundant ASN.1 parse dump of facility ie contents.
1) Outgoing messages have the facility ie ASN.1 decoded and dumped when the
ie is added to the message.  The whole message is then dumped.
2) Incoming messages have the facility ie ASN.1 decoded and dumped when the
ie is processed.  The whole message has already been dumped.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1169 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-09 23:20:37 +00:00
Richard Mudgett
3a9af361fd Sent Q.SIG call rerouting message fixes.
a) Account for pSS1InfoElement where the bearer capability for the new
rerouted call is described.  The call could be a fax or data call, let's
use the appropriate signaling to avoid call rejects on the other end.
b) Handle calling number appropriately, number can be prohibited or
non-existent.
c) Add calling name if available.
d) Use the diversion counter from DivLegInfo2 (if was present in the
incoming Setup) and increment.

(issue #14292)
Reported by: tomaso
Patches:
      libpri-1.4-2009-01-29-rerouting-0.1.9.patch uploaded by tomaso (license 564)
      (Used as a guide since it no longer will apply.)
      (This patch is unrelated to the issue.)



git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1152 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-07 18:34:06 +00:00
Richard Mudgett
175c1e470f Merged revisions 1143, 1144 from
https://origsvn.digium.com/svn/libpri/tags/1.4.10.2

  ..........
  r1144 | mattf | 2009-09-29 10:32:23 -0500 (Tue, 29 Sep 2009) | 1 line

  This fix is more like the fix that was used to resolve the issue for the PRI case
  ..........
  r1143 | mattf | 2009-09-28 14:07:01 -0500 (Mon, 28 Sep 2009) | 1 line

  Changes for 1.4.10.2
  ..........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1151 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-10-07 18:33:09 +00:00
Jeff Peeler
18ea19900c Fix call reference to be associated with the D channel message was received
The problem is that once a call reference was associated with a particular D
channel, it always was. This created an issue with NFAS when the secondary D
channel became active as the messages were still being sent on the non-active
D channel.

(closes issue #14959)
Reported by: remiq
Patches: 
      bug14959.patch uploaded by jpeeler (license 325)
Tested by: remiq


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1120 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-22 17:12:23 +00:00
Richard Mudgett
4d19486781 Update pri_event2str() to current defined events.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1107 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-22 02:23:48 +00:00
Richard Mudgett
599128a65a Another place where timeout events with subcmds should clear any old subcmds.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1097 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-18 00:31:21 +00:00
Richard Mudgett
c8de5d057b Timeout events with subcmds should clear any old subcmds.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1084 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-15 22:24:12 +00:00
Matthew Fredrickson
25b2496b0f Output multiline output with multiple calls to pri_message, so that logs look normal in Asterisk
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1077 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-14 22:32:40 +00:00
Dwayne M. Hubbard
d9af5b25ce Add SERVICE message support for the 'national' switchtype
This set of changes integrates SERVICE message support for the 
'national' switchtype.  The 'national' switchtype uses the 0x43
protocol discriminator.  The 'national' SERVICE/SERVICE ACKNOWLEDGE
and AT&T SERVICE/SERVICE ACKNOWLEDGE message values are opposite
of each other.  This is handled by first determining which
protocol discriminator is in use, then responding with the appropriate
SERVICE ACKNOWLEDGE value.  AT&T SERVICE messages use the
0x3 protocol discriminator.

(closes issue #15803)
Reported by: dhubbard

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1072 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-13 22:54:10 +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
Richard Mudgett
6d9c1cb0d9 Optimized calls to pri_schedule_del().
There is no need to test if a scheduled event is running before calling
pri_schedule_del().


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1060 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-02 20:04:03 +00:00
Richard Mudgett
6d5aeb7cdd Cleaned up scheduled events handling code.
*  Fixed pri_schedule_event() to return 0 on error instead of -1.  Zero is
a safer value to return.  Users would not think that a timer was
scheduled.
*  Fixed potential for pri_schedule_del() to write out of bounds of
pri_sched[].  The out of bounds access could occur when
pri_schedule_event() returned -1.
*  Made use all pri_sched[] entries.  pri_sched[0] was previously unused.
*  Removed some unneeded code and recursion since scheduling only runs on
master D channel structures.
*  Added doxygen comments.
*  Renamed struct pri *pri variables to struct pri *ctrl in this file.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1059 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-09-02 19:49:58 +00:00
Richard Mudgett
503ef0531a Make event channel parameter encoding consistent.
Also make sure that service maintenance messages have the channel id
parameters reinitialized for each message since they are sent over the
global call reference.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1051 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-31 22:57:58 +00:00
Richard Mudgett
e7c9ecb1b2 Split justsignalling into cis_call and cis_auto_disconnect functionality.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1042 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-31 17:24:19 +00:00
Richard Mudgett
61f7a372d9 Fix BRI PTP broken by -r790.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1028 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-26 15:24:34 +00:00
Richard Mudgett
97f33e3286 Put connected name in display ie for CONNECT message.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1019 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-25 16:50:56 +00:00
Richard Mudgett
3908bf2e48 Fix ie ordering in some ie lists for send_message().
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1018 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-25 16:49:07 +00:00
Richard Mudgett
176f0bf6cd Make dump_channel_id() handle variable length fields.
Also did some other minor miscellaneous changes.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1012 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-24 23:06:39 +00:00
Richard Mudgett
d32e70d473 Make sure reversecharge is initialized.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1006 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-24 22:09:38 +00:00
Jason Parker
69fecfd30a Add -n to ldconfig on HURD too.
(closes issue #15130)
Reported by: tzafrir
Patches:
      osarch_hurd.diff uploaded by tzafrir (license 46)


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@1000 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-21 19:51:40 +00:00
Richard Mudgett
2ada419b08 Made the call state to string table use the state defines.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@994 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-20 15:52:27 +00:00
Richard Mudgett
dcd62e467f Add COLP support to libpri for ETSI PTP, ETSI PTMP, and Q.SIG.
Add Connected Line Presentation (COLP) support to chan_dahdi/libpri as an
addition to issue 8824.  This is the libpri portion.  COLP support is now
available for ETSI PTP, ETSI PTMP, and Q.SIG with this patch.

(closes issue #14068)
Tested by: rmudgett

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@982 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-18 23:53:32 +00:00
Jeff Peeler
926cc924d2 Allow custom CPU optimization flags
Added make variable LIBPRI_OPT to set optimization level. By default the
optimization level is now set to -O2.

(closes issue #12676)
Reported by: tzafrir
Patches:
      libpri_opt.diff uploaded by tzafrir (license 46)


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@976 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-18 20:59:32 +00:00
Richard Mudgett
13fbd05e0b Corrected standard document reference.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@968 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-08-07 15:53:20 +00:00
Richard Mudgett
f04f345113 Fixed potential NULL pointer dereference.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@952 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-07-23 20:53:59 +00:00
Richard Mudgett
27a5c7afb6 Fix potential buffer overflow in pri_dump_info_str().
*  Created pri_snprintf() to prevent buffer overflow in pri_dump_info_str().
*  Extracted timer name to timer number table from pri_timer2idx() so
pri_dump_info_str() can use it.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@921 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-26 19:50:19 +00:00
Richard Mudgett
01e637393e Eliminate local version of PRI_MAX_TIMERS.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@920 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-26 19:43:13 +00:00
Richard Mudgett
4f0b3f3109 Doxygenify the timer comments.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@919 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-26 19:41:56 +00:00
Richard Mudgett
24cc37a839 Added printf format attribute to pri_message() and pri_error() and fixed some detected errors.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@914 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-26 18:37:15 +00:00
Sean Bright
562e1fb7ca Add support for sending Reverse Charging Indication IE on ISDN PRI.
Add the ability to transmit a Reverse Charging Indication IE during a SETUP
message.  In passing, re-work some of the receive logic to be forwards
compatible with new RCI values that may be added in the future.  Also removed
the PRI_REVERSECHARGE_SUPPORT define that I added on the last commit since we
can just check for PRI_REVERSECHARGE_NONE or _REQUESTED on the Asterisk side to
determine support for this.

Special thanks to rmudgett who could have written this in half the time he spent
reviewing it, but instead talked me through it.  Much appreciated!

(issue #13760)
Reported by: mrgabu

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@907 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-25 18:53:38 +00:00
Richard Mudgett
c5cdc66b72 Convert PRI_TIMER_xxx to an enum so PRI_MAX_TIMERS can be automatically adjusted.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@901 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-25 17:35:23 +00:00
Richard Mudgett
2eaca806b9 Make it easier to add more timers/counters and vary the defaults based upon switchtype.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@894 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-24 21:45:04 +00:00
Sean Bright
7092459702 Capture and expose the Reverse Charging Indication IE on ISDN PRI.
(issue #13760)
Reported by: mrgabu
Patches:
      20090619_libpri_1.4.patch uploaded by seanbright (license 71)
Tested by: seanbright, pruonckk

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


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@885 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-24 18:19:24 +00:00
Sean Bright
64fd25fcac Revert unintentional changes
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@879 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-23 23:15:56 +00:00
Sean Bright
16304b6a65 Set reviewboard property.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@878 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-23 23:15:04 +00:00
Richard Mudgett
ea4d305ffb Miscellaneous minor changes.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@865 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-12 14:29:42 +00:00
Matthew Fredrickson
3a1739883b There are two changes in this commit that are bug fixes for various Q.921 issues found in internal testing.
Both were exposed/introduced by the TBR4 compliance patch for bug #12861, in changing how retransmissions and in how
the transmission queue was maintained.  TX-RX message flow and acknowledgement was severely restricted,
since the patch changed the behavior so that pending untransmitted frames would not actually be send until
the next RR was received in normal circumstances, or REJ when a reject frame was received.  On busy links,
this can severly limit the amount of useful traffic that is sent, and can slow down message transmission.

Until someone can point out where in Q.921 it is mandated for us to wait for RR frames to start sending
untransmitted messages, the first change is to allow us to send untransmitted frames when we receive new
I frames as well, with updated N(R).

The other bug fixed is a situation caused by the restricted traffic flow, if an outside process tries to send
an I-frame asynchronous to an RR frame, when the transmit window was previously closed and then opened up but 
an RR has not been received yet.  A bug was found with the integration of the old transmit code with the new reject 
handling code which caused the new frame to be sent immediately, regardless if there were any pending untransmitted 
I-frames in the queue to be sent and causing an out of order I-frame to be sent to the other side.  This bug is 
also fixed in this patch.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@859 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-09 19:47:05 +00:00
Richard Mudgett
47830a68aa Made ASN.1 memory dump also display printable characters.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@848 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-03 22:51:42 +00:00
Richard Mudgett
2176bd7fa3 Renamed callstate2str() to q931_call_state_str().
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@842 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-03 21:35:14 +00:00
Richard Mudgett
3c12135659 Made transmit_facility() debug message indiate to which message the facility ie is being added.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@836 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-06-03 21:25:59 +00:00
Richard Mudgett
c69e4780ef Renamed local struct pri *pri variables to struct pri *ctrl in q931.c.
The context tagging for my editor is much happier now that the struct and the
variable do not have the same name.  (At least for this file.)


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@824 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-05-29 15:39:48 +00:00
Richard Mudgett
e7b64b16da Removed usage of FUNC_DUMP(), FUNC_RECV(), and FUNC_SEND() defines.
They did not really help and hindered easy lookup of parameter types.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@804 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-05-20 15:03:34 +00:00
Kevin P. Fleming
39f7f72d8f Add 'const' qualifier to character string argument to keypad facility API calls
These API calls do not modify the string supplied, and should not be allowed to modify it, so this patch adds a 'const' qualifier to that argument to allow the compiler to enforce this restriction (and allow callers of the API that already have a 'const' pointer to be able to pass it to this API).



git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@798 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-05-13 15:17:08 +00:00
Richard Mudgett
5484712af0 Minor code clean up.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@794 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-05-07 16:21:24 +00:00
Richard Mudgett
a5b9b792ea Avoid a stale pointer crash if the TE BRI TEI is removed when active calls exist.
Made the q931_call record point to the master D channel control structure
instead of the BRI TEI subchannel control structure.  When a layer 3 message
is sent, the current TEI subchannel control structure is used.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@790 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-05-07 16:06:19 +00:00
Richard Mudgett
c430cba165 Added Q.931 call state description comments.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@786 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-05-05 22:25:03 +00:00
Richard Mudgett
ac40946c11 Comment changes.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@782 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-05-01 22:47:41 +00:00
Richard Mudgett
b19c0b0a04 Added Q.SIG Advice-Of-Charge encode/decode routines.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@772 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-21 23:32:13 +00:00
Richard Mudgett
ba45095c5a ROSE ASN.1 facility encode and decode rewrite of existing messages.
Several components are now parsed correctly.  Most notably:
PartyNumber and Q.SIG Name.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@766 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-21 22:08:45 +00:00
Jeff Peeler
18fa4716a5 Add service maintenance message support
This adds support for two new message types: Service and Service Acknowledge.
When a channel receives a service message it will either take the channel in
or out of service and then send a service acknowledgment. Although not
enforced here (enforced in chan_dahdi), the service messages are only supported
with switch types 4ess/5ess. The required Asterisk changes will be coming next.

(issue #3450)
Reported by: cmaj


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@732 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-14 15:05:21 +00:00
Richard Mudgett
f9d5aa3c3a Comment changes and some string content corrections.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@726 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-04-02 19:33:38 +00:00
Richard Mudgett
88551af7ef Comment changes to note what ISDN message type causes the event.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@715 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-03-26 16:01:45 +00:00
Richard Mudgett
29ded17c0b Added pSS1InfoElement comments in qsig_cf_callrerouting().
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@711 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-03-19 01:39:21 +00:00
Richard Mudgett
bbaeec9513 Use the correct branch integrated property when generating the version string.
Update the make_version file to the latest Asterisk version with the
appropriate libpri required chage.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@705 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-03-13 01:05:54 +00:00
Joshua Colp
48fc219865 Make sure we only have 4 octects on unrestricted 64k data calls.
(closes issue #14507)
Reported by: jsmith
Patches:
      64k-data.patch uploaded by jsmith (license 15)
Tested by: jsmith
(closes issue #13118)
Reported by: radpeter


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@701 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-03-04 20:31:20 +00:00
Leif Madsen
9ecdbed001 Fix a small spelling error.
(closes issue #14375)
Reported by: jeremy1

git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@687 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-02-02 20:18:03 +00:00
Matthew Fredrickson
3d91cd5e30 A couple of last BRI fixes in libpri... don't discard pending iframes when we call the q921_dchannel_up routine, since we need to be able to send the ones that were queued up while the D-channel went down and is being reactivated. Also fix some buggy logic in the frame transmission decision code.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@680 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-01-27 23:22:06 +00:00
Matthew Fredrickson
a30eeee9a8 Change behavior so that we do not send I-frames when link is down, but instead queue them up until the link comes up and send them out then.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@675 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-01-22 21:48:41 +00:00
Matthew Fredrickson
07c4195876 Add additional case where T200 expires greater than N200 times and we need to release and reacquire the TEI.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@656 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2009-01-09 17:58:28 +00:00
Matthew Fredrickson
40ae2a030a Add some additional debug for Q.921 MDL messages as well as fix a bug in RESTART messages on BRI
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@653 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-12-23 21:38:25 +00:00
Matthew Fredrickson
2c104c4dbd Fix a number of Q.921 bugs, found doing TBR4 compliance testing, thanks to Tzafrir, Xorcom, and co. (#12861). Thanks!
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@645 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-11-22 00:34:26 +00:00
Matthew Fredrickson
e1bfec4b1e Merging in additional Q.SIG features in #13454. Includes Q.SIG physical/logical channel mapping support, extended coding of Q.SIG name operations (calling name), and call rerouting support via added dialplan application.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@636 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-10-17 16:13:42 +00:00
Jason Parker
aeb5a6d284 Make install paths use libdir, like libss7
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@616 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-08-06 18:20:51 +00:00
Kevin P. Fleming
64eaca5bfa Merged revisions 610 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r610 | kpfleming | 2008-08-05 17:16:58 -0500 (Tue, 05 Aug 2008) | 2 lines

clean up license headers, and explicitly grant additional permissions when used with Asterisk

........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@611 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-08-05 22:18:12 +00:00
Kevin P. Fleming
67bc1003ab update ignore list
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@607 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-30 15:43:55 +00:00
Kevin P. Fleming
419282d399 use better version.c creation process, and better dependency tracking process too
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@606 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-30 15:39:37 +00:00
Jason Parker
9e6df1092c I believe this is what was meant. (it matches how Asterisk does it)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@602 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-29 22:47:37 +00:00
Jason Parker
1c7588ead5 libpri is not libss7 :D
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@598 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-29 22:29:11 +00:00
Kevin P. Fleming
16df54e01a correct comments to match code
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@594 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-22 22:36:25 +00:00
Kevin P. Fleming
16719a5f74 rename API call and option (nothing has been released to use it yet so this should be safe) to be more accurate in describing what it does
(closes issue #13042)



git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@589 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-22 19:43:26 +00:00
Kevin P. Fleming
8c5da8a278 ignore generated files
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@579 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-11 16:44:11 +00:00
Kevin P. Fleming
aad7c3e8f1 modify work done for issue #10552, making the support of inband audio after RELEASE a configurable option, since it is causing problems for a number of users
(closes issue #13042)


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@574 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-07-11 16:24:01 +00:00
Dwayne M. Hubbard
95ccc0e03c While working on issue 3450 I noticed that the information channel selection field in the channel identification IE was displayed incorrectly when using 'pri intense debug'. I wanted another pair of eyes to look at the code because everything looked correct until Shaun Ruffell noticed the missing comma in the msg_chan_sel array.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@562 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-06-04 17:02:12 +00:00
Matthew Fredrickson
b9a6ab0c69 Moving trunk changes back into 1.4
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@557 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-05-07 19:51:44 +00:00
Brett Bryant
dee4c9ae0f Add new API call (pri_get_version) to show the current version of the branch for support purposes.
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@552 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-05-02 20:21:04 +00:00
Kevin P. Fleming
b9bd97cdb7 fix the indentation in this function so that it is actually possible to read it and understand the logic and flow
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@544 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-04-16 00:21:01 +00:00
Joshua Colp
c93dfbae5f If inband audio is being provided with a disconnect message let the audio be heard before releasing the channel.
(closes issue #10552)
Reported by: paravoid
Patches:
      disconnect-audio.diff uploaded by paravoid (license 200)


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@528 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-02-21 16:38:11 +00:00
Matthew Fredrickson
160be09f76 Improve transmission, receiving, and dumping of bearer capability IE (#11593)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@524 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-02-18 20:31:38 +00:00
Matthew Fredrickson
ba46c5ca03 Merged revisions 513 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r513 | mattf | 2008-01-11 10:33:52 -0600 (Fri, 11 Jan 2008) | 1 line

We should not be parsing further into the bearer capability IE if the length does not confirm that there actually is data present
........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@514 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2008-01-11 16:34:44 +00:00
Kevin P. Fleming
33a28eeda1 Merged revisions 478 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r478 | kpfleming | 2007-10-22 10:09:27 -0500 (Mon, 22 Oct 2007) | 3 lines

we need to include stddef.h for 'size_t'


........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@479 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-10-22 15:10:06 +00:00
Jason Parker
595154da5a Fix an incorrect pri_event structure definition.
Issue 10832, patch by flefoll


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@470 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-10-05 16:45:39 +00:00
Matthew Fredrickson
cdb9c294c1 Fix user-user IE order in setup message (#10705)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@468 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-09-25 21:37:40 +00:00
Matthew Fredrickson
2a27c0f173 Fix for #10189. Make sure we properly report the user layer 1 for H.223 and H.245
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@465 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-09-14 21:32:54 +00:00
Matthew Fredrickson
e498bef21f Merged revisions 460 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r460 | mattf | 2007-09-06 10:06:42 -0500 (Thu, 06 Sep 2007) | 1 line

TBCT now works.  It should work for NI2, 4E, and 5E.  This code was tested on NI2.
........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@462 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-09-06 15:11:29 +00:00
Jason Parker
ac51a8e058 Merged revisions 445 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r445 | qwell | 2007-08-27 14:20:23 -0500 (Mon, 27 Aug 2007) | 2 lines

Make sure we build both the static and shared modules with -fPIC.

........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@446 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-08-27 19:21:08 +00:00
Jason Parker
11f13f9b2d Allow setting CC to something with a space, such as make CC="gcc -m32"
Issue 10253.


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@441 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-08-06 19:58:19 +00:00
Matthew Fredrickson
cd56dc1b1c Merged revisions 426 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r426 | mattf | 2007-06-19 13:22:33 -0500 (Tue, 19 Jun 2007) | 1 line

Try to send pending facility messages if we receive alerting (for when we don't get proceeding) (#9651)
........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@427 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-06-19 18:23:36 +00:00
Matthew Fredrickson
a17ce5bdea Merged revisions 423 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r423 | mattf | 2007-06-06 16:57:15 -0500 (Wed, 06 Jun 2007) | 1 line

Oops, that should not be on one line
........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@424 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-06-06 21:58:22 +00:00
Matthew Fredrickson
fcd5775b8b Merged revisions 415 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r415 | mattf | 2007-06-06 08:20:05 -0500 (Wed, 06 Jun 2007) | 2 lines

Make sure we only send the NFE when we are talking QSIG

........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@416 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-06-06 13:22:15 +00:00
Matthew Fredrickson
199d4c7fc5 Merged revisions 389 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r389 | mattf | 2007-01-22 16:20:59 -0600 (Mon, 22 Jan 2007) | 2 lines

Make sure we send DISCONNECT if we reached the active state and a call is disconnected, regardless of cause code.

........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@390 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2007-01-22 22:29:24 +00:00
Joshua Colp
a22bd0df05 Merged revisions 385 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r385 | file | 2006-12-30 14:16:17 -0500 (Sat, 30 Dec 2006) | 2 lines

Specify full path to restorecon instead of assuming it will be available from what is in $PATH. (issue #8670 reported by djflux)

........


git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@386 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-12-30 19:17:34 +00:00
Kevin P. Fleming
a898653315 how about we use the correct name for this one
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/1.4@373 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-09-20 21:00:32 +00:00
Kevin P. Fleming
16ae0df732 it's time :-)
git-svn-id: https://origsvn.digium.com/svn/libpri/branches/branch-1.4@372 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-09-20 20:58:27 +00:00
Matthew Fredrickson
342c1f81ca Make sure we send any pending facility APDUs after we receive proceeding. #7551
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@367 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-28 14:41:57 +00:00
Matthew Fredrickson
9969553056 Make IE debug more consistent and readable. (#7559)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@366 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-21 15:55:54 +00:00
Matthew Fredrickson
9037525b7b Improve call state handling code. (#7269)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@365 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-21 15:43:31 +00:00
Russell Bryant
f245f64a2e Blocked revisions 360 via svnmerge
........
r360 | russell | 2006-07-12 15:08:31 -0400 (Wed, 12 Jul 2006) | 2 lines

ensure buffer is initialized (issue #7512, klaus3000)

........


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@361 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-12 19:09:07 +00:00
Russell Bryant
cd91dba660 ensure buffer gets initialized (issue #7512, klaus3000)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@359 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-12 19:04:12 +00:00
Matthew Fredrickson
a24748c0f8 Fix for #7378, namespace collision issue.
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@357 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-07 15:35:48 +00:00
Matthew Fredrickson
8c69834e21 Updates to add T309 to libpri. Thanks flefoll!
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@356 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-06 21:11:37 +00:00
Kevin P. Fleming
8192b42674 prepare for new zaptel.h location
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@355 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-07-05 16:17:05 +00:00
Kevin P. Fleming
de00a26f71 remove support for CVS checkouts
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@354 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-19 15:18:47 +00:00
Kevin P. Fleming
fe9fff6dcb revert change that didn't actually change anything, and fix formatting of conditional expression so it's more clear what it does
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@352 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-08 22:34:25 +00:00
Matthew Fredrickson
2ce7890fdd Make sure we don't send display if callername is set to a 0 length string.
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@351 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-08 22:16:55 +00:00
Matthew Fredrickson
de008c4d60 Changes to improve state reporting in libpri. (#7260)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@350 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-06 22:06:52 +00:00
Matthew Fredrickson
7db8af4b80 Minor state fix (#7269)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@348 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-02 16:06:27 +00:00
Matthew Fredrickson
a33fd59dc6 Fix for 7115. Don't call pri_message multiple times
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@346 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-02 14:34:20 +00:00
Matthew Fredrickson
a3ee176154 Fixes so that fields are initialized in events from #7241. Thanks flefoll!
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@343 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-06-01 18:00:31 +00:00
Kevin P. Fleming
f316eed834 this is a portable sh script, not a bash script
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@336 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-05-09 08:22:27 +00:00
Kevin P. Fleming
c6ccbf69ca restore functionality for Debian with FreeBSD kernel without breaking regular FreeBSD
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@335 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-05-09 08:21:45 +00:00
Matthew Fredrickson
f10e2174b4 FreeBSD fixes for build process
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@334 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-05-09 08:15:51 +00:00
Kevin P. Fleming
fd75f5ade1 Merged revisions 316,323,327,332 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r332 | kpfleming | 2006-04-30 10:17:47 -0500 (Sun, 30 Apr 2006) | 3 lines

set LDCONFIG_FLAGS for GNU/kFreeBSD as well
use the flags during installation

........


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@333 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-04-30 15:20:00 +00:00
Matthew Fredrickson
ed9c90a985 Make sure we pass the call back in setup_ack
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@328 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-04-27 16:09:11 +00:00
Matthew Fredrickson
f57f033aac Fix for 6841, so that we offer caller name on NI1 within the display IE
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@324 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-04-04 15:38:25 +00:00
Matthew Fredrickson
11984069b6 Fix for #6566 (Makefile doesn't honor DESTDIR)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@322 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-04-04 15:34:35 +00:00
Matthew Fredrickson
533412e361 Fix the transmit_display function to not send DISPLAY from CPE->Network on EuroISDN
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@321 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-03-31 22:37:46 +00:00
Matthew Fredrickson
e2091c29ef Cause code clarifications (Q.SIG versus non Q.SIG)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@317 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-17 21:19:37 +00:00
Matthew Fredrickson
b92b08dad7 Fix for 6480 (crash when accepting calling_part_subaddress with nothing in it)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@315 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-17 18:54:20 +00:00
Matthew Fredrickson
e225476864 More TODO updates
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@314 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-16 19:21:30 +00:00
Matthew Fredrickson
e17aebfc82 Update our TODO list
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@313 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-16 19:07:06 +00:00
Matt O'Gorman
d8f64e6c98 Merged revisions 311 via svnmerge from
https://svn.digium.com/svn/libpri/branches/1.2

........
r311 | mogorman | 2006-02-15 11:59:38 -0600 (Wed, 15 Feb 2006) | 2 lines

bug 6500 typo in README.

........


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@312 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-15 18:01:03 +00:00
Matthew Fredrickson
3c061000b5 Make sure we reset the field if we get one in a disconnect
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@310 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-14 19:30:32 +00:00
Kevin P. Fleming
a98061f019 set mime-type and eol-style on all files
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@309 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-14 19:22:26 +00:00
Kevin P. Fleming
3ea2ea8cf1 Merged revisions 296,306 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r296 | russell | 2006-01-17 22:53:47 -0600 (Tue, 17 Jan 2006) | 2 lines

remove old ChangeLog ... it will now only be in the tags

........
r306 | kpfleming | 2006-02-13 17:06:02 -0600 (Mon, 13 Feb 2006) | 2 lines

suppress annoying message about unsupported components in facility messages

........


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@308 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-13 23:07:56 +00:00
Kevin P. Fleming
6f831daaed rename merge property
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@307 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-02-13 23:07:11 +00:00
Matthew Fredrickson
681a5f582e RLT works!!! Tested successfully on a DMS100 switch. (For those wondering, RLT
is basically 2 B-channel transfer on DMS100)


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@305 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-19 23:27:27 +00:00
Matthew Fredrickson
0a326a9744 More little updates for RLT on DMS100. Fix ASN.1 dump code for multibyte facility IE headers
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@303 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-19 22:24:41 +00:00
Matthew Fredrickson
30188c642d More changes for RLT
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@302 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-19 22:18:01 +00:00
Matthew Fredrickson
3f78370c92 More fixes for RLT
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@301 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-19 21:56:10 +00:00
Matthew Fredrickson
4c20e50a5d Fix the extension bit on our facility IE
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@300 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-19 21:15:31 +00:00
Matthew Fredrickson
6b5781bb3a More silly cleanups
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@299 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-19 18:36:32 +00:00
Matthew Fredrickson
333a5eb67a Header file cleanups
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@298 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-19 18:31:48 +00:00
Matthew Fredrickson
0e2e37b537 Numerous updates for RLT (just remember, trunk can be a bumpy ride)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@297 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-19 18:22:06 +00:00
Kevin P. Fleming
cb7b843e10 update to reflect all merged revisions from 1.2 branch
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@293 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-17 13:44:58 +00:00
Kevin P. Fleming
d97a630a81 Merged revisions 291 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r291 | kpfleming | 2006-01-17 07:43:18 -0600 (Tue, 17 Jan 2006) | 2 lines

ensure that user-user info field in call is properly reset when not needed

........


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@292 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-17 13:44:12 +00:00
Matthew Fredrickson
9447f39f3f Makefile update to correctly do library version numbers
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@289 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-10 20:17:34 +00:00
Matthew Fredrickson
8fa183a4bc Lots of changes for APDU handling and debugging. Thanks PCadach (bug #5265)!
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@286 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-05 20:50:51 +00:00
Matthew Fredrickson
9e03b9b8c7 Add tzanger's patch which (among other things) prints whitespace in IE dumps
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@285 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2006-01-05 19:33:32 +00:00
Matthew Fredrickson
274f535654 Make sure that the called number field is reset in case we only get sending complete in an INFORMATION message
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@283 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-27 13:59:37 +00:00
Matthew Fredrickson
424fa816e3 Send RR as command instead of response when T200 expires after receiving RNR.
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@279 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-06 21:18:44 +00:00
Russell Bryant
9c8628715f change 'char *' to 'const char *' for useruserinfo to go along with the fixes
from r7327 in the asterisk trunk


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@277 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-04 15:32:46 +00:00
Russell Bryant
bb1f882f8a fix compiler warning that actually causes the build to fail since we treat
warnings as errors in libpri


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@276 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-02 03:59:41 +00:00
Kevin P. Fleming
8738891752 Merged revisions 274 via svnmerge from
https://origsvn.digium.com/svn/libpri/branches/1.2

........
r274 | kpfleming | 2005-12-01 17:13:49 -0600 (Thu, 01 Dec 2005) | 2 lines

Makefile 'update' target now supports Subversion repositories (issue #5875)

........


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@275 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-02 00:57:34 +00:00
Kevin P. Fleming
b1db8aaae6 configure trunk for merging fixes from 1.2 branch
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@273 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-01 19:18:54 +00:00
Matthew Fredrickson
dd611af000 Modify the warning #define
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@272 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-01 18:06:20 +00:00
Matthew Fredrickson
8d6d58ab09 Add in keypad facility transmission support
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@271 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-12-01 17:59:56 +00:00
Matthew Fredrickson
d6cab1d527 Allow receival of single digit keypad facility IEs. Was broken before.
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@269 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-30 22:42:40 +00:00
Kevin P. Fleming
a634c4253b remove CVS ignore lists
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@267 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-29 18:40:06 +00:00
Kevin P. Fleming
cf8c723f8b remove extraneous svn:executable properties
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@266 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-11-29 18:39:18 +00:00
Matthew Fredrickson
014fd45a37 Fix typo in commit
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@255 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-10-25 16:59:59 +00:00
Matthew Fredrickson
89384a8472 Add protection block
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@254 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-10-21 21:21:22 +00:00
Matthew Fredrickson
e0de929e20 Updates so that one can do user to user IE transmission
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@253 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-10-21 20:20:22 +00:00
Matthew Fredrickson
160b8c91b8 Fix so that APDUs are not added multiple times for a call (Bug #5361)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@252 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-10-04 17:35:48 +00:00
Kevin P. Fleming
326c5c66d6 allow Makefile to be used more easily in automated build environments (issue #5291)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@251 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-09-26 15:57:23 +00:00
Anthony Minessale II
9842934154 fixing compile errors! check the patch but if it's wrong it's better than not compiling at all
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@250 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-09-16 17:15:57 +00:00
Matthew Fredrickson
f64108e394 Don't specify DS1 on Q.SIG
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@249 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-09-16 17:02:44 +00:00
Matthew Fredrickson
83c78f9e85 Q.SIG fix. Don't send DISPLAY IE for callername
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@248 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-09-15 15:46:09 +00:00
Mark Spencer
cfee7ff007 Add ability to restart PRI at Q.921 layer
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@247 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-09-13 02:19:00 +00:00
Kevin P. Fleming
4bbe741b99 send calling plan info for RDNIS and originally called number in new call events
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@246 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-09-02 18:37:03 +00:00
Kevin P. Fleming
3269a4b034 cleanups and fixes for Solaris (issue #4999)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@245 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-08-29 19:12:31 +00:00
Matthew Fredrickson
21d693f0b4 Fix pridump so that it works again (bug 4803) Thanks PCadach
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@243 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-07-27 13:14:05 +00:00
Kevin P. Fleming
598e8092f1 make copy_string able to build on older compilers (bug #4714)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@242 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-07-15 16:29:20 +00:00
Matthew Fredrickson
bbd1d88f70 Fix for gcc-4.0
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@241 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-07-13 14:09:16 +00:00
Matthew Fredrickson
badbe8cf1f Fix for non constructed number component
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@240 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-07-12 20:15:20 +00:00
Kevin P. Fleming
25cb0b7457 forward more ANI information to users of libpri (bug #4571)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@239 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-07-12 02:33:25 +00:00
Matthew Fredrickson
ac9bba5121 Don't allow notification codes outside of the Q.931 spec for switches other
than EuroISDN.  Also take out some old facility IE code.


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@238 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-07-11 17:48:30 +00:00
Matthew Fredrickson
00d12810bb more cause stuff
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@235 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-29 21:28:23 +00:00
Matthew Fredrickson
d8ac58da6d Allow cause IEs to be passed through libpri in PROGRESS messages
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@234 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-29 17:27:03 +00:00
Kevin P. Fleming
3fe76c6aea correct improperly applied patch from bug 4405 (bug #4573)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@231 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-22 19:27:43 +00:00
Kevin P. Fleming
f622f51004 use libpri_copy_string() (same as ast_copy_string()) instead of strncpy
update file headers for proper copyrights and licenses
various other minor optimizations


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@230 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-21 22:47:39 +00:00
Kevin P. Fleming
6694b84e88 record network-provided-number as ANI when supplied (bug #4537)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@229 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-21 20:37:22 +00:00
Matthew Fredrickson
849ec03cb0 more ASN.1 parsing fixes
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@228 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-03 18:29:25 +00:00
Matthew Fredrickson
9bcef26cd6 More ASN.1 size fixes
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@227 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-02 22:40:35 +00:00
Matthew Fredrickson
c9710c8b33 More fixes for indefinite length in the ASN.1 parsing routines
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@226 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-02 20:58:32 +00:00
Matthew Fredrickson
3c1f055287 Have a couple of operations wrong for Q.SIG from the merge
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@225 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-06-02 15:55:49 +00:00
Russell Bryant
b81d7389a9 add missing argument (bug #4405)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@223 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-05-29 15:08:23 +00:00
Matthew Fredrickson
6e98b36cfb Explicit/Implicit ds1 selection changes for NFAS
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@222 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-05-24 15:03:33 +00:00
Matthew Fredrickson
6341ab3c6e Bug fixes in output debug code
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@221 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-05-23 18:15:06 +00:00
Matthew Fredrickson
2a263061f2 New pri_set_message api
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@220 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-05-23 16:51:30 +00:00
Matthew Fredrickson
64088fe864 PRI debug additions -- testing...
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@219 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-05-23 15:06:33 +00:00
Matthew Fredrickson
1e4b4fbdbb Explicit versus implicit DS1 selection options
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@218 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-05-19 14:06:43 +00:00
Matthew Fredrickson
8205ce358a Add support to enable/disable facility IE Supplementary Services
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@217 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-05-12 14:48:00 +00:00
Matthew Fredrickson
3803535593 pri show debug feature (bug 4210)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@215 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-05-10 21:02:41 +00:00
Kevin P. Fleming
099ee35431 suppress harmless warning (bug #4061)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@214 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-22 02:37:37 +00:00
Matthew Fredrickson
3e8f5869ae More little callername tweaks
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@213 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-21 21:58:21 +00:00
Matthew Fredrickson
4ecc27efab Round two with CPE callername sending
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@212 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-21 19:58:14 +00:00
Kevin P. Fleming
0a3a816622 ensure that Q.921/Q.931 structures are always aligned on 8-bit boundaries, even on platforms with non-default structure alignment (bug #4052)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@211 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-20 15:23:35 +00:00
Matthew Fredrickson
c03b48392a Q.SIG timer rearrangement
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@210 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-08 23:04:37 +00:00
Matthew Fredrickson
e4fbf8c388 BIG libpri-matt merge. Adding new event information and fixing the
parsing routing for DivertingLegInformation2 so that it can work with
indefinite length-encoded ASN.1 parameters


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@209 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-06 19:42:41 +00:00
Mark Spencer
7f866680ad Add ability to detect old libpri
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@208 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-06 19:14:39 +00:00
Matthew Fredrickson
fa826f1151 Add missing PRI/Q.931 progress mask
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@207 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-05 21:54:15 +00:00
Matthew Fredrickson
240cd3ece0 Merging Advice of Charge code into libpri (bug #3843)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@206 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-05 03:55:58 +00:00
Kevin P. Fleming
241f97782c silence signed/unsigned warnings with upcoming gcc-4 (bug #3915)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@204 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-04-03 23:07:55 +00:00
Matthew Fredrickson
02abf57233 Fix callernumber IE to be read only once
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@203 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-03-31 20:56:52 +00:00
Mark Spencer
23a638cf66 Allow PRI to support callback functions (Diana's patch, placed in public domain)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@202 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-03-17 15:46:23 +00:00
Matthew Fredrickson
d7b60b28e0 Just send callername APDUs if we're network side
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@201 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-03-16 15:10:41 +00:00
Matthew Fredrickson
84adda970c Fixed some free() bugs in the APDU code.
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@200 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-03-10 20:37:16 +00:00
Matthew Fredrickson
545e628f65 Make sure WE release the connection if we're the one that started the signalling only connection
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@197 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-03-04 15:56:37 +00:00
Matthew Fredrickson
9d279a6d6e Adding debug level for APDUs
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@196 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-03-02 16:03:22 +00:00
Matthew Fredrickson
86cf50b9c3 Big PRI commit. Merges bugs 3623 and 3554 back. Includes additional
event for Q931_IE_KEYPAD_FACILITY and all of the various Q.SIG functions,
2BCT on 5ESS, and a few other random changes


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@195 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-03-02 15:56:11 +00:00
Mark Spencer
c164cccc87 Reflect 7k audio name change (bug #3547)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@194 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-02-28 06:34:24 +00:00
Mark Spencer
bbaa1ed2e7 Make exception for OpenH323 here, not just in Asterisk.
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@190 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-02-19 22:04:11 +00:00
Mark Spencer
e7b075b6f6 Add missing line from bug #3448
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@188 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-02-05 16:54:52 +00:00
Matthew Fredrickson
6f32fe5793 Support for DivertingLegInformation2 ROSE ADPU. Thanks PCadach!
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@187 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-02-03 22:14:44 +00:00
Mark Spencer
75a5597f39 Fix mkdep for dynamic library version (bug #3497)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@186 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-02-03 05:09:05 +00:00
Mark Spencer
0e0d251e15 Present message code properly (bug #3447)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@185 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-01-28 22:11:24 +00:00
Mark Spencer
dc74d755a8 Check for data presense (bug #3435 again)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@184 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-01-27 20:47:10 +00:00
Mark Spencer
14796a30af Produce more verbose PRI output (bug #3435)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@183 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-01-27 06:05:09 +00:00
Mark Spencer
f89bbdd6a3 Fix generic digit byte order (bug #2788)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@182 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-01-27 05:39:17 +00:00
Matthew Fredrickson
1cfe36a944 Don't send callername as CPE
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@181 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-01-25 00:36:34 +00:00
Mark Spencer
3cfff2fe15 Fix switch compatibility issue with STATUS and S-12 switch (bug #3415)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@180 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-01-24 20:57:04 +00:00
Mark Spencer
c05e4b45c0 Merge pcadach's new progress code (bug #2822)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@179 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-01-17 12:58:05 +00:00
Mark Spencer
1630193827 Fix Makefile for update to be better (bug #3284)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@176 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2005-01-09 01:18:22 +00:00
Matthew Fredrickson
073bd4fa70 Support callername being sent over NI2 type switches
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@175 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-27 16:25:29 +00:00
Matthew Fredrickson
b210417743 For switches (NI2) that implement GR-1367 callername can't be greater than 15
characters.


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@174 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-27 16:22:30 +00:00
Mark Spencer
7f2237532a Fix for SE-Linux (bug #3147)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@172 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-26 23:10:54 +00:00
Mark Spencer
eb07e6e76c Support original number (bug #3134)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@171 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-23 01:55:51 +00:00
Matthew Fredrickson
610abad23b Mods so that PRI_NETWORK side on NI2 switches sends Callername
over facility IE


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@170 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-22 18:46:23 +00:00
Mark Spencer
ecaf1b6103 Add redirecting reason as a define to detect in chan_zap
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@169 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-16 03:10:41 +00:00
Mark Spencer
a6977c6ddb Complete port to solaris (bug #3062)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@168 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-15 20:15:28 +00:00
Matthew Fredrickson
0f6b3ad8ac Adding redirecting reason support if exists to public interface
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@167 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-15 19:48:15 +00:00
Mark Spencer
77bc439e4a Add support for codeset 6 DISPLAY
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@165 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-15 15:48:20 +00:00
Mark Spencer
e1d6903ed4 Fix order
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@164 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-15 15:44:22 +00:00
Mark Spencer
f0396f6fa5 Fix fputs/fprintf
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@163 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-15 15:43:17 +00:00
Mark Spencer
b75e9f8355 Fix timers issue with GR-303
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@162 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-12-12 22:12:04 +00:00
Mark Spencer
56dc30315b Fix ANI2 support (bug #2788)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@160 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-11-07 18:58:05 +00:00
Mark Spencer
8ae7489b5a Fix ANI II digits (bug #2788)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@159 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-11-05 20:27:56 +00:00
Mark Spencer
2728db0c83 Merge Paul's generic digits support (bug #2788)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@158 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-11-05 02:12:02 +00:00
Mark Spencer
52f8d6bbd9 Minor debugging improvements (bug #2758)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@157 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-30 20:22:04 +00:00
Mark Spencer
b6d1f4016f Add progress support reporting to PRI (bug #2759)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@156 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-30 20:19:18 +00:00
Mark Spencer
5b2bc04f41 Add ability to send redirecting number (bug #2760)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@155 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-30 20:13:20 +00:00
Mark Spencer
660a6a7754 Don't be picky about PROGRESS having PROGRESS INDICATOR.
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@154 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-29 15:41:59 +00:00
Matthew Fredrickson
69e8d42ac2 Change to which switchtypes to send facility IEs to
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@152 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-28 16:18:14 +00:00
Matthew Fredrickson
8a5895191f Adding some new files for handling facility ies
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@151 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-27 20:44:39 +00:00
Matthew Fredrickson
cea480c941 Rudimentery support for transmitting and receiving calling name
via facility information elements


git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@150 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-27 20:43:23 +00:00
Mark Spencer
6bfef709dc Fix endian for FreeBSD (bug #2679)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@149 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-27 20:17:17 +00:00
James Golovich
542a5ffe0c Change pri_dump_info to generate string instead of using pri_message (bug 2703)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@147 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-26 04:27:29 +00:00
Mark Spencer
a3101da9fe Documentation fixes
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@142 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-14 18:23:47 +00:00
Mark Spencer
8ac2db33d4 Add missing case in pres2str (bug #2567)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@139 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-04 14:41:02 +00:00
James Golovich
ba5a5ca907 Allow PRI timers to be congfigurable. (bug 2518)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@138 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-10-02 14:55:20 +00:00
Mark Spencer
2b7b7e2e68 Make sure retranstimer is set to 0
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@135 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-09-20 13:29:37 +00:00
Mark Spencer
9682be31fb Merge BKW's ANI2 patch (bug #2450)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@134 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-09-17 04:02:16 +00:00
Mark Spencer
ea146a8f6f Check for existance of *caller* number when sending caller, not called number (bug #2453)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@133 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-09-16 20:38:13 +00:00
Mark Spencer
12155fa6c3 Minor Makefile fixes for libpri (bug #2330)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@132 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-08-31 17:40:59 +00:00
Mark Spencer
96535a0c17 Fix redirecting number (bug #2146)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@131 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-08-25 06:20:50 +00:00
Mark Spencer
cac414333f Matt's requested fix
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@130 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-07-23 16:20:06 +00:00
Mark Spencer
748702c5c5 Don't seg when out of memory (bug #2120)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@129 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-07-23 16:04:01 +00:00
Mark Spencer
6dd859f5de Don't process subchannels by default
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@128 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-07-16 02:14:04 +00:00
Mark Spencer
5fd79b6b1b Add notify patch (bug #1785)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@127 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-29 17:57:18 +00:00
James Golovich
e88ac71b3d Make mkdep throw away stderr
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@126 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-29 15:19:15 +00:00
Mark Spencer
5166adfb1e Never send channel identifier with SETUP when GR303 CPE
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@125 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-29 04:28:34 +00:00
Mark Spencer
f8b7c404a0 Don't expect connect acknowledge on CPE when GR-303 mode
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@124 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-27 20:29:53 +00:00
Mark Spencer
b93317f38b Make sure NSF is initialized properly
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@123 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-26 04:42:20 +00:00
Mark Spencer
18958fa7e8 Add NSF support (bug #1927)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@122 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-26 04:37:09 +00:00
Mark Spencer
c9bb969586 Add subaddress support
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@121 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-25 19:33:12 +00:00
Mark Spencer
7cdd6c7f2c Don't send Character set in EuroISDN
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@120 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-24 13:43:36 +00:00
Mark Spencer
3193d779ef Don't change states on progress!
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@119 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-17 16:24:10 +00:00
Mark Spencer
97648bb1b4 Handle DISC and REL with missing mandatory information elements
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@118 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-16 22:19:11 +00:00
Mark Spencer
20e146406b More codeset fixes (thanks to pcadach)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@117 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-16 18:25:35 +00:00
Mark Spencer
1e5fad5fe7 Don't send proceeding when sending progress
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@116 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-16 18:04:22 +00:00
Mark Spencer
dd9ba5b8a5 Allow number complete to be forced on SETUP
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@115 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-16 17:16:37 +00:00
Mark Spencer
d4eab6216e Create new, more extensible setup method (pri_setup)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@114 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-16 15:33:58 +00:00
Mark Spencer
1cabafb5fb Handle locking and non-locking shift (bug #1687)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@113 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-14 22:21:05 +00:00
Mark Spencer
66781c3141 Separate PROGRESS and PROCEEDING
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@112 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-14 21:25:41 +00:00
Mark Spencer
832475b271 Debug improvements (including bug #1784)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@111 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-14 03:29:19 +00:00
Mark Spencer
6ccb8df101 Add notify support courtesy PCadach
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@110 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-14 02:48:24 +00:00
Mark Spencer
fd0f41e4a5 Include DS1 number
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@109 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-10 19:28:14 +00:00
James Golovich
0933575a5d Make q931.c:dump_display build the string first then print it in one command. Fixes remote console ugliness
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@108 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-10 06:51:01 +00:00
Mark Spencer
818a8cb57a Apprently AT&T uses 0x43 for maintenance messages too
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@107 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-10 03:57:43 +00:00
Mark Spencer
de0e6ba4cc Formatting fixes
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@106 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-07 17:00:29 +00:00
Mark Spencer
30d983f45f More GR-303 fixes, detect drop of D-channel
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@105 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-07 15:55:39 +00:00
Mark Spencer
d0c78dd62d Add the ability to slave one PRI to another with respect to calls
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@104 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-07 03:33:51 +00:00
Mark Spencer
551f0fafc8 Be careful not to destroy non-existant calls
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@103 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-06 23:26:43 +00:00
Mark Spencer
2300f57294 GR-303 updates
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@102 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-06 01:21:41 +00:00
Mark Spencer
f065327cc1 Major changes in preparation for GR-303 and NFAS support
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@101 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-06-05 06:50:55 +00:00
Mark Spencer
bce8bfb87f Fix minor typo (bug #1701)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@100 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-22 19:06:54 +00:00
Mark Spencer
4ae8cc7bcf Make build on FreeBSD
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@99 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-22 04:25:53 +00:00
Mark Spencer
76955b74c3 Properly handle non-transmission of channel identifier
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@98 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-20 00:21:16 +00:00
Mark Spencer
baefdcb18d Fix debugging of calling party number when no presentation specified (bug #1677)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@97 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-19 22:02:40 +00:00
Mark Spencer
7aac157b7f Only send channel identifier with call proceeding
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@96 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-19 21:01:36 +00:00
Mark Spencer
2c26d98a89 Add separate ability to do both progress and proceeding
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@95 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-19 15:34:43 +00:00
Mark Spencer
c413151375 Send progress indicator on progress if appropriate
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@94 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-19 15:26:16 +00:00
Mark Spencer
8098266c90 Allow progress to be sent with 1
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@93 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-19 15:21:15 +00:00
Mark Spencer
c8528b633a Allow ability to send just call proceeding
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@92 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-19 14:34:29 +00:00
Mark Spencer
c591726079 We have to update n_r when transmitting backlogged packets
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@91 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-05-17 03:32:11 +00:00
James Golovich
9f724a22f3 Extremely minor q931.c code cleanup
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@90 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-04-21 21:21:29 +00:00
Mark Spencer
c39fdd5cad On EuroISDN don't send layer1/2 since some switches seem to be concerned. (bug #960)
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@89 2fbb986a-6c06-0410-b554-c9c1f0a7f128
2004-04-16 18:05:41 +00:00
43 changed files with 39983 additions and 2401 deletions

View File

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

1
.version Normal file
View File

@@ -0,0 +1 @@
1.4.11.4

1311
ChangeLog Executable file → Normal file

File diff suppressed because it is too large Load Diff

341
LICENSE Normal file
View File

@@ -0,0 +1,341 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

197
Makefile Executable file → Normal file
View File

@@ -27,70 +27,193 @@
# Uncomment if you want libpri to count number of Q921/Q931 sent/received
#LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
TOBJS=testpri.o
T2OBJS=testprilib.o
STATIC_LIBRARY=libpri.a
DYNAMIC_LIBRARY=libpri.so.1.0
STATIC_OBJS=pri.o q921.o prisched.o q931.o
DYNAMIC_OBJS=pri.lo q921.lo prisched.lo q931.lo
CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g $(ALERTING) $(LIBPRI_COUNTERS)
INSTALL_PREFIX=
CC=gcc
GREP=grep
AWK=awk
all: depend $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
OSARCH=$(shell uname -s)
PROC?=$(shell uname -m)
# SONAME version; should be changed on every ABI change
# please don't change it needlessly; it's perfectly fine to have a SONAME
# of 1.2 and a version of 1.4.x
SONAME:=1.4
STATIC_LIBRARY=libpri.a
DYNAMIC_LIBRARY:=libpri.so.$(SONAME)
STATIC_OBJS= \
copy_string.o \
pri.o \
q921.o \
prisched.o \
q931.o \
pri_facility.o \
asn1_primitive.o \
rose.o \
rose_address.o \
rose_etsi_aoc.o \
rose_etsi_diversion.o \
rose_etsi_ect.o \
rose_other.o \
rose_q931.o \
rose_qsig_aoc.o \
rose_qsig_ct.o \
rose_qsig_diversion.o \
rose_qsig_mwi.o \
rose_qsig_name.o \
version.o
DYNAMIC_OBJS= \
copy_string.lo \
pri.lo \
q921.lo \
prisched.lo \
q931.lo \
pri_facility.lo \
asn1_primitive.lo \
rose.lo \
rose_address.lo \
rose_etsi_aoc.lo \
rose_etsi_diversion.lo \
rose_etsi_ect.lo \
rose_other.lo \
rose_q931.lo \
rose_qsig_aoc.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)
INSTALL_PREFIX=$(DESTDIR)
INSTALL_BASE=/usr
libdir?=$(INSTALL_BASE)/lib
SOFLAGS:=-Wl,-h$(DYNAMIC_LIBRARY)
LDCONFIG = /sbin/ldconfig
ifneq (,$(findstring X$(OSARCH)X, XLinuxX XGNU/kFreeBSDX XGNUX))
LDCONFIG_FLAGS=-n
else
ifeq (${OSARCH},FreeBSD)
LDCONFIG_FLAGS=-m
CFLAGS += -I../zaptel -I../zapata
INSTALL_BASE=/usr/local
endif
endif
ifeq (${OSARCH},SunOS)
CFLAGS += -DSOLARIS -I../zaptel-solaris
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
export PRIVERSION
PRIVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
#The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
#This works for even old (2.96) versions of gcc and provides a small boost either way.
#A ultrasparc cpu is really v9 but the stock debian stable 3.0 gcc doesnt support it.
ifeq ($(PROC),sparc64)
PROC=ultrasparc
LIBPRI_OPT = -mtune=$(PROC) -O3 -pipe -fomit-frame-pointer -mcpu=v8
else
LIBPRI_OPT = -O2
endif
ifeq ($(CPUARCH),i686)
CFLAGS += -m32
SOFLAGS += -m32
endif
all: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
update:
@echo "Updating from CVS"
@cvs update -d
@if [ -d .svn ]; then \
echo "Updating from Subversion..." ; \
fromrev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
svn update | tee update.out; \
torev="`svn info | $(AWK) '/Revision: / {print $$2}'`"; \
echo "`date` Updated from revision $${fromrev} to $${torev}." >> update.log; \
rm -f .version; \
if [ `grep -c ^C update.out` -gt 0 ]; then \
echo ; echo "The following files have conflicts:" ; \
grep ^C update.out | cut -b4- ; \
fi ; \
rm -f update.out; \
else \
echo "Not under version control"; \
fi
install: $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
mkdir -p $(INSTALL_PREFIX)/usr/lib
mkdir -p $(INSTALL_PREFIX)/usr/include
install -m 644 libpri.h $(INSTALL_PREFIX)/usr/include
install -m 755 $(DYNAMIC_LIBRARY) $(INSTALL_PREFIX)/usr/lib
( cd $(INSTALL_PREFIX)/usr/lib ; ln -sf libpri.so.1 libpri.so )
install -m 644 $(STATIC_LIBRARY) $(INSTALL_PREFIX)/usr/lib
/sbin/ldconfig
mkdir -p $(INSTALL_PREFIX)$(libdir)
mkdir -p $(INSTALL_PREFIX)$(INSTALL_BASE)/include
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)
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)
install -f $(INSTALL_PREFIX)$(libdir) -m 644 $(STATIC_LIBRARY)
endif
uninstall:
@echo "Removing Libpri"
rm -f $(INSTALL_PREFIX)/usr/lib/libpri.so.1.0
rm -f $(INSTALL_PREFIX)/usr/lib/libpri.so
rm -f $(INSTALL_PREFIX)/usr/lib/libpri.a
rm -f $(INSTALL_PREFIX)/usr/include/libpri.h
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so.$(SONAME)
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.so
rm -f $(INSTALL_PREFIX)$(libdir)/libpri.a
rm -f $(INSTALL_PREFIX)$(INSTALL_BASE)/include/libpri.h
pritest: pritest.o
$(CC) -o pritest pritest.o -L. -lpri -lzap
$(CC) -o pritest pritest.o -L. -lpri -lzap $(CFLAGS)
testprilib.o: testprilib.c
$(CC) $(CFLAGS) -D_REENTRANT -D_GNU_SOURCE -o $@ -c $<
testprilib: testprilib.o
$(CC) -o testprilib testprilib.o -L. -lpri -lpthread
$(CC) -o testprilib testprilib.o -L. -lpri -lpthread $(CFLAGS)
pridump: pridump.o
$(CC) -o pridump pridump.o -L. -lpri -lzap
$(CC) -o pridump pridump.o -L. -lpri $(CFLAGS)
include .depend
rosetest: rosetest.o
$(CC) -o rosetest rosetest.o -L. -lpri $(CFLAGS)
%.lo : %.c
$(CC) -fPIC $(CFLAGS) -o $@ -c $<
MAKE_DEPS= -MD -MT $@ -MF .$(subst /,_,$@).d -MP
%.o: %.c
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
%.lo: %.c
$(CC) $(CFLAGS) $(MAKE_DEPS) -c -o $@ $<
$(STATIC_LIBRARY): $(STATIC_OBJS)
ar rcs $(STATIC_LIBRARY) $(STATIC_OBJS)
ranlib $(STATIC_LIBRARY)
$(DYNAMIC_LIBRARY): $(DYNAMIC_OBJS)
$(CC) -shared -Wl,-soname,libpri.so.1 -o $@ $(DYNAMIC_OBJS)
/sbin/ldconfig -n .
ln -sf libpri.so.1 libpri.so
$(CC) -shared $(SOFLAGS) -o $@ $(DYNAMIC_OBJS)
$(LDCONFIG) $(LDCONFIG_FLAGS) .
ln -sf libpri.so.$(SONAME) libpri.so
version.c: FORCE
@build_tools/make_version_c > $@.tmp
@cmp -s $@.tmp $@ || mv $@.tmp $@
@rm -f $@.tmp
clean:
rm -f *.o *.so *.lo *.so.1 *.so.1.0
rm -f testpri testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
rm -f *.o *.so *.lo *.so.$(SONAME)
rm -f testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
rm -f pritest pridump
rm -f .depend
rm -f .*.d
depend: .depend
.PHONY:
.depend:
./mkdep ${CFLAGS} `ls *.c`
FORCE:
ifneq ($(wildcard .*.d),)
include .*.d
endif

30
README Executable file → Normal file
View File

@@ -1,31 +1,45 @@
libpri: An implementation of Primate Rate ISDN
libpri: An implementation of Primary Rate ISDN
Written by Mark Spencer <markster@linux-support.net>
Written by Mark Spencer <markster@digium.com>
What is libpri?
===============
libpri is a C implementation of the Primary Rate ISDN specification. It was
based on the Bellcore specification SR-NWT-002343 for National ISDN. As of
May 12, 2001, it has been tested work with NI-2, Nortel DMS-100, and Lucent 5E Custom protocols on switches from Nortel and Lucent.
May 12, 2001, it has been tested work with NI-2, Nortel DMS-100, and
Lucent 5E Custom protocols on switches from Nortel and Lucent.
What is the license for libpri?
===============================
libpri is distributed under the terms of the GNU General Public License, which permit its use and linking with other GPL'd software only.
libpri is distributed under the terms of the GNU General Public License,
which permit its use and linking with other GPL'd software only.
The GNU GPL is included in the file LICENSE in this directory.
As a special exception, libpri may also be linked to the OpenH323
library, so long as the entirity of the derivative work (as defined
within the GPL) is licensed either under the MPL of the OpenH323 license
or the GPL of libpri.
If you wish to use libpri in an application for which the GPL is not
appropriate (e.g. a proprietary embedded system), licenses for libpri
under more flexible terms can be readily obtained through Digium, Inc.
at reasonable cost.
If you wish to use libpri in an application for which the GPL is not appropriate (e.g. a proprietary embedded system), licenses for libpri under more flexible terms can be readily obtained through Linux Support Services, Inc. at reasonable cost.
How do I report bugs or contribute?
===================================
For now, contact the author directly. In the future if there is sufficient interest, we will setup a mailing list.
For now, contact the author directly. In the future if there is
sufficient interest, we will setup a mailing list.
Does anything use this library so far?
======================================
Yes, the Asterisk Open Source PBX does. http://www.asteriskpbx.com
Yes, the Asterisk Open Source PBX does. http://www.asterisk.org
Also, the Zapata library has hooks for it. http://www.zapatatelephony.org
Special thanks
==============
Special thanks to Jim Dixon <jim@lambdatel.com> for his help in testing and fixing the implementation.
Special thanks to Jim Dixon <jim@lambdatel.com> for his help in
testing and fixing the implementation.

4
TODO Executable file → Normal file
View File

@@ -1,10 +1,8 @@
General:
-- D-Channel Backup
-- Test against 4e
Q.921:
-- Support unnumbered information frames
-- Get TEI codes working for BRI interfaces
Q.931:
-- Locking Shift IE
-- Implement the 11 missing Q.931 timers

257
asn1.h Normal file
View File

@@ -0,0 +1,257 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief ASN.1 definitions and prototypes
*
* \details
* This file contains all ASN.1 primitive data structures and
* definitions needed for ROSE component encoding and decoding.
*
* ROSE - Remote Operations Service Element
* ASN.1 - Abstract Syntax Notation 1
* APDU - Application Protocol Data Unit
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#ifndef _LIBPRI_ASN1_H
#define _LIBPRI_ASN1_H
#include <string.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------------------------------------------------- */
/*! ASN.1 Identifier Octet - Tag class bits */
#define ASN1_CLASS_MASK 0xc0
#define ASN1_CLASS_UNIVERSAL 0x00 /*!< Universal primitive data types */
#define ASN1_CLASS_APPLICATION 0x40 /*!< Application wide data tag */
#define ASN1_CLASS_CONTEXT_SPECIFIC 0x80 /*!< Context specifc data tag */
#define ASN1_CLASS_PRIVATE 0xc0 /*!< Private organization data tag */
/*! ASN.1 Identifier Octet - Primitive/Constructor bit */
#define ASN1_PC_MASK 0x20
#define ASN1_PC_PRIMITIVE 0x00
#define ASN1_PC_CONSTRUCTED 0x20
/*! ASN.1 Identifier Octet - Universal data types */
#define ASN1_TYPE_MASK 0x1f
#define ASN1_TYPE_INDEF_TERM 0x00 /* 0 */
#define ASN1_TYPE_BOOLEAN 0x01 /* 1 */
#define ASN1_TYPE_INTEGER 0x02 /* 2 */
#define ASN1_TYPE_BIT_STRING 0x03 /* 3 */
#define ASN1_TYPE_OCTET_STRING 0x04 /* 4 */
#define ASN1_TYPE_NULL 0x05 /* 5 */
#define ASN1_TYPE_OBJECT_IDENTIFIER 0x06 /* 6 */
#define ASN1_TYPE_OBJECT_DESCRIPTOR 0x07 /* 7 */
#define ASN1_TYPE_EXTERN 0x08 /* 8 */
#define ASN1_TYPE_REAL 0x09 /* 9 */
#define ASN1_TYPE_ENUMERATED 0x0a /* 10 */
#define ASN1_TYPE_EMBEDDED_PDV 0x0b /* 11 */
#define ASN1_TYPE_UTF8_STRING 0x0c /* 12 */
#define ASN1_TYPE_RELATIVE_OID 0x0d /* 13 */
/* 0x0e & 0x0f are reserved for future ASN.1 editions */
#define ASN1_TYPE_SEQUENCE 0x10 /* 16 */
#define ASN1_TYPE_SET 0x11 /* 17 */
#define ASN1_TYPE_NUMERIC_STRING 0x12 /* 18 */
#define ASN1_TYPE_PRINTABLE_STRING 0x13 /* 19 */
#define ASN1_TYPE_TELETEX_STRING 0x14 /* 20 */
#define ASN1_TYPE_VIDEOTEX_STRING 0x15 /* 21 */
#define ASN1_TYPE_IA5_STRING 0x16 /* 22 */
#define ASN1_TYPE_UTC_TIME 0x17 /* 23 */
#define ASN1_TYPE_GENERALIZED_TIME 0x18 /* 24 */
#define ASN1_TYPE_GRAPHIC_STRING 0x19 /* 25 */
#define ASN1_TYPE_VISIBLE_STRING 0x1a /* 26 */
#define ASN1_TYPE_ISO646_STRING 0x1a /* 26 */
#define ASN1_TYPE_GENERAL_STRING 0x1b /* 27 */
#define ASN1_TYPE_UNIVERSAL_STRING 0x1c /* 28 */
#define ASN1_TYPE_CHAR_STRING 0x1d /* 29 */
#define ASN1_TYPE_BMP_STRING 0x1e /* 30 */
#define ASN1_TYPE_EXTENSION 0x1f /* 31 */
#define ASN1_TAG_SEQUENCE (ASN1_CLASS_UNIVERSAL | ASN1_PC_CONSTRUCTED | ASN1_TYPE_SEQUENCE)
#define ASN1_TAG_SET (ASN1_CLASS_UNIVERSAL | ASN1_PC_CONSTRUCTED | ASN1_TYPE_SET)
#define ASN1_INDEF_TERM (ASN1_CLASS_UNIVERSAL | ASN1_PC_PRIMITIVE | ASN1_TYPE_INDEF_TERM)
#define ASN1_INDEF_TERM_LEN 2
struct asn1_oid {
/*! \brief Number of subidentifier values in OID list */
u_int16_t num_values;
/*!
* \brief OID subidentifier value list
* \note The first value is really the first two OID subidentifiers.
* They are compressed using this formula:
* First_Value = (First_Subidentifier * 40) + Second_Subidentifier
*/
u_int16_t value[10];
};
#define ASN1_CALL(new_pos, do_it) \
do \
{ \
(new_pos) = (do_it); \
if (!(new_pos)) { \
return NULL; \
} \
} while (0)
/*! \brief Determine the ending position of the set or sequence to verify the length. */
#define ASN1_END_SETUP(component_end, offset, length, pos, end) \
do { \
if ((length) < 0) { \
(offset) = ASN1_INDEF_TERM_LEN; \
(component_end) = (end); \
} else { \
(offset) = 0; \
(component_end) = (pos) + (length); \
} \
} while (0)
/*! \brief Account for the indefinite length terminator of the set or sequence. */
#define ASN1_END_FIXUP(ctrl, pos, offset, component_end, end) \
do { \
if (offset) { \
ASN1_CALL((pos), asn1_dec_indef_end_fixup((ctrl), (pos), (end))); \
} else if ((pos) != (component_end)) { \
if ((ctrl)->debug & PRI_DEBUG_APDU) { \
pri_message((ctrl), \
" Skipping unused constructed component octets!\n"); \
} \
(pos) = (component_end); \
} \
} while (0)
#define ASN1_DID_NOT_EXPECT_TAG(ctrl, tag) \
do { \
if ((ctrl)->debug & PRI_DEBUG_APDU) { \
pri_message((ctrl), " Did not expect: %s\n", asn1_tag2str(tag)); \
} \
} while (0)
#define ASN1_CHECK_TAG(ctrl, actual_tag, match_tag, expected_tag) \
do { \
if ((match_tag) != (expected_tag)) { \
ASN1_DID_NOT_EXPECT_TAG((ctrl), (actual_tag)); \
return NULL; \
} \
} while (0)
const unsigned char *asn1_dec_tag(const unsigned char *tag_pos, const unsigned char *end,
unsigned *tag);
const unsigned char *asn1_dec_length(const unsigned char *len_pos,
const unsigned char *end, int *length);
const unsigned char *asn1_dec_indef_end_fixup(struct pri *ctrl, const unsigned char *pos,
const unsigned char *end);
const unsigned char *asn1_dec_boolean(struct pri *ctrl, const char *name, unsigned tag,
const unsigned char *pos, const unsigned char *end, int32_t *value);
const unsigned char *asn1_dec_int(struct pri *ctrl, const char *name, unsigned tag,
const unsigned char *pos, const unsigned char *end, int32_t *value);
const unsigned char *asn1_dec_null(struct pri *ctrl, const char *name, unsigned tag,
const unsigned char *pos, const unsigned char *end);
const unsigned char *asn1_dec_oid(struct pri *ctrl, const char *name, unsigned tag,
const unsigned char *pos, const unsigned char *end, struct asn1_oid *oid);
const unsigned char *asn1_dec_string_bin(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end, size_t buf_size,
unsigned char *str, size_t *str_len);
const unsigned char *asn1_dec_string_max(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end, size_t buf_size,
unsigned char *str, size_t *str_len);
const char *asn1_tag2str(unsigned tag);
void asn1_dump(struct pri *ctrl, const unsigned char *start_asn1,
const unsigned char *end);
#define ASN1_LEN_FORM_SHORT 1 /*!< Hint that the final length will be less than 128 octets */
#define ASN1_LEN_FORM_LONG_U8 2 /*!< Hint that the final length will be less than 256 octets */
#define ASN1_LEN_FORM_LONG_U16 3 /*!< Hint that the final length will be less than 65536 octets */
#define ASN1_LEN_INIT(len_pos, end, form_hint) \
do { \
if ((end) < (len_pos) + (form_hint)) { \
return NULL; \
} \
*(len_pos) = (form_hint); \
(len_pos) += (form_hint); \
} while (0)
#define ASN1_LEN_FIXUP(len_pos, component_end, end) \
ASN1_CALL((component_end), asn1_enc_length_fixup((len_pos), (component_end), (end)))
/*! \brief Use to begin encoding explicit tags, SET, and SEQUENCE constructed groupings. */
#define ASN1_CONSTRUCTED_BEGIN(len_pos_save, pos, end, tag) \
do { \
if ((end) < (pos) + (1 + ASN1_LEN_FORM_SHORT)) { \
return NULL; \
} \
*(pos)++ = (tag) | ASN1_PC_CONSTRUCTED; \
(len_pos_save) = (pos); \
*(pos) = ASN1_LEN_FORM_SHORT; \
(pos) += ASN1_LEN_FORM_SHORT; \
} while (0)
/*! \brief Use to end encoding explicit tags, SET, and SEQUENCE constructed groupings. */
#define ASN1_CONSTRUCTED_END(len_pos, component_end, end) \
ASN1_CALL((component_end), asn1_enc_length_fixup((len_pos), (component_end), (end)))
#define ASN1_ENC_ERROR(ctrl, msg) \
pri_error((ctrl), "%s error: %s\n", __FUNCTION__, (msg))
unsigned char *asn1_enc_length(unsigned char *len_pos, unsigned char *end,
size_t str_len);
unsigned char *asn1_enc_length_fixup(unsigned char *len_pos,
unsigned char *component_end, unsigned char *end);
unsigned char *asn1_enc_boolean(unsigned char *pos, unsigned char *end, unsigned tag,
int32_t value);
unsigned char *asn1_enc_int(unsigned char *pos, unsigned char *end, unsigned tag,
int32_t value);
unsigned char *asn1_enc_null(unsigned char *pos, unsigned char *end, unsigned tag);
unsigned char *asn1_enc_oid(unsigned char *pos, unsigned char *end, unsigned tag,
const struct asn1_oid *oid);
unsigned char *asn1_enc_string_bin(unsigned char *pos, unsigned char *end, unsigned tag,
const unsigned char *str, size_t str_len);
unsigned char *asn1_enc_string_max(unsigned char *pos, unsigned char *end, unsigned tag,
const unsigned char *str, size_t max_len);
/* ------------------------------------------------------------------- */
#ifdef __cplusplus
}
#endif
#endif /* _LIBPRI_ASN1_H */
/* ------------------------------------------------------------------- */
/* end asn1.h */

1306
asn1_primitive.c Normal file

File diff suppressed because it is too large Load Diff

79
build_tools/make_version Executable file
View File

@@ -0,0 +1,79 @@
#!/bin/sh
if [ -f ${1}/.version ]; then
cat ${1}/.version
elif [ -d .svn ]; then
PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/libpri/::' | sed -e 's:/: :g'`
BRANCH=0
TEAM=0
TAG=0
REV=`svnversion -c ${1} | cut -d: -f2`
INTEGRATED=`LANG=C svn pg automerge-propname ${1}`
if [ -z "${INTEGRATED}" ] ; then
INTEGRATED=svnmerge-integrated
fi
BASE=`LANG=C svn pg ${INTEGRATED} ${1} | cut -d: -f1`
if [ "${PARTS}" = "trunk" ] ; then
echo SVN-trunk-r${REV}
exit 0
fi
for PART in $PARTS ; do
if [ ${TAG} != 0 ] ; then
if [ "${PART}" = "autotag_for_be" ] ; then
continue
fi
if [ "${PART}" = "autotag_for_sx00i" ] ; then
continue
fi
RESULT="${PART}"
break
fi
if [ ${BRANCH} != 0 ] ; then
if [ -z "${RESULT}" ] ; then
RESULT="${PART}"
else
RESULT="${RESULT}-${PART}"
fi
break
fi
if [ ${TEAM} != 0 ] ; then
if [ -z "${RESULT}" ] ; then
RESULT="${PART}"
else
RESULT="${RESULT}-${PART}"
fi
continue
fi
if [ "${PART}" = "branches" ] ; then
BRANCH=1
RESULT="branch"
continue
fi
if [ "${PART}" = "tags" ] ; then
TAG=1
continue
fi
if [ "${PART}" = "team" ] ; then
TEAM=1
continue
fi
done
if [ ${TAG} != 0 ] ; then
echo ${RESULT}
else
echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}
fi
else
echo "UNKNOWN__and_probably_unsupported"
fi

24
build_tools/make_version_c Executable file
View File

@@ -0,0 +1,24 @@
#!/bin/sh
if [ ! -f ../.flavor ]; then
EXTRA=""
else
aadkver=`cat ../.version`
aadkflavor=`cat ../.flavor`
EXTRA=" (${aadkflavor} ${aadkver})"
fi
cat << END
/*
* version.c
* Automatically generated
*/
#include "libpri.h"
static const char pri_version[] = "${PRIVERSION}${EXTRA}";
const char *pri_get_version(void)
{
return pri_version;
}
END

10
compat.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef __COMPAT_H
#define __COMPAT_H
#ifdef SOLARIS
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
#endif
#endif

36
compiler.h Normal file
View File

@@ -0,0 +1,36 @@
/*
* Asterisk -- A telephony toolkit for Linux.
*
* Compiler-specific macros and other items
*
* Copyright (C) 2005, Digium, Inc.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _ASTERISK_COMPILER_H
#define _ASTERISK_COMPILER_H
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 96)
#define __builtin_expect(exp, c) (exp)
#endif
#endif /* _ASTERISK_COMPILER_H */

47
copy_string.c Normal file
View File

@@ -0,0 +1,47 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include "compiler.h"
#include "libpri.h"
#include "pri_internal.h"
void libpri_copy_string(char *dst, const char *src, size_t size)
{
while (*src && size) {
*dst++ = *src++;
size--;
}
if (__builtin_expect(!size, 0))
dst--;
*dst = '\0';
}

1161
libpri.h Executable file → Normal file

File diff suppressed because it is too large Load Diff

113
mkdep
View File

@@ -1,113 +0,0 @@
#!/bin/sh -
#
# $OpenBSD: mkdep.gcc.sh,v 1.8 1998/09/02 06:40:07 deraadt Exp $
# $NetBSD: mkdep.gcc.sh,v 1.9 1994/12/23 07:34:59 jtc Exp $
#
# Copyright (c) 1991, 1993
# The Regents of the University of California. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by the University of
# California, Berkeley and its contributors.
# 4. Neither the name of the University nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# @(#)mkdep.gcc.sh 8.1 (Berkeley) 6/6/93
#
D=.depend # default dependency file is .depend
append=0
pflag=
while :
do case "$1" in
# -a appends to the depend file
-a)
append=1
shift ;;
# -f allows you to select a makefile name
-f)
D=$2
shift; shift ;;
# the -p flag produces "program: program.c" style dependencies
# so .o's don't get produced
-p)
pflag=p
shift ;;
*)
break ;;
esac
done
if [ $# = 0 ] ; then
echo 'usage: mkdep [-p] [-f depend_file] [cc_flags] file ...'
exit 1
fi
DTMP=/tmp/mkdep$$
TMP=$DTMP/mkdep
um=`umask`
umask 022
if ! mkdir $DTMP ; then
echo failed to create tmp dir $DTMP
exit 1
fi
umask $um
trap 'rm -rf $DTMP ; trap 2 ; kill -2 $$' 1 2 3 13 15
if [ x$pflag = x ]; then
${CC:-cc} -M "$@" | sed -e 's; \./; ;g' > $TMP
else
${CC:-cc} -M "$@" | sed -e 's;\.o :; :;' -e 's; \./; ;g' > $TMP
fi
if [ $? != 0 ]; then
echo 'mkdep: compile failed.'
rm -rf $DTMP
exit 1
fi
if [ $append = 1 ]; then
cat $TMP >> $D
if [ $? != 0 ]; then
echo 'mkdep: append failed.'
rm -rf $DTMP
exit 1
fi
else
mv $TMP $D
if [ $? != 0 ]; then
echo 'mkdep: rename failed.'
rm -rf $DTMP
exit 1
fi
fi
rm -rf $DTMP
exit 0

1417
pri.c Executable file → Normal file

File diff suppressed because it is too large Load Diff

4146
pri_facility.c Normal file

File diff suppressed because it is too large Load Diff

212
pri_facility.h Normal file
View File

@@ -0,0 +1,212 @@
/*
This file contains all data structures and definitions associated
with facility message usage and the ROSE components included
within those messages.
by Matthew Fredrickson <creslin@digium.com>
Copyright (C) Digium, Inc. 2004-2005
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_FACILITY_H
#define _PRI_FACILITY_H
#include "pri_q931.h"
/* Forward declare some structs */
struct fac_extension_header;
struct rose_msg_invoke;
struct rose_msg_result;
struct rose_msg_error;
struct rose_msg_reject;
/* Protocol Profile field */
#define Q932_PROTOCOL_MASK 0x1F
#define Q932_PROTOCOL_ROSE 0x11 /* X.219 & X.229 */
#define Q932_PROTOCOL_CMIP 0x12 /* Q.941 */
#define Q932_PROTOCOL_ACSE 0x13 /* X.217 & X.227 */
#define Q932_PROTOCOL_GAT 0x16
#define Q932_PROTOCOL_EXTENSIONS 0x1F
/* Q.952 Divert cause */
#define Q952_DIVERT_REASON_UNKNOWN 0x00
#define Q952_DIVERT_REASON_CFU 0x01
#define Q952_DIVERT_REASON_CFB 0x02
#define Q952_DIVERT_REASON_CFNR 0x03
#define Q952_DIVERT_REASON_CD 0x04
#define Q952_DIVERT_REASON_IMMEDIATE 0x05
/* Q.SIG Divert cause. Listed in ECMA-174 */
#define QSIG_DIVERT_REASON_UNKNOWN 0x00 /* Call forward unknown reason */
#define QSIG_DIVERT_REASON_CFU 0x01 /* Call Forward Unconditional (other reason) */
#define QSIG_DIVERT_REASON_CFB 0x02 /* Call Forward Busy */
#define QSIG_DIVERT_REASON_CFNR 0x03 /* Call Forward No Reply */
/* Q.932 Type of number */
#define Q932_TON_UNKNOWN 0x00
#define Q932_TON_INTERNATIONAL 0x01
#define Q932_TON_NATIONAL 0x02
#define Q932_TON_NET_SPECIFIC 0x03
#define Q932_TON_SUBSCRIBER 0x04
#define Q932_TON_ABBREVIATED 0x06
/* Q.SIG Subscription Option. Listed in ECMA-174 */
#define QSIG_NO_NOTIFICATION 0x00
#define QSIG_NOTIFICATION_WITHOUT_DIVERTED_TO_NR 0x01
#define QSIG_NOTIFICATION_WITH_DIVERTED_TO_NR 0x02
/*! Reasons an APDU callback is called. */
enum APDU_CALLBACK_REASON {
/*!
* \brief Send setup error. Abort and cleanup.
* \note The message may or may not actually get sent.
* \note The callback cannot generate an event subcmd.
* \note The callback should not send messages. Out of order messages will result.
*/
APDU_CALLBACK_REASON_ERROR,
/*!
* \brief Abort and cleanup.
* \note The APDU queue is being destroyed.
* \note The callback cannot generate an event subcmd.
* \note The callback cannot send messages as the call is likely being destroyed.
*/
APDU_CALLBACK_REASON_CLEANUP,
/*!
* \brief Timeout waiting for responses to the message.
* \note The callback can generate an event subcmd.
* \note The callback can send messages.
*/
APDU_CALLBACK_REASON_TIMEOUT,
/*!
* \brief Received a facility response message.
* \note The callback can generate an event subcmd.
* \note The callback can send messages.
*/
APDU_CALLBACK_REASON_MSG_RESULT,
/*!
* \brief Received a facility error message.
* \note The callback can generate an event subcmd.
* \note The callback can send messages.
*/
APDU_CALLBACK_REASON_MSG_ERROR,
/*!
* \brief Received a facility reject message.
* \note The callback can generate an event subcmd.
* \note The callback can send messages.
*/
APDU_CALLBACK_REASON_MSG_REJECT,
};
union apdu_msg_data {
const struct rose_msg_result *result;
const struct rose_msg_error *error;
const struct rose_msg_reject *reject;
};
union apdu_callback_param {
void *ptr;
long value;
char pad[8];
};
struct apdu_callback_data {
/*! APDU invoke id to match with any response messages. (Result/Error/Reject) */
int invoke_id;
/*!
* \brief Time to wait for responses to APDU in ms.
* \note Set to 0 if send the message only.
* \note Set to less than 0 for PRI_TIMER_T_RESPONSE time.
*/
int timeout_time;
/*!
* \brief APDU callback function.
*
* \param reason Reason callback is called.
* \param ctrl D channel controller.
* \param call Q.931 call leg.
* \param apdu APDU queued entry. Do not change!
* \param msg APDU response message data. (NULL if was not the reason called.)
*
* \note
* A callback must be supplied if the sender cares about any APDU_CALLBACK_REASON.
*
* \return TRUE if no more responses are expected.
*/
int (*callback)(enum APDU_CALLBACK_REASON reason, struct pri *ctrl, struct q931_call *call, struct apdu_event *apdu, const union apdu_msg_data *msg);
/*! \brief Sender data for the callback function to identify the particular APDU. */
union apdu_callback_param user;
};
struct apdu_event {
/*! Linked list pointer */
struct apdu_event *next;
/*! TRUE if this APDU has been sent. */
int sent;
/*! What message to send the ADPU in */
int message;
/*! Sender supplied information to handle APDU response messages. */
struct apdu_callback_data response;
/*! Q.931 call leg. (Needed for the APDU timeout.) */
struct q931_call *call;
/*! Response timeout timer. */
int timer;
/*! Length of ADPU */
int apdu_len;
/*! ADPU to send */
unsigned char apdu[255];
};
/* Queues an MWI apdu on a the given call */
int mwi_message_send(struct pri *pri, q931_call *call, struct pri_sr *req, int activate);
/* starts a 2BCT */
int eect_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
int rlt_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
int qsig_cf_callrerouting(struct pri *pri, q931_call *c, const char* dest, const char* original, const char* reason);
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);
/* starts a QSIG Path Replacement */
int anfpr_initiate_transfer(struct pri *pri, q931_call *c1, q931_call *c2);
int send_call_transfer_complete(struct pri *pri, q931_call *call, int call_status);
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);
int rose_connected_name_encode(struct pri *pri, q931_call *call, int messagetype);
int rose_called_name_encode(struct pri *pri, q931_call *call, int messagetype);
int pri_call_apdu_queue(q931_call *call, int messagetype, const unsigned char *apdu, int apdu_len, struct apdu_callback_data *response);
void pri_call_apdu_queue_cleanup(q931_call *call);
void pri_call_apdu_delete(struct q931_call *call, struct apdu_event *doomed);
/* Adds the "standard" APDUs to a call */
int pri_call_add_standard_apdus(struct pri *pri, q931_call *call);
void asn1_dump(struct pri *ctrl, const unsigned char *start_asn1, const unsigned char *end);
void rose_handle_invoke(struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, const struct fac_extension_header *header, const struct rose_msg_invoke *invoke);
void rose_handle_result(struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, const struct fac_extension_header *header, const struct rose_msg_result *result);
void rose_handle_error(struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, const struct fac_extension_header *header, const struct rose_msg_error *error);
void rose_handle_reject(struct pri *ctrl, q931_call *call, int msgtype, q931_ie *ie, const struct fac_extension_header *header, const struct rose_msg_reject *reject);
#endif /* _PRI_FACILITY_H */

698
pri_internal.h Executable file → Normal file
View File

@@ -1,31 +1,47 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_INTERNAL_H
#define _PRI_INTERNAL_H
#include <stddef.h>
#include <sys/time.h>
#include "pri_q921.h"
#include "pri_q931.h"
#define ARRAY_LEN(arr) (sizeof(arr) / sizeof((arr)[0]))
#define DBGHEAD __FILE__ ":%d %s: "
#define DBGINFO __LINE__,__PRETTY_FUNCTION__
/* Forward declare some structs */
struct apdu_event;
struct pri_sched {
struct timeval when;
@@ -33,56 +49,102 @@ struct pri_sched {
void *data;
};
struct q921_frame;
enum q931_state;
enum q931_mode;
/* No more than 128 scheduled events */
/*! Maximum number of scheduled events active at the same time. */
#define MAX_SCHED 128
/*! Maximum number of facility ie's to handle per incoming message. */
#define MAX_FACILITY_IES 8
/*! Accumulated pri_message() line until a '\n' is seen on the end. */
struct pri_msg_line {
/*! Accumulated buffer used. */
unsigned length;
/*! Accumulated pri_message() contents. */
char str[2048];
};
/*! \brief D channel controller structure */
struct pri {
int fd; /* File descriptor for D-Channel */
pri_io_cb read_func; /* Read data callback */
pri_io_cb write_func; /* Write data callback */
void *userdata;
/*! Accumulated pri_message() line. (Valid in master record only) */
struct pri_msg_line *msg_line;
struct pri *subchannel; /* Sub-channel if appropriate */
struct pri *master; /* Master channel if appropriate */
struct pri_sched pri_sched[MAX_SCHED]; /* Scheduled events */
int debug; /* Debug stuff */
int state; /* State of D-channel */
int switchtype; /* Switch type */
int nsf; /* Network-Specific Facility (if any) */
int localtype; /* Local network type (unknown, network, cpe) */
int remotetype; /* Remote network type (unknown, network, cpe) */
int sapi;
int tei;
int protodisc;
unsigned int bri:1;
unsigned int acceptinbanddisconnect:1; /* Should we allow inband progress after DISCONNECT? */
unsigned int sendfacility:1;
unsigned int overlapdial:1;/* TRUE if we do overlap dialing */
unsigned int chan_mapping_logical:1;/* TRUE if do not skip channel 16 (Q.SIG) */
unsigned int service_message_support:1;/* TRUE if upper layer supports SERVICE messages */
unsigned int hold_support:1;/* TRUE if upper layer supports call hold. */
unsigned int deflection_support:1;/* TRUE if upper layer supports call deflection/rerouting. */
unsigned int hangup_fix_enabled:1;/* TRUE if should follow Q.931 Section 5.3.2 instead of blindly sending RELEASE_COMPLETE for certain causes */
/* MDL variables */
int mdl_error;
int mdl_error_state;
int mdl_timer;
int mdl_free_me;
/* Q.921 State */
int q921_state;
int window; /* Max window size */
int windowlen; /* Fullness of window */
int RC;
int peer_rx_busy:1;
int own_rx_busy:1;
int acknowledge_pending:1;
int reject_exception:1;
int v_s; /* Next N(S) for transmission */
int v_a; /* Last acknowledged frame */
int v_r; /* Next frame expected to be received */
int v_na; /* What we've told our peer we've acknowledged */
int solicitfbit; /* Have we sent an I or S frame with the F-bit set? */
int retrans; /* Retransmissions */
int sentrej; /* Are we in reject state */
int cref; /* Next call reference value */
int busy; /* Peer is busy */
int l3initiated;
/* Various timers */
int sabme_timer; /* SABME retransmit */
int t203_timer; /* Max idle time */
int t202_timer;
int n202_counter;
int ri;
int t200_timer; /* T-200 retransmission timer */
/* All ISDN Timer values */
int timers[PRI_MAX_TIMERS];
/* Used by scheduler */
struct timeval tv;
int schedev;
pri_event ev; /* Static event thingy */
/*! Subcommands for static event thingy. */
struct pri_subcommands subcmds;
/* Q.921 Re-transmission queue */
struct q921_frame *txqueue;
/* Q.931 calls */
q931_call *calls;
q931_call **callpool;
q931_call *localpool;
/* do we do overlap dialing */
int overlapdial;
/*!
* \brief Q.931 Dummy call reference call associated with this TEI.
* \note If present then this call is allocated as part of the
* D channel control structure.
*/
q931_call *dummy_call;
#ifdef LIBPRI_COUNTERS
/* q921/q931 packet counters */
@@ -91,6 +153,393 @@ struct pri {
unsigned int q931_txcount;
unsigned int q931_rxcount;
#endif
short last_invoke; /* Last ROSE invoke ID (Valid in master record only) */
/*! For delayed processing of facility ie's. */
struct {
/*! Array of facility ie locations in the current received message. */
q931_ie *ie[MAX_FACILITY_IES];
/*! Codeset facility ie found within. */
unsigned char codeset[MAX_FACILITY_IES];
/*! Number of facility ie's in the array from the current received message. */
unsigned char count;
} facility;
};
/*! \brief Maximum name length plus null terminator (From ECMA-164) */
#define PRI_MAX_NAME_LEN (50 + 1)
/*! \brief Q.SIG name information. */
struct q931_party_name {
/*! \brief TRUE if name data is valid */
unsigned char valid;
/*!
* \brief Q.931 presentation-indicator encoded field
* \note Must tollerate the Q.931 screening-indicator field values being present.
*/
unsigned char presentation;
/*!
* \brief Character set the name 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;
/*! \brief Name data with null terminator. */
char str[PRI_MAX_NAME_LEN];
};
/*! \brief Maximum phone number (address) length plus null terminator */
#define PRI_MAX_NUMBER_LEN (31 + 1)
struct q931_party_number {
/*! \brief TRUE if number data is valid */
unsigned char valid;
/*! \brief Q.931 presentation-indicator and screening-indicator encoded fields */
unsigned char presentation;
/*! \brief Q.931 Type-Of-Number and numbering-plan encoded fields */
unsigned char plan;
/*! \brief Number data with terminator. */
char str[PRI_MAX_NUMBER_LEN];
};
/*! \brief Maximum subaddress length plus null terminator */
#define PRI_MAX_SUBADDRESS_LEN (20 + 1)
struct q931_party_subaddress {
/*! \brief TRUE if the subaddress information is valid/present */
unsigned char valid;
/*!
* \brief Subaddress type.
* \details
* nsap(0),
* user_specified(2)
*/
unsigned char type;
/*!
* \brief TRUE if odd number of address signals
* \note The odd/even indicator is used when the type of subaddress is
* user_specified and the coding is BCD.
*/
unsigned char odd_even_indicator;
/*! \brief Length of the subaddress data */
unsigned char length;
/*!
* \brief Subaddress data with null terminator.
* \note The null terminator is a convenience only since the data could be
* BCD/binary and thus have a null byte as part of the contents.
*/
unsigned char data[PRI_MAX_SUBADDRESS_LEN];
};
struct q931_party_address {
/*! \brief Subscriber phone number */
struct q931_party_number number;
/*! \brief Subscriber subaddress */
struct q931_party_subaddress subaddress;
};
/*! \brief Information needed to identify an endpoint in a call. */
struct q931_party_id {
/*! \brief Subscriber name */
struct q931_party_name name;
/*! \brief Subscriber phone number */
struct q931_party_number number;
/*! \brief Subscriber subaddress */
struct q931_party_subaddress subaddress;
};
enum Q931_REDIRECTING_STATE {
/*!
* \details
* CDO-Idle/CDF-Inv-Idle
*/
Q931_REDIRECTING_STATE_IDLE,
/*!
* \details
* CDF-Inv-Wait - A DivLeg2 has been received and
* we are waiting for valid presentation restriction information to send.
*/
Q931_REDIRECTING_STATE_PENDING_TX_DIV_LEG_3,
/*!
* \details
* CDO-Divert - A DivLeg1 has been received and
* we are waiting for the presentation restriction information to come in.
*/
Q931_REDIRECTING_STATE_EXPECTING_RX_DIV_LEG_3,
};
/*!
* \brief Do not increment above this count.
* \details
* It is not our responsibility to enforce the maximum number of redirects.
* However, we cannot allow an increment past this number without breaking things.
* Besides, more than 255 redirects is probably not a good thing.
*/
#define PRI_MAX_REDIRECTS 0xFF
/*! \brief Redirecting information struct */
struct q931_party_redirecting {
enum Q931_REDIRECTING_STATE state;
/*! \brief Who is redirecting the call (Sent to the party the call is redirected toward) */
struct q931_party_id from;
/*! \brief Call is redirecting to a new party (Sent to the caller) */
struct q931_party_id to;
/*! Originally called party (in cases of multiple redirects) */
struct q931_party_id orig_called;
/*!
* \brief Number of times the call was redirected
* \note The call is being redirected if the count is non-zero.
*/
unsigned char count;
/*! Original reason for redirect (in cases of multiple redirects) */
unsigned char orig_reason;
/*! \brief Redirection reasons */
unsigned char reason;
};
/*! \brief New call setup parameter structure */
struct pri_sr {
int transmode;
int channel;
int exclusive;
int nonisdn;
struct q931_party_redirecting redirecting;
struct q931_party_id caller;
struct q931_party_address called;
int userl1;
int numcomplete;
int cis_call;
int cis_auto_disconnect;
const char *useruserinfo;
const char *keypad_digits;
int transferable;
int reversecharge;
};
/* Internal switch types */
#define PRI_SWITCH_GR303_EOC_PATH 19
#define PRI_SWITCH_GR303_TMC_SWITCHING 20
#define Q931_MAX_TEI 8
/*! \brief Incoming call transfer states. */
enum INCOMING_CT_STATE {
/*!
* \details
* Incoming call transfer is not active.
*/
INCOMING_CT_STATE_IDLE,
/*!
* \details
* We have seen an incoming CallTransferComplete(alerting)
* so we are waiting for the expected CallTransferActive
* before updating the connected line about the remote party id.
*/
INCOMING_CT_STATE_EXPECT_CT_ACTIVE,
/*!
* \details
* A call transfer message came in that updated the remote party id
* that we need to post a connected line update.
*/
INCOMING_CT_STATE_POST_CONNECTED_LINE
};
/*! Call hold supplementary states. */
enum Q931_HOLD_STATE {
/*! \brief No call hold activity. */
Q931_HOLD_STATE_IDLE,
/*! \brief Request made to hold call. */
Q931_HOLD_STATE_HOLD_REQ,
/*! \brief Request received to hold call. */
Q931_HOLD_STATE_HOLD_IND,
/*! \brief Call is held. */
Q931_HOLD_STATE_CALL_HELD,
/*! \brief Request made to retrieve call. */
Q931_HOLD_STATE_RETRIEVE_REQ,
/*! \brief Request received to retrieve call. */
Q931_HOLD_STATE_RETRIEVE_IND,
};
/* q931_call datastructure */
struct q931_call {
struct pri *pri; /* PRI */
int cr; /* Call Reference */
q931_call *next;
/* Slotmap specified (bitmap of channels 31/24-1) (Channel Identifier IE) (-1 means not specified) */
int slotmap;
/* An explicit channel (Channel Identifier IE) (-1 means not specified) */
int channelno;
/* An explicit DS1 (-1 means not specified) */
int ds1no;
/* Whether or not the ds1 is explicitly identified or implicit. If implicit
the bchan is on the same span as the current active dchan (NFAS) */
int ds1explicit;
/* Channel flags (0 means none retrieved) */
int chanflags;
int alive; /* Whether or not the call is alive */
int acked; /* Whether setup has been acked or not */
int sendhangupack; /* Whether or not to send a hangup ack */
int proc; /* Whether we've sent a call proceeding / alerting */
int ri; /* Restart Indicator (Restart Indicator IE) */
/* Bearer Capability */
int transcapability;
int transmoderate;
int transmultiple;
int userl1;
int userl2;
int userl3;
int rateadaption;
/*!
* \brief TRUE if the call is a Call Independent Signalling connection.
* \note The call has no B channel associated with it. (Just signalling)
*/
int cis_call;
/*! \brief TRUE if we will auto disconnect the cis_call we originated. */
int cis_auto_disconnect;
int progcode; /* Progress coding */
int progloc; /* Progress Location */
int progress; /* Progress indicator */
int progressmask; /* Progress Indicator bitmask */
int notify; /* Notification indicator. */
int causecode; /* Cause Coding */
int causeloc; /* Cause Location */
int cause; /* Cause of clearing */
enum Q931_CALL_STATE peercallstate; /* Call state of peer as reported */
enum Q931_CALL_STATE ourcallstate; /* Our call state */
enum Q931_CALL_STATE sugcallstate; /* Status call state */
int ani2; /* ANI II */
/*! Buffer for digits that come in KEYPAD_FACILITY */
char keypad_digits[32 + 1];
/*! Current dialed digits to be sent or just received. */
char overlap_digits[PRI_MAX_NUMBER_LEN];
/*!
* \brief Local party ID
* \details
* The Caller-ID and connected-line ID are just roles the local and remote party
* play while a call is being established. Which roll depends upon the direction
* of the call.
* Outgoing party info is to identify the local party to the other end.
* (Caller-ID for originated or connected-line for answered calls.)
* Incoming party info is to identify the remote party to us.
* (Caller-ID for answered or connected-line for originated calls.)
*/
struct q931_party_id local_id;
/*!
* \brief Remote party ID
* \details
* The Caller-ID and connected-line ID are just roles the local and remote party
* play while a call is being established. Which roll depends upon the direction
* of the call.
* Outgoing party info is to identify the local party to the other end.
* (Caller-ID for originated or connected-line for answered calls.)
* Incoming party info is to identify the remote party to us.
* (Caller-ID for answered or connected-line for originated calls.)
*/
struct q931_party_id remote_id;
/*! \brief Automatic Number Identification (ANI) */
struct q931_party_number ani;
/*!
* \brief Staging place for the Q.931 redirection number ie.
* \note
* The number could be the remote_id.number or redirecting.to.number
* depending upon the notification indicator.
*/
struct q931_party_number redirection_number;
/*!
* \brief Called party address.
* \note The called.number.str is the accumulated overlap dial digits
* and enbloc digits.
* \note The called.number.presentation value is not used.
*/
struct q931_party_address called;
int nonisdn;
int complete; /* no more digits coming */
int newcall; /* if the received message has a new call reference value */
int retranstimer; /* Timer for retransmitting DISC */
int t308_timedout; /* Whether t308 timed out once */
struct q931_party_redirecting redirecting;
/*! \brief Incoming call transfer state. */
enum INCOMING_CT_STATE incoming_ct_state;
/*! Call hold supplementary state. */
enum Q931_HOLD_STATE hold_state;
/*! Call hold event timer */
int hold_timer;
int deflection_in_progress; /*!< CallDeflection for NT PTMP in progress. */
/*! TRUE if the connected number ie was in the current received message. */
int connected_number_in_message;
/*! TRUE if the redirecting number ie was in the current received message. */
int redirecting_number_in_message;
int useruserprotocoldisc;
char useruserinfo[256];
long aoc_units; /* Advice of Charge Units */
struct apdu_event *apdus; /* APDU queue for call */
int transferable; /* RLT call is transferable */
unsigned int rlt_call_id; /* RLT call id */
/* Bridged call info */
q931_call *bridged_call; /* Pointer to other leg of bridged call (Used by Q.SIG when eliminating tromboned calls) */
int changestatus; /* SERVICE message changestatus */
int reversecharge; /* Reverse charging indication:
-1 - No reverse charging
1 - Reverse charging
0,2-7 - Reserved for future use */
int t303_timer;
int t303_expirycnt;
int hangupinitiated;
/*! \brief TRUE if we broadcast this call's SETUP message. */
int outboundbroadcast;
int performing_fake_clearing;
/*!
* \brief Master call controlling this call.
* \note Always valid. Master and normal calls point to self.
*/
struct q931_call *master_call;
/* These valid in master call only */
struct q931_call *subcalls[Q931_MAX_TEI];
int pri_winner;
};
/*! D channel control structure with associated dummy call reference record. */
struct d_ctrl_dummy {
/*! D channel control structure. Must be first in the structure. */
struct pri ctrl;
/*! Dummy call reference call record. */
struct q931_call dummy_call;
};
extern int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data);
@@ -101,8 +550,187 @@ extern void pri_schedule_del(struct pri *pri, int ev);
extern pri_event *pri_mkerror(struct pri *pri, char *errstr);
extern void pri_message(char *fmt, ...);
void pri_message(struct pri *ctrl, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void pri_error(struct pri *ctrl, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
extern void pri_error(char *fmt, ...);
void libpri_copy_string(char *dst, const char *src, size_t size);
struct pri *__pri_new_tei(int fd, int node, int switchtype, struct pri *master, pri_io_cb rd, pri_io_cb wr, void *userdata, int tei, int bri);
void __pri_free_tei(struct pri *p);
void q931_init_call_record(struct pri *ctrl, struct q931_call *call, int cr);
void q931_party_name_init(struct q931_party_name *name);
void q931_party_number_init(struct q931_party_number *number);
void q931_party_subaddress_init(struct q931_party_subaddress *subaddr);
void q931_party_address_init(struct q931_party_address *address);
void q931_party_id_init(struct q931_party_id *id);
void q931_party_redirecting_init(struct q931_party_redirecting *redirecting);
static inline void q931_party_address_to_id(struct q931_party_id *id, struct q931_party_address *address)
{
id->number = address->number;
id->subaddress = address->subaddress;
}
int q931_party_name_cmp(const struct q931_party_name *left, const struct q931_party_name *right);
int q931_party_number_cmp(const struct q931_party_number *left, const struct q931_party_number *right);
int q931_party_subaddress_cmp(const struct q931_party_subaddress *left, const struct q931_party_subaddress *right);
int q931_party_id_cmp(const struct q931_party_id *left, const struct q931_party_id *right);
void q931_party_name_copy_to_pri(struct pri_party_name *pri_name, const struct q931_party_name *q931_name);
void q931_party_number_copy_to_pri(struct pri_party_number *pri_number, const struct q931_party_number *q931_number);
void q931_party_subaddress_copy_to_pri(struct pri_party_subaddress *pri_subaddress, const struct q931_party_subaddress *q931_subaddress);
void q931_party_id_copy_to_pri(struct pri_party_id *pri_id, const struct q931_party_id *q931_id);
void q931_party_redirecting_copy_to_pri(struct pri_party_redirecting *pri_redirecting, const struct q931_party_redirecting *q931_redirecting);
void pri_copy_party_name_to_q931(struct q931_party_name *q931_name, const struct pri_party_name *pri_name);
void pri_copy_party_number_to_q931(struct q931_party_number *q931_number, const struct pri_party_number *pri_number);
void pri_copy_party_subaddress_to_q931(struct q931_party_subaddress *q931_subaddress, const struct pri_party_subaddress *pri_subaddress);
void pri_copy_party_id_to_q931(struct q931_party_id *q931_id, const struct pri_party_id *pri_id);
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);
const char *q931_call_state_str(enum Q931_CALL_STATE callstate);
const char *msg2str(int msg);
int q931_master_pass_event(struct pri *ctrl, struct q931_call *subcall, int msg_type);
struct pri_subcommand *q931_alloc_subcommand(struct pri *ctrl);
int q931_notify_redirection(struct pri *ctrl, q931_call *call, int notify, const struct q931_party_number *number);
/*!
* \brief Get the master PRI control structure.
*
* \param ctrl D channel controller.
*
* \return Master PRI control structure.
*/
static inline struct pri *PRI_MASTER(struct pri *ctrl)
{
while (ctrl->master) {
ctrl = ctrl->master;
}
return ctrl;
}
/*!
* \brief Determine if layer 2 is in BRI NT PTMP mode.
*
* \param ctrl D channel controller.
*
* \retval TRUE if in BRI NT PTMP mode.
* \retval FALSE otherwise.
*/
static inline int BRI_NT_PTMP(const struct pri *ctrl)
{
struct pri *my_ctrl = (struct pri *) ctrl;
/* Check master control structure */
my_ctrl = PRI_MASTER(my_ctrl);
return my_ctrl->bri && my_ctrl->localtype == PRI_NETWORK
&& my_ctrl->tei == Q921_TEI_GROUP;
}
/*!
* \brief Determine if layer 2 is in BRI TE PTMP mode.
*
* \param ctrl D channel controller.
*
* \retval TRUE if in BRI TE PTMP mode.
* \retval FALSE otherwise.
*/
static inline int BRI_TE_PTMP(const struct pri *ctrl)
{
struct pri *my_ctrl = (struct pri *) ctrl;
/* Check master control structure */
my_ctrl = PRI_MASTER(my_ctrl);
return my_ctrl->bri && my_ctrl->localtype == PRI_CPE
&& my_ctrl->tei == Q921_TEI_GROUP;
}
/*!
* \brief Determine if layer 2 is in NT mode.
*
* \param ctrl D channel controller.
*
* \retval TRUE if in NT mode.
* \retval FALSE otherwise.
*/
static inline int NT_MODE(const struct pri *ctrl)
{
struct pri *my_ctrl = (struct pri *) ctrl;
/* Check master control structure */
my_ctrl = PRI_MASTER(my_ctrl);
return my_ctrl->localtype == PRI_NETWORK;
}
/*!
* \brief Determine if layer 2 is in TE mode.
*
* \param ctrl D channel controller.
*
* \retval TRUE if in TE mode.
* \retval FALSE otherwise.
*/
static inline int TE_MODE(const struct pri *ctrl)
{
struct pri *my_ctrl = (struct pri *) ctrl;
/* Check master control structure */
my_ctrl = PRI_MASTER(my_ctrl);
return my_ctrl->localtype == PRI_CPE;
}
/*!
* \brief Determine if layer 2 is in PTP mode.
*
* \param ctrl D channel controller.
*
* \retval TRUE if in PTP mode.
* \retval FALSE otherwise.
*/
static inline int PTP_MODE(const struct pri *ctrl)
{
struct pri *my_ctrl = (struct pri *) ctrl;
/* Check master control structure */
my_ctrl = PRI_MASTER(my_ctrl);
return my_ctrl->tei == Q921_TEI_PRI;
}
/*!
* \brief Determine if layer 2 is in PTMP mode.
*
* \param ctrl D channel controller.
*
* \retval TRUE if in PTMP mode.
* \retval FALSE otherwise.
*/
static inline int PTMP_MODE(const struct pri *ctrl)
{
struct pri *my_ctrl = (struct pri *) ctrl;
/* Check master control structure */
my_ctrl = PRI_MASTER(my_ctrl);
return my_ctrl->tei == Q921_TEI_GROUP;
}
#define Q931_DUMMY_CALL_REFERENCE -1
#define Q931_CALL_REFERENCE_FLAG 0x8000 /* Identify which end allocted the CR. */
/*!
* \brief Deterimine if the given call control pointer is a dummy call.
*
* \retval TRUE if given call is a dummy call.
* \retval FALSE otherwise.
*/
static inline int q931_is_dummy_call(const q931_call *call)
{
return (call->cr == Q931_DUMMY_CALL_REFERENCE) ? 1 : 0;
}
#endif

106
pri_q921.h Executable file → Normal file
View File

@@ -1,40 +1,49 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_Q921_H
#define _PRI_Q921_H
#include <sys/types.h>
#if defined(__linux__)
#include <endian.h>
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#define __BYTE_ORDER _BYTE_ORDER
#define __BIG_ENDIAN _BIG_ENDIAN
#define __LITTLE_ENDIAN _LITTLE_ENDIAN
#endif
/* Timer values */
#define T_WAIT_MIN 2000
#define T_WAIT_MAX 10000
#define T_200 1000 /* 1 second between SABME's */
#define T_203 10000 /* 10 seconds with no packets max */
#define N_200 3 /* 3 retries */
#define Q921_FRAMETYPE_MASK 0x3
@@ -42,14 +51,32 @@
#define Q921_FRAMETYPE_I 0x0
#define Q921_FRAMETYPE_S 0x1
#define Q921_TEI_GROUP 127
#define Q921_TEI_GROUP 127
#define Q921_TEI_PRI 0
#define Q921_TEI_GR303_EOC_PATH 0
#define Q921_TEI_GR303_EOC_OPS 4
#define Q921_TEI_GR303_TMC_SWITCHING 0
#define Q921_TEI_GR303_TMC_CALLPROC 0
#define Q921_SAPI_CALL_CTRL 0
#define Q921_SAPI_GR303_EOC 1
#define Q921_SAPI_GR303_TMC_SWITCHING 1
#define Q921_SAPI_GR303_TMC_CALLPROC 0
#define Q921_SAPI_CALL_CTRL 0
#define Q921_SAPI_PACKET_MODE 1
#define Q921_SAPI_X25_LAYER3 16
#define Q921_SAPI_LAYER2_MANAGEMENT 63
#define Q921_TEI_IDENTITY_REQUEST 1
#define Q921_TEI_IDENTITY_ASSIGNED 2
#define Q921_TEI_IDENTITY_DENIED 3
#define Q921_TEI_IDENTITY_CHECK_REQUEST 4
#define Q921_TEI_IDENTITY_CHECK_RESPONSE 5
#define Q921_TEI_IDENTITY_REMOVE 6
#define Q921_TEI_IDENTITY_VERIFY 7
typedef struct q921_header {
#if __BYTE_ORDER == __BIG_ENDIAN
u_int8_t sapi:6; /* Service Access Point Indentifier (always 0 for PRI) (0) */
@@ -65,7 +92,7 @@ typedef struct q921_header {
u_int8_t tei:7; /* Terminal Endpoint Identifier (0) */
#endif
u_int8_t data[0]; /* Further data */
} q921_header;
} __attribute__ ((packed)) q921_header;
/* A Supervisory Format frame */
typedef struct q921_s {
@@ -85,7 +112,7 @@ typedef struct q921_s {
#endif
u_int8_t data[0]; /* Any further data */
u_int8_t fcs[2]; /* At least an FCS */
} q921_s;
} __attribute__ ((packed)) q921_s;
/* An Unnumbered Format frame */
typedef struct q921_u {
@@ -103,7 +130,7 @@ typedef struct q921_u {
#endif
u_int8_t data[0]; /* Any further data */
u_int8_t fcs[2]; /* At least an FCS */
} q921_u;
} __attribute__ ((packed)) q921_u;
/* An Information frame */
typedef struct q921_i {
@@ -139,24 +166,41 @@ typedef struct q921_frame {
} q921_frame;
#define Q921_INC(j) (j) = (((j) + 1) % 128)
#define Q921_DEC(j) (j) = (((j) - 1) % 128)
typedef enum q921_state {
Q921_LINK_CONNECTION_RELEASED, /* Also known as TEI_ASSIGNED */
Q921_LINK_CONNECTION_ESTABLISHED,
Q921_AWAITING_ESTABLISH,
Q921_AWAITING_RELEASE
/* All states except Q921_DOWN are defined in Q.921 SDL diagrams */
Q921_TEI_UNASSIGNED = 1,
Q921_ASSIGN_AWAITING_TEI = 2,
Q921_ESTABLISH_AWAITING_TEI = 3,
Q921_TEI_ASSIGNED = 4,
Q921_AWAITING_ESTABLISHMENT = 5,
Q921_AWAITING_RELEASE = 6,
Q921_MULTI_FRAME_ESTABLISHED = 7,
Q921_TIMER_RECOVERY = 8,
} q921_state;
static inline int Q921_ADD(int a, int b)
{
return (a + b) % 128;
}
/* Dumps a *known good* Q.921 packet */
extern void q921_dump(q921_h *h, int len, int showraw, int txrx);
extern void q921_dump(struct pri *pri, q921_h *h, int len, int showraw, int txrx);
/* Bring up the D-channel */
extern void q921_start(struct pri *pri, int now);
extern void q921_start(struct pri *pri);
extern void q921_reset(struct pri *pri);
//extern void q921_reset(struct pri *pri, int reset_iqueue);
extern pri_event *q921_receive(struct pri *pri, q921_h *h, int len);
extern int q921_transmit_iframe(struct pri *pri, void *buf, int len, int cr);
extern int q921_transmit_iframe(struct pri *pri, int tei, void *buf, int len, int cr);
extern int q921_transmit_uiframe(struct pri *pri, void *buf, int len);
extern pri_event *q921_dchannel_up(struct pri *pri);
//extern pri_event *q921_dchannel_down(struct pri *pri);
#endif

434
pri_q931.h Executable file → Normal file
View File

@@ -1,68 +1,35 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#ifndef _PRI_Q931_H
#define _PRI_Q931_H
typedef enum q931_state {
/* User states */
U0_NULL_STATE,
U1_CALL_INITIATED,
U2_OVERLAP_SENDING,
U3_OUTGOING_CALL_PROCEEDING,
U4_CALL_DELIVERED,
U6_CALL_PRESENT,
U7_CALL_RECEIVED,
U8_CONNECT_REQUEST,
U9_INCOMING_CALL_PROCEEDING,
U10_ACTIVE,
U11_DISCONNECT_REQUEST,
U12_DISCONNECT_INDICATION,
U15_SUSPEND_REQUEST,
U17_RESUME_REQUEST,
U19_RELEASE_REQUEST,
U25_OVERLAP_RECEIVING,
/* Network states */
N0_NULL_STATE,
N1_CALL_INITIATED,
N2_OVERLAP_SENDING,
N3_OUTGOING_CALL_PROCEEDING,
N4_CALL_DELIVERED,
N6_CALL_PRESENT,
N7_CALL_RECEIVED,
N8_CONNECT_REQUEST,
N9_INCOMING_CALL_PROCEEDING,
N10_ACTIVE,
N11_DISCONNECT_REQUEST,
N12_DISCONNECT_INDICATION,
N15_SUSPEND_REQUEST,
N17_RESUME_REQUEST,
N19_RELEASE_REQUEST,
N22_CALL_ABORT,
N25_OVERLAP_RECEIVING
} q931_state;
typedef enum q931_mode {
UNKNOWN_MODE,
CIRCUIT_MODE,
@@ -74,14 +41,14 @@ typedef struct q931_h {
u_int8_t pd; /* Protocol Discriminator */
#if __BYTE_ORDER == __BIG_ENDIAN
u_int8_t x0:4;
u_int8_t crlen:4;
u_int8_t crlen:4;/*!< Call reference length */
#else
u_int8_t crlen:4;
u_int8_t crlen:4;/*!< Call reference length */
u_int8_t x0:4;
#endif
u_int8_t contents[0];
u_int8_t crv[3];
} q931_h;
u_int8_t crv[3];/*!< Call reference value */
} __attribute__ ((packed)) q931_h;
/* Message type header */
@@ -94,25 +61,24 @@ typedef struct q931_mh {
u_int8_t f:1;
#endif
u_int8_t data[0];
} q931_mh;
} __attribute__ ((packed)) q931_mh;
/* Information element format */
typedef struct q931_ie {
#if __BYTE_ORDER == __BIG_ENDIAN
u_int8_t f:1;
u_int8_t ie:7;
#else
u_int8_t ie:7;
u_int8_t f:1;
#endif
u_int8_t ie;
u_int8_t len;
u_int8_t data[0];
} q931_ie;
} __attribute__ ((packed)) q931_ie;
#define Q931_RES_HAVEEVENT (1 << 0)
#define Q931_RES_INERRROR (1 << 1)
#define Q931_PROTOCOL_DISCRIMINATOR 0x08
#define GR303_PROTOCOL_DISCRIMINATOR 0x4f
/* AT&T Maintenance Protocol Discriminator */
#define MAINTENANCE_PROTOCOL_DISCRIMINATOR_1 0x03
/* National Maintenance Protocol Discriminator */
#define MAINTENANCE_PROTOCOL_DISCRIMINATOR_2 0x43
/* Q.931 / National ISDN Message Types */
@@ -157,20 +123,30 @@ typedef struct q931_ie {
#define Q931_SUSPEND_REJECT 0x21
/* Maintenance messages (codeset 0 only) */
#define NATIONAL_SERVICE 0x0f
#define NATIONAL_SERVICE_ACKNOWLEDGE 0x07
#define ATT_SERVICE 0x0f
#define ATT_SERVICE_ACKNOWLEDGE 0x07
#define NATIONAL_SERVICE 0x07
#define NATIONAL_SERVICE_ACKNOWLEDGE 0x0f
#define SERVICE_CHANGE_STATUS_INSERVICE 0
#define SERVICE_CHANGE_STATUS_LOOPBACK 1 /* not supported */
#define SERVICE_CHANGE_STATUS_OUTOFSERVICE 2
#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
#define Q931_BEARER_CAPABILITY 0x04
#define Q931_CAUSE 0x08
#define Q931_CALL_STATE 0x14
#define Q931_IE_CALL_STATE 0x14
#define Q931_CHANNEL_IDENT 0x18
#define Q931_PROGRESS_INDICATOR 0x1e
#define Q931_NETWORK_SPEC_FAC 0x20
#define Q931_CALLING_PARTY_CATEGORY (0x32 | Q931_CODESET(5))
#define Q931_INFORMATION_RATE 0x40
#define Q931_TRANSIT_DELAY 0x42
#define Q931_TRANS_DELAY_SELECT 0x43
@@ -190,10 +166,18 @@ typedef struct q931_ie {
#define Q931_LOW_LAYER_COMPAT 0x7c
#define Q931_HIGH_LAYER_COMPAT 0x7d
#define Q931_CODESET(x) ((x) << 8)
#define Q931_IE_CODESET(x) ((x) >> 8)
#define Q931_IE_IE(x) ((x) & 0xff)
#define Q931_FULL_IE(codeset, ie) (((codeset) << 8) | ((ie) & 0xff))
#define Q931_DISPLAY 0x28
#define Q931_IE_SEGMENTED_MSG 0x00
#define Q931_IE_CHANGE_STATUS 0x01
#define Q931_IE_CONNECTED_NUM 0x0C
#define Q931_IE_ORIGINATING_LINE_INFO (0x01 | Q931_CODESET(6))
#define Q931_IE_CONNECTED_ADDR 0x0c
#define Q931_IE_CONNECTED_NUM 0x4c
#define Q931_IE_CONNECTED_SUBADDR 0x4d
#define Q931_IE_CALL_IDENTITY 0x10
#define Q931_IE_FACILITY 0x1c
#define Q931_IE_ENDPOINT_ID 0x26
@@ -205,6 +189,7 @@ typedef struct q931_ie {
#define Q931_IE_INFO_REQUEST 0x32
#define Q931_IE_SIGNAL 0x34
#define Q931_IE_SWITCHHOOK 0x36
#define Q931_IE_GENERIC_DIGITS (0x37 | Q931_CODESET(6))
#define Q931_IE_FEATURE_ACTIVATE 0x38
#define Q931_IE_FEATURE_IND 0x39
#define Q931_IE_ORIGINAL_CALLED_NUMBER 0x73
@@ -215,40 +200,276 @@ typedef struct q931_ie {
#define Q931_IE_ESCAPE_FOR_EXT 0x7F
/* Call state stuff */
#define Q931_CALL_STATE_NULL 0
#define Q931_CALL_STATE_CALL_INITIATED 1
#define Q931_CALL_STATE_OVERLAP_SENDING 2
#define Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING 3
#define Q931_CALL_STATE_CALL_DELIVERED 4
#define Q931_CALL_STATE_CALL_PRESENT 6
#define Q931_CALL_STATE_CALL_RECEIVED 7
#define Q931_CALL_STATE_CONNECT_REQUEST 8
#define Q931_CALL_STATE_INCOMING_CALL_PROCEEDING 9
#define Q931_CALL_STATE_ACTIVE 10
#define Q931_CALL_STATE_DISCONNECT_REQUEST 11
#define Q931_CALL_STATE_DISCONNECT_INDICATION 12
#define Q931_CALL_STATE_SUSPEND_REQUEST 15
#define Q931_CALL_STATE_RESUME_REQUEST 17
#define Q931_CALL_STATE_RELEASE_REQUEST 19
#define Q931_CALL_STATE_OVERLAP_RECEIVING 25
#define Q931_CALL_STATE_RESTART_REQUEST 61
#define Q931_CALL_STATE_RESTART 62
/*! Q.931 call states */
enum Q931_CALL_STATE {
/*!
* \details
* null state (U0):
* No call exists.
* \details
* null state (N0):
* No call exists.
*/
Q931_CALL_STATE_NULL = 0,
/*!
* \details
* call initiated (U1):
* This state exists for an outgoing call, when the user requests
* call establishment from the network.
* \details
* call initiated (N1):
* This state exists for an outgoing call when the network has received
* a call establishment request but has not yet responded.
*/
Q931_CALL_STATE_CALL_INITIATED = 1,
/*!
* \details
* overlap sending (U2):
* This state exists for an outgoing call when the user has
* received acknowledgement of the call establishment request which
* permits the user to send additional call information to the network
* in overlap mode.
* \details
* overlap sending (N2):
* This state exists for an outgoing call when the network has acknowledged
* the call establishment request and is prepared to receive additional
* call information (if any) in overlap mode.
*/
Q931_CALL_STATE_OVERLAP_SENDING = 2,
/*!
* \details
* outgoing call proceeding (U3):
* This state exists for an outgoing call when the user has
* received acknowledgement that the network has received all
* call information necessary to effect call establishment.
* \details
* outgoing call proceeding (N3):
* This state exists for an outgoing call when the network has sent
* acknowledgement that the network has received all call information
* necessary to effect call establishment.
*/
Q931_CALL_STATE_OUTGOING_CALL_PROCEEDING = 3,
/*!
* \details
* call delivered (U4):
* This state exists for an outgoing call when the calling user has
* received an indication that remote user alerting has been initiated.
* \details
* call delivered (N4):
* This state exists for an outgoing call when the network has indicated
* that remote user alerting has been initiated.
*/
Q931_CALL_STATE_CALL_DELIVERED = 4,
/*!
* \details
* call present (U6):
* This state exists for an incoming call when the user has received a
* call establishment request but has not yet responded.
* \details
* call present (N6):
* This state exists for an incoming call when the network has sent a
* call establishment request but has not yet received a satisfactory
* response.
*/
Q931_CALL_STATE_CALL_PRESENT = 6,
/*!
* \details
* call received (U7):
* This state exists for an incoming call when the user has indicated
* alerting but has not yet answered.
* \details
* call received (N7):
* This state exists for an incoming call when the network has received
* an indication that the user is alerting but has not yet received an
* answer.
*/
Q931_CALL_STATE_CALL_RECEIVED = 7,
/*!
* \details
* connect request (U8):
* This state exists for an incoming call when the user has answered
* the call and is waiting to be awarded the call.
* \details
* connect request (N8):
* This state exists for an incoming call when the network has received
* an answer but the network has not yet awarded the call.
*/
Q931_CALL_STATE_CONNECT_REQUEST = 8,
/*!
* \details
* incoming call proceeding (U9):
* This state exists for an incoming call when the user has sent
* acknowledgement that the user has received all call information
* necessary to effect call establishment.
* \details
* incoming call proceeding (N9):
* This state exists for an incoming call when the network has received
* acknowledgement that the user has received all call information
* necessary to effect call establishment.
*/
Q931_CALL_STATE_INCOMING_CALL_PROCEEDING = 9,
/*!
* \details
* active (U10):
* This state exists for an incoming call when the user has received
* an acknowledgement from the network that the user has been awarded
* the call. This state exists for an outgoing call when the user has
* received an indication that the remote user has answered the call.
* \details
* active (N10):
* This state exists for an incoming call when the network has awarded
* the call to the called user. This state exists for an outgoing call
* when the network has indicated that the remote user has answered
* the call.
*/
Q931_CALL_STATE_ACTIVE = 10,
/*!
* \details
* disconnect request (U11):
* This state exists when the user has requested the network to clear
* the end-to-end connection (if any) and is waiting for a response.
* \details
* disconnect request (N11):
* This state exists when the network has received a request from the
* user to clear the end-to-end connection (if any).
*/
Q931_CALL_STATE_DISCONNECT_REQUEST = 11,
/*!
* \details
* disconnect indication (U12):
* This state exists when the user has received an invitation to
* disconnect because the network has disconnected the end-to-end
* connection (if any).
* \details
* disconnect indication (N12):
* This state exists when the network has disconnected the end-to-end
* connection (if any) and has sent an invitation to disconnect the
* user-network connection.
*/
Q931_CALL_STATE_DISCONNECT_INDICATION = 12,
/*!
* \details
* suspend request (U15):
* This state exists when the user has requested the network to suspend
* the call and is waiting for a response.
* \details
* suspend request (N15):
* This state exists when the network has received a request to suspend
* the call but has not yet responded.
*/
Q931_CALL_STATE_SUSPEND_REQUEST = 15,
/*!
* \details
* resume request (U17):
* This state exists when the user has requested the network to resume
* a previously suspended call and is waiting for a response.
* \details
* resume request (N17):
* This state exists when the network has received a request to resume
* a previously suspended call but has not yet responded.
*/
Q931_CALL_STATE_RESUME_REQUEST = 17,
/*!
* \details
* release request (U19):
* This state exists when the user has requested the network to release
* and is waiting for a response.
* \details
* release request (N19):
* This state exists when the network has requested the user to release
* and is waiting for a response.
*/
Q931_CALL_STATE_RELEASE_REQUEST = 19,
/*!
* \details
* call abort (N22):
* This state exists for an incoming call for the point-to-multipoint
* configuration when the call is being cleared before any user has been
* awarded the call.
*/
Q931_CALL_STATE_CALL_ABORT = 22,
/*!
* \details
* overlap receiving (U25):
* This state exists for an incoming call when the user has acknowledged
* the call establishment request from the network and is prepared to
* receive additional call information (if any) in overlap mode.
* \details
* overlap receiving (N25):
* This state exists for an incoming call when the network has received
* acknowledgement of the call establishment request which permits the
* network to send additional call information (if any) in the overlap
* mode.
*/
Q931_CALL_STATE_OVERLAP_RECEIVING = 25,
/*!
* \details
* call independent service (U31): (From Q.932)
* This state exists when a call independent supplementary service
* signalling connection is established.
* \details
* call independent service (N31): (From Q.932)
* This state exists when a call independent supplementary service
* signalling connection is established.
*/
Q931_CALL_STATE_CALL_INDEPENDENT_SERVICE = 31,
Q931_CALL_STATE_RESTART_REQUEST = 61,
Q931_CALL_STATE_RESTART = 62,
/*!
* \details
* Call state has not been set.
* Call state does not exist.
* Call state not initialized.
* Call state internal use only.
*/
Q931_CALL_STATE_NOT_SET = 0xFF,
};
/*! Q.931 call establishment state ranking for competing calls in PTMP NT mode. */
enum Q931_RANKED_CALL_STATE {
/*! Call is present but has no response yet. */
Q931_RANKED_CALL_STATE_PRESENT,
/*! Call is collecting digits. */
Q931_RANKED_CALL_STATE_OVERLAP,
/*! Call routing is happening. */
Q931_RANKED_CALL_STATE_PROCEEDING,
/*! Called party is being alerted of the call. */
Q931_RANKED_CALL_STATE_ALERTING,
/*! Call is connected. A winner has been declared. */
Q931_RANKED_CALL_STATE_CONNECT,
/*! Call is in some non-call establishment state (likely disconnecting). */
Q931_RANKED_CALL_STATE_OTHER,
};
/* EuroISDN */
#define Q931_SENDING_COMPLETE 0x21
#define Q931_SENDING_COMPLETE 0xa1
extern int q931_receive(struct pri *pri, q931_h *h, int len);
extern int maintenance_service(struct pri *pri, int span, int channel, int changestatus);
extern int maintenance_service_ack(struct pri *pri, q931_call *call);
/* Q.SIG specific */
#define QSIG_IE_TRANSIT_COUNT 0x31
extern int q931_receive(struct pri *pri, int tei, q931_h *h, int len);
extern int q931_alerting(struct pri *pri, q931_call *call, int channel, int info);
extern int q931_call_proceeding(struct pri *pri, q931_call *call);
extern int q931_call_progress_with_cause(struct pri *pri, q931_call *call, int channel, int info, int cause);
extern int q931_call_progress(struct pri *pri, q931_call *call, int channel, int info);
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_information(struct pri *pri, q931_call *call, char digit);
extern int q931_keypad_facility(struct pri *pri, q931_call *call, const char *digits);
extern int q931_connect(struct pri *pri, q931_call *call, int channel, int nonisdn);
extern int q931_release(struct pri *pri, q931_call *call, int cause);
@@ -259,13 +480,28 @@ extern int q931_hangup(struct pri *pri, q931_call *call, int cause);
extern int q931_restart(struct pri *pri, int channel);
extern q931_call *q931_new_call(struct pri *pri);
extern int q931_facility(struct pri *pri, q931_call *call);
extern int q931_setup(struct pri *pri, q931_call *c, int transmode, int channel, int exclusive,
int nonisdn, char *caller, int callerplan, char *callername, int callerpres, char *called,
int calledplan, int ulay1);
extern void q931_dump(q931_h *h, int len, int txrx);
extern int q931_call_getcrv(struct pri *pri, q931_call *call, int *callmode);
extern int q931_call_setcrv(struct pri *pri, q931_call *call, int crv, int callmode);
struct q931_call *q931_find_call(struct pri *ctrl, int cr);
struct q931_call *q931_new_call(struct pri *pri);
extern int q931_setup(struct pri *pri, q931_call *c, struct pri_sr *req);
void q931_dump(struct pri *ctrl, int tei, q931_h *h, int len, int txrx);
void q931_destroycall(struct pri *pri, q931_call *c);
extern void q931_dl_indication(struct pri *pri, int event);
int q931_send_hold(struct pri *ctrl, struct q931_call *call);
int q931_send_hold_ack(struct pri *ctrl, struct q931_call *call);
int q931_send_hold_rej(struct pri *ctrl, struct q931_call *call, int cause);
int q931_send_retrieve(struct pri *ctrl, struct q931_call *call, int channel);
int q931_send_retrieve_ack(struct pri *ctrl, struct q931_call *call, int channel);
int q931_send_retrieve_rej(struct pri *ctrl, struct q931_call *call, int cause);
extern void __q931_destroycall(struct pri *pri, q931_call *c);
#endif

61
pridump.c Executable file → Normal file
View File

@@ -1,25 +1,30 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*
@@ -36,7 +41,8 @@
#include <string.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <linux/zaptel.h>
#include <sys/types.h>
#include <zaptel/zaptel.h>
#include "libpri.h"
#include "pri_q921.h"
#include "pri_q931.h"
@@ -62,12 +68,12 @@ static int pri_open(char *dev)
return dfd;
}
static void dump_packet(char *buf, int len, int txrx)
static void dump_packet(struct pri *pri, char *buf, int len, int txrx)
{
q921_h *h = (q921_h *)buf;
q921_dump(h, len, 1, txrx);
q921_dump(pri, h, len, 1, txrx);
if (!((h->h.data[0] & Q921_FRAMETYPE_MASK) & 0x3)) {
q931_dump((q931_h *)(h->i.data), len - 4, txrx);
q931_dump(pri, h->h.tei, (q931_h *)(h->i.data), len - 4 - 2 /* FCS */, txrx);
}
fflush(stdout);
fflush(stderr);
@@ -98,18 +104,28 @@ static int pri_bridge(int d1, int d2)
if (FD_ISSET(d1, &fds)) {
/* Copy from d1 to d2 */
res = read(d1, buf, sizeof(buf));
dump_packet(buf, res, 1);
dump_packet((struct pri *)NULL, buf, res, 1);
res = write(d2, buf, res);
}
if (FD_ISSET(d2, &fds)) {
/* Copy from d2 to d1 */
res = read(d2, buf, sizeof(buf));
dump_packet(buf, res, 0);
dump_packet((struct pri *)NULL, buf, res, 0);
res = write(d1, buf, res);
}
}
}
static void my_pri_message(struct pri *pri, char *stuff)
{
fprintf(stdout, "%s", stuff);
}
static void my_pri_error(struct pri *pri, char *stuff)
{
fprintf(stderr, "%s", stuff);
}
int main(int argc, char *argv[])
{
int d1, d2;
@@ -119,6 +135,9 @@ int main(int argc, char *argv[])
exit(1);
}
pri_set_message(my_pri_message);
pri_set_error(my_pri_error);
d1 = pri_open(argv[1]);
if (d1 < 0)
exit(1);

199
prisched.c Executable file → Normal file
View File

@@ -1,48 +1,75 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* 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.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
#include <stdio.h>
#include "libpri.h"
#include "pri_internal.h"
#include <stdio.h>
/*! \brief The maximum number of timers that were active at once. */
static int maxsched = 0;
/* Scheduler routines */
int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), void *data)
/*!
* \brief Start a timer to schedule an event.
*
* \param ctrl D channel controller.
* \param ms Number of milliseconds to scheduled event.
* \param function Callback function to call when timeout.
* \param data Value to give callback function when timeout.
*
* \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)
{
int x;
struct timeval tv;
for (x=1;x<MAX_SCHED;x++)
if (!pri->pri_sched[x].callback)
break;
if (x == MAX_SCHED) {
pri_error("No more room in scheduler\n");
return -1;
/* Scheduling runs on master channels only */
while (ctrl->master) {
ctrl = ctrl->master;
}
for (x = 0; x < MAX_SCHED; ++x) {
if (!ctrl->pri_sched[x].callback) {
break;
}
}
if (x == MAX_SCHED) {
pri_error(ctrl, "No more room in scheduler\n");
return 0;
}
if (x >= maxsched) {
maxsched = x + 1;
}
if (x > maxsched)
maxsched = x;
gettimeofday(&tv, NULL);
tv.tv_sec += ms / 1000;
tv.tv_usec += (ms % 1000) * 1000;
@@ -50,54 +77,110 @@ int pri_schedule_event(struct pri *pri, int ms, void (*function)(void *data), vo
tv.tv_usec -= 1000000;
tv.tv_sec += 1;
}
pri->pri_sched[x].when = tv;
pri->pri_sched[x].callback = function;
pri->pri_sched[x].data = data;
return x;
ctrl->pri_sched[x].when = tv;
ctrl->pri_sched[x].callback = function;
ctrl->pri_sched[x].data = data;
return x + 1;
}
struct timeval *pri_schedule_next(struct pri *pri)
/*!
* \brief Determine the time of the next scheduled event to expire.
*
* \param ctrl D channel controller.
*
* \return Time of the next scheduled event to expire or NULL if no timers active.
*/
struct timeval *pri_schedule_next(struct pri *ctrl)
{
struct timeval *closest = NULL;
int x;
for (x=1;x<MAX_SCHED;x++) {
if (pri->pri_sched[x].callback &&
(!closest || (closest->tv_sec > pri->pri_sched[x].when.tv_sec) ||
((closest->tv_sec == pri->pri_sched[x].when.tv_sec) &&
(closest->tv_usec > pri->pri_sched[x].when.tv_usec))))
closest = &pri->pri_sched[x].when;
/* Scheduling runs on master channels only */
while (ctrl->master) {
ctrl = ctrl->master;
}
for (x = 0; x < MAX_SCHED; ++x) {
if (ctrl->pri_sched[x].callback && (!closest
|| (closest->tv_sec > ctrl->pri_sched[x].when.tv_sec)
|| ((closest->tv_sec == ctrl->pri_sched[x].when.tv_sec)
&& (closest->tv_usec > ctrl->pri_sched[x].when.tv_usec)))) {
closest = &ctrl->pri_sched[x].when;
}
}
return closest;
}
pri_event *pri_schedule_run(struct pri *pri)
/*!
* \internal
* \brief Run all expired timers or return an event generated by an expired timer.
*
* \param ctrl D channel controller.
* \param tv Current time.
*
* \return Event for upper layer to process or NULL if all expired timers run.
*/
static pri_event *__pri_schedule_run(struct pri *ctrl, struct timeval *tv)
{
struct timeval tv;
int x;
void (*callback)(void *);
void *data;
gettimeofday(&tv, NULL);
for (x=1;x<MAX_SCHED;x++) {
if (pri->pri_sched[x].callback &&
((pri->pri_sched[x].when.tv_sec < tv.tv_sec) ||
((pri->pri_sched[x].when.tv_sec == tv.tv_sec) &&
(pri->pri_sched[x].when.tv_usec <= tv.tv_usec)))) {
pri->schedev = 0;
callback = pri->pri_sched[x].callback;
data = pri->pri_sched[x].data;
pri->pri_sched[x].callback = NULL;
pri->pri_sched[x].data = NULL;
callback(data);
if (pri->schedev)
return &pri->ev;
/* Scheduling runs on master channels only */
while (ctrl->master) {
ctrl = ctrl->master;
}
for (x = 0; x < MAX_SCHED; ++x) {
if (ctrl->pri_sched[x].callback && ((ctrl->pri_sched[x].when.tv_sec < tv->tv_sec)
|| ((ctrl->pri_sched[x].when.tv_sec == tv->tv_sec)
&& (ctrl->pri_sched[x].when.tv_usec <= tv->tv_usec)))) {
/* This timer has expired. */
ctrl->schedev = 0;
callback = ctrl->pri_sched[x].callback;
data = ctrl->pri_sched[x].data;
ctrl->pri_sched[x].callback = NULL;
callback(data);
if (ctrl->schedev) {
return &ctrl->ev;
}
}
}
return NULL;
}
void pri_schedule_del(struct pri *pri,int id)
/*!
* \brief Run all expired timers or return an event generated by an expired timer.
*
* \param ctrl D channel controller.
*
* \return Event for upper layer to process or NULL if all expired timers run.
*/
pri_event *pri_schedule_run(struct pri *ctrl)
{
if ((id >= MAX_SCHED) || (id < 0))
pri_error("Asked to delete sched id %d???\n", id);
pri->pri_sched[id].callback = NULL;
struct timeval tv;
gettimeofday(&tv, NULL);
return __pri_schedule_run(ctrl, &tv);
}
/*!
* \brief Delete a scheduled event.
*
* \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)
{
/* Scheduling runs on master channels only */
while (ctrl->master) {
ctrl = ctrl->master;
}
if (0 < id && id <= MAX_SCHED) {
ctrl->pri_sched[id - 1].callback = NULL;
} else if (id) {
pri_error(ctrl, "Asked to delete sched id %d???\n", id);
}
}

44
pritest.c Executable file → Normal file
View File

@@ -1,25 +1,30 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software; you can redistribute it and/or modify
* 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.
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*
@@ -40,7 +45,7 @@
#include <sys/wait.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <linux/zaptel.h>
#include <zaptel/zaptel.h>
#include <zap.h>
#include "libpri.h"
@@ -116,6 +121,10 @@ static int str2switch(char *swtype)
return PRI_SWITCH_ATT4ESS;
if (!strcasecmp(swtype, "euroisdn"))
return PRI_SWITCH_EUROISDN_E1;
if (!strcasecmp(swtype, "gr303eoc"))
return PRI_SWITCH_GR303_EOC;
if (!strcasecmp(swtype, "gr303tmc"))
return PRI_SWITCH_GR303_TMC;
return -1;
}
@@ -290,11 +299,12 @@ static int run_pri(int dfd, int swtype, int node)
fd_set rfds, efds;
int res,x;
pri = pri_new(dfd, node, swtype);
pri = pri_new_bri(dfd, 1, node, swtype);
if (!pri) {
fprintf(stderr, "Unable to create PRI\n");
return -1;
}
pri_set_debug(pri, -1);
for (;;) {
/* Run the D-Channel */

2824
q921.c Executable file → Normal file

File diff suppressed because it is too large Load Diff

7573
q931.c Executable file → Normal file

File diff suppressed because it is too large Load Diff

2500
rose.c Normal file

File diff suppressed because it is too large Load Diff

3580
rose.h Normal file

File diff suppressed because it is too large Load Diff

983
rose_address.c Normal file
View File

@@ -0,0 +1,983 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief ROSE Addressing-Data-Elements
*
* Addressing-Data-Elements ETS 300 196-1 D.3
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#include "compat.h"
#include "libpri.h"
#include "pri_internal.h"
#include "rose.h"
#include "rose_internal.h"
#include "asn1.h"
/* ------------------------------------------------------------------- */
/*!
* \internal
* \brief Encode the public or private network PartyNumber type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param tag Component tag to identify the encoded component.
* The tag should be ASN1_TAG_SEQUENCE unless the caller implicitly
* tags it otherwise.
* \param number
* \param length_of_number
* \param type_of_number
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
static unsigned char *rose_enc_NetworkPartyNumber(struct pri *ctrl, unsigned char *pos,
unsigned char *end, unsigned tag, const unsigned char *number,
size_t length_of_number, u_int8_t type_of_number)
{
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, tag);
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED, type_of_number));
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_TYPE_NUMERIC_STRING, number,
length_of_number));
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the PartyNumber type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param party_number
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_PartyNumber(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePartyNumber *party_number)
{
switch (party_number->plan) {
case 0: /* Unknown PartyNumber */
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 0,
party_number->str, party_number->length));
break;
case 1: /* Public PartyNumber */
ASN1_CALL(pos, rose_enc_NetworkPartyNumber(ctrl, pos, end,
ASN1_CLASS_CONTEXT_SPECIFIC | 1, party_number->str, party_number->length,
party_number->ton));
break;
case 2: /* NSAP encoded PartyNumber */
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 2,
party_number->str, party_number->length));
break;
case 3: /* Data PartyNumber (Not used) */
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 3,
party_number->str, party_number->length));
break;
case 4: /* Telex PartyNumber (Not used) */
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 4,
party_number->str, party_number->length));
break;
case 5: /* Private PartyNumber */
ASN1_CALL(pos, rose_enc_NetworkPartyNumber(ctrl, pos, end,
ASN1_CLASS_CONTEXT_SPECIFIC | 5, party_number->str, party_number->length,
party_number->ton));
break;
case 8: /* National Standard PartyNumber (Not used) */
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 8,
party_number->str, party_number->length));
break;
default:
ASN1_ENC_ERROR(ctrl, "Unknown numbering plan");
return NULL;
}
return pos;
}
/*!
* \brief Encode the PartySubaddress type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param party_subaddress
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_PartySubaddress(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePartySubaddress *party_subaddress)
{
unsigned char *seq_len;
switch (party_subaddress->type) {
case 0: /* UserSpecified */
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_TYPE_OCTET_STRING,
party_subaddress->u.user_specified.information, party_subaddress->length));
if (party_subaddress->u.user_specified.odd_count_present) {
ASN1_CALL(pos, asn1_enc_boolean(pos, end, ASN1_TYPE_BOOLEAN,
party_subaddress->u.user_specified.odd_count));
}
ASN1_CONSTRUCTED_END(seq_len, pos, end);
break;
case 1: /* NSAP */
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_TYPE_OCTET_STRING,
party_subaddress->u.nsap, party_subaddress->length));
break;
default:
ASN1_ENC_ERROR(ctrl, "Unknown subaddress type");
return NULL;
}
return pos;
}
/*!
* \brief Encode the Address type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param tag Component tag to identify the encoded component.
* The tag should be ASN1_TAG_SEQUENCE unless the caller implicitly
* tags it otherwise.
* \param address
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_Address(struct pri *ctrl, unsigned char *pos, unsigned char *end,
unsigned tag, const struct roseAddress *address)
{
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, tag);
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end, &address->number));
if (address->subaddress.length) {
ASN1_CALL(pos, rose_enc_PartySubaddress(ctrl, pos, end, &address->subaddress));
}
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the PresentedNumberUnscreened type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param party
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_PresentedNumberUnscreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePresentedNumberUnscreened *party)
{
unsigned char *seq_len;
switch (party->presentation) {
case 0: /* presentationAllowedNumber */
/* EXPLICIT tag */
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 0);
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end, &party->number));
ASN1_CONSTRUCTED_END(seq_len, pos, end);
break;
case 1: /* presentationRestricted */
ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 1));
break;
case 2: /* numberNotAvailableDueToInterworking */
ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 2));
break;
case 3: /* presentationRestrictedNumber */
/* EXPLICIT tag */
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 3);
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end, &party->number));
ASN1_CONSTRUCTED_END(seq_len, pos, end);
break;
default:
ASN1_ENC_ERROR(ctrl, "Unknown presentation type");
return NULL;
}
return pos;
}
/*!
* \brief Encode the NumberScreened type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param tag Component tag to identify the encoded component.
* The tag should be ASN1_TAG_SEQUENCE unless the caller implicitly
* tags it otherwise.
* \param screened
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_NumberScreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, unsigned tag, const struct roseNumberScreened *screened)
{
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, tag);
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end, &screened->number));
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
screened->screening_indicator));
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the PresentedNumberScreened type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param party
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_PresentedNumberScreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePresentedNumberScreened *party)
{
switch (party->presentation) {
case 0: /* presentationAllowedNumber */
ASN1_CALL(pos, rose_enc_NumberScreened(ctrl, pos, end,
ASN1_CLASS_CONTEXT_SPECIFIC | 0, &party->screened));
break;
case 1: /* presentationRestricted */
ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 1));
break;
case 2: /* numberNotAvailableDueToInterworking */
ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 2));
break;
case 3: /* presentationRestrictedNumber */
ASN1_CALL(pos, rose_enc_NumberScreened(ctrl, pos, end,
ASN1_CLASS_CONTEXT_SPECIFIC | 3, &party->screened));
break;
default:
ASN1_ENC_ERROR(ctrl, "Unknown presentation type");
return NULL;
}
return pos;
}
/*!
* \brief Encode the AddressScreened type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param tag Component tag to identify the encoded component.
* The tag should be ASN1_TAG_SEQUENCE unless the caller implicitly
* tags it otherwise.
* \param screened
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_AddressScreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, unsigned tag, const struct roseAddressScreened *screened)
{
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, tag);
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end, &screened->number));
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
screened->screening_indicator));
if (screened->subaddress.length) {
ASN1_CALL(pos, rose_enc_PartySubaddress(ctrl, pos, end, &screened->subaddress));
}
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the PresentedAddressScreened type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param party
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_PresentedAddressScreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePresentedAddressScreened *party)
{
switch (party->presentation) {
case 0: /* presentationAllowedAddress */
ASN1_CALL(pos, rose_enc_AddressScreened(ctrl, pos, end,
ASN1_CLASS_CONTEXT_SPECIFIC | 0, &party->screened));
break;
case 1: /* presentationRestricted */
ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 1));
break;
case 2: /* numberNotAvailableDueToInterworking */
ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 2));
break;
case 3: /* presentationRestrictedAddress */
ASN1_CALL(pos, rose_enc_AddressScreened(ctrl, pos, end,
ASN1_CLASS_CONTEXT_SPECIFIC | 3, &party->screened));
break;
default:
ASN1_ENC_ERROR(ctrl, "Unknown presentation type");
return NULL;
}
return pos;
}
/*!
* \internal
* \brief Decode the NumberDigits PartyNumber argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party_number Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_NumberDigits(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartyNumber *party_number)
{
size_t str_len;
ASN1_CALL(pos, asn1_dec_string_max(ctrl, name, tag, pos, end,
sizeof(party_number->str), party_number->str, &str_len));
party_number->length = str_len;
return pos;
}
/*!
* \internal
* \brief Decode the NSAP PartyNumber argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party_number Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_NSAPPartyNumber(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartyNumber *party_number)
{
size_t str_len;
ASN1_CALL(pos, asn1_dec_string_bin(ctrl, name, tag, pos, end,
sizeof(party_number->str), party_number->str, &str_len));
party_number->length = str_len;
return pos;
}
/*!
* \internal
* \brief Decode the public or private network PartyNumber argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party_number Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_NetworkPartyNumber(struct pri *ctrl,
const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartyNumber *party_number)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s %s\n", name, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "typeOfNumber", tag, pos, seq_end, &value));
party_number->ton = value;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_TYPE_NUMERIC_STRING);
ASN1_CALL(pos, rose_dec_NumberDigits(ctrl, "numberDigits", tag, pos, seq_end,
party_number));
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the PartyNumber argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party_number Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_PartyNumber(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartyNumber *party_number)
{
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s PartyNumber\n", name);
}
party_number->ton = 0; /* unknown */
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
party_number->plan = 0; /* Unknown PartyNumber */
ASN1_CALL(pos, rose_dec_NumberDigits(ctrl, "unknownPartyNumber", tag, pos, end,
party_number));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
/* Must be constructed but we will not check for it for simplicity. */
party_number->plan = 1; /* Public PartyNumber */
ASN1_CALL(pos, rose_dec_NetworkPartyNumber(ctrl, "publicPartyNumber", tag, pos,
end, party_number));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
party_number->plan = 2; /* NSAP encoded PartyNumber */
ASN1_CALL(pos, rose_dec_NSAPPartyNumber(ctrl, "nsapEncodedPartyNumber", tag, pos,
end, party_number));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
party_number->plan = 3; /* Data PartyNumber (Not used) */
ASN1_CALL(pos, rose_dec_NumberDigits(ctrl, "dataPartyNumber", tag, pos, end,
party_number));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
party_number->plan = 4; /* Telex PartyNumber (Not used) */
ASN1_CALL(pos, rose_dec_NumberDigits(ctrl, "telexPartyNumber", tag, pos, end,
party_number));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 5:
/* Must be constructed but we will not check for it for simplicity. */
party_number->plan = 5; /* Private PartyNumber */
ASN1_CALL(pos, rose_dec_NetworkPartyNumber(ctrl, "privatePartyNumber", tag, pos,
end, party_number));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 8:
party_number->plan = 8; /* National Standard PartyNumber (Not used) */
ASN1_CALL(pos, rose_dec_NumberDigits(ctrl, "nationalStandardPartyNumber", tag,
pos, end, party_number));
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
return pos;
}
/*!
* \internal
* \brief Decode the User PartySubaddress argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party_subaddress Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_UserSubaddress(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartySubaddress *party_subaddress)
{
size_t str_len;
int32_t odd_count;
int length;
int seq_offset;
const unsigned char *seq_end;
party_subaddress->type = 0; /* UserSpecified */
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s UserSpecified %s\n", name, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
/* SubaddressInformation */
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_TYPE_OCTET_STRING);
ASN1_CALL(pos, asn1_dec_string_bin(ctrl, "subaddressInformation", tag, pos, seq_end,
sizeof(party_subaddress->u.user_specified.information),
party_subaddress->u.user_specified.information, &str_len));
party_subaddress->length = str_len;
if (pos < seq_end && *pos != ASN1_INDEF_TERM) {
/*
* The optional odd count indicator must be present since there
* is something left.
*/
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_BOOLEAN);
ASN1_CALL(pos, asn1_dec_boolean(ctrl, "oddCount", tag, pos, seq_end,
&odd_count));
party_subaddress->u.user_specified.odd_count = odd_count;
party_subaddress->u.user_specified.odd_count_present = 1;
} else {
party_subaddress->u.user_specified.odd_count = 0;
party_subaddress->u.user_specified.odd_count_present = 0;
}
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \internal
* \brief Decode the NSAP PartySubaddress argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party_subaddress Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_NSAPSubaddress(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartySubaddress *party_subaddress)
{
size_t str_len;
party_subaddress->type = 1; /* NSAP */
ASN1_CALL(pos, asn1_dec_string_bin(ctrl, name, tag, pos, end,
sizeof(party_subaddress->u.nsap), party_subaddress->u.nsap, &str_len));
party_subaddress->length = str_len;
return pos;
}
/*!
* \brief Decode the PartySubaddress argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party_subaddress Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_PartySubaddress(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartySubaddress *party_subaddress)
{
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s PartySubaddress\n", name);
}
switch (tag) {
case ASN1_TAG_SEQUENCE:
ASN1_CALL(pos, rose_dec_UserSubaddress(ctrl, "user", tag, pos, end,
party_subaddress));
break;
case ASN1_TYPE_OCTET_STRING:
case ASN1_TYPE_OCTET_STRING | ASN1_PC_CONSTRUCTED:
ASN1_CALL(pos, rose_dec_NSAPSubaddress(ctrl, "nsap", tag, pos, end,
party_subaddress));
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
return pos;
}
/*!
* \brief Decode the Address argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param address Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_Address(struct pri *ctrl, const char *name, unsigned tag,
const unsigned char *pos, const unsigned char *end, struct roseAddress *address)
{
int length;
int seq_offset;
const unsigned char *seq_end;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s Address %s\n", name, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "partyNumber", tag, pos, seq_end,
&address->number));
if (pos < seq_end && *pos != ASN1_INDEF_TERM) {
/* The optional subaddress must be present since there is something left. */
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartySubaddress(ctrl, "partySubaddress", tag, pos,
seq_end, &address->subaddress));
} else {
address->subaddress.length = 0; /* Subaddress not present */
}
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the PresentedNumberUnscreened argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_PresentedNumberUnscreened(struct pri *ctrl,
const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePresentedNumberUnscreened *party)
{
int length;
int seq_offset;
const unsigned char *seq_end;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s PresentedNumberUnscreened\n", name);
}
switch (tag) {
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 0:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " Explicit %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
party->presentation = 0; /* presentationAllowedNumber */
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "presentationAllowedNumber", tag, pos,
seq_end, &party->number));
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
party->presentation = 1; /* presentationRestricted */
ASN1_CALL(pos, asn1_dec_null(ctrl, "presentationRestricted", tag, pos, end));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
party->presentation = 2; /* numberNotAvailableDueToInterworking */
ASN1_CALL(pos, asn1_dec_null(ctrl, "numberNotAvailableDueToInterworking", tag,
pos, end));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 3:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " Explicit %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
party->presentation = 3; /* presentationRestrictedNumber */
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "presentationRestrictedNumber", tag,
pos, seq_end, &party->number));
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
return pos;
}
/*!
* \brief Decode the NumberScreened argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param screened Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_NumberScreened(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseNumberScreened *screened)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s NumberScreened %s\n", name, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "partyNumber", tag, pos, seq_end,
&screened->number));
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "screeningIndicator", tag, pos, seq_end, &value));
screened->screening_indicator = value;
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the PresentedNumberScreened argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_PresentedNumberScreened(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePresentedNumberScreened *party)
{
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s PresentedNumberScreened\n", name);
}
switch (tag) {
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 0:
party->presentation = 0; /* presentationAllowedNumber */
ASN1_CALL(pos, rose_dec_NumberScreened(ctrl, "presentationAllowedNumber", tag,
pos, end, &party->screened));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
party->presentation = 1; /* presentationRestricted */
ASN1_CALL(pos, asn1_dec_null(ctrl, "presentationRestricted", tag, pos, end));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
party->presentation = 2; /* numberNotAvailableDueToInterworking */
ASN1_CALL(pos, asn1_dec_null(ctrl, "numberNotAvailableDueToInterworking", tag,
pos, end));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 3:
party->presentation = 3; /* presentationRestrictedNumber */
ASN1_CALL(pos, rose_dec_NumberScreened(ctrl, "presentationRestrictedNumber", tag,
pos, end, &party->screened));
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
return pos;
}
/*!
* \brief Decode the AddressScreened argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param screened Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_AddressScreened(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseAddressScreened *screened)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s AddressScreened %s\n", name, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "partyNumber", tag, pos, seq_end,
&screened->number));
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "screeningIndicator", tag, pos, seq_end, &value));
screened->screening_indicator = value;
if (pos < seq_end && *pos != ASN1_INDEF_TERM) {
/* The optional subaddress must be present since there is something left. */
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartySubaddress(ctrl, "partySubaddress", tag, pos,
seq_end, &screened->subaddress));
} else {
screened->subaddress.length = 0; /* Subaddress not present */
}
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the PresentedAddressScreened argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_PresentedAddressScreened(struct pri *ctrl,
const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePresentedAddressScreened *party)
{
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s PresentedAddressScreened\n", name);
}
switch (tag) {
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 0:
party->presentation = 0; /* presentationAllowedAddress */
ASN1_CALL(pos, rose_dec_AddressScreened(ctrl, "presentationAllowedAddress", tag,
pos, end, &party->screened));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
party->presentation = 1; /* presentationRestricted */
ASN1_CALL(pos, asn1_dec_null(ctrl, "presentationRestricted", tag, pos, end));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
party->presentation = 2; /* numberNotAvailableDueToInterworking */
ASN1_CALL(pos, asn1_dec_null(ctrl, "numberNotAvailableDueToInterworking", tag,
pos, end));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 3:
party->presentation = 3; /* presentationRestrictedAddress */
ASN1_CALL(pos, rose_dec_AddressScreened(ctrl, "presentationRestrictedAddress",
tag, pos, end, &party->screened));
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
return pos;
}
/* ------------------------------------------------------------------- */
/* end rose_address.c */

1929
rose_etsi_aoc.c Normal file

File diff suppressed because it is too large Load Diff

1623
rose_etsi_diversion.c Normal file

File diff suppressed because it is too large Load Diff

332
rose_etsi_ect.c Normal file
View File

@@ -0,0 +1,332 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief ROSE Explicit Call Transfer operations.
*
* Explicit Call Transfer (ECT) Supplementary Services ETS 300 369-1
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#include "compat.h"
#include "libpri.h"
#include "pri_internal.h"
#include "rose.h"
#include "rose_internal.h"
#include "asn1.h"
/* ------------------------------------------------------------------- */
/*!
* \brief Encode the ExplicitEctExecute invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_etsi_ExplicitEctExecute_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
args->etsi.ExplicitEctExecute.link_id);
}
/*!
* \brief Encode the SubaddressTransfer invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_etsi_SubaddressTransfer_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
return rose_enc_PartySubaddress(ctrl, pos, end,
&args->etsi.SubaddressTransfer.subaddress);
}
/*!
* \brief Encode the EctLinkIdRequest result facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_etsi_EctLinkIdRequest_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args)
{
return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
args->etsi.EctLinkIdRequest.link_id);
}
/*!
* \brief Encode the EctInform invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_etsi_EctInform_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
const struct roseEtsiEctInform_ARG *ect_inform;
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ect_inform = &args->etsi.EctInform;
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED, ect_inform->status));
if (ect_inform->redirection_present) {
ASN1_CALL(pos, rose_enc_PresentedNumberUnscreened(ctrl, pos, end,
&ect_inform->redirection));
}
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the EctLoopTest invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_etsi_EctLoopTest_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
return asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
args->etsi.EctLoopTest.call_transfer_id);
}
/*!
* \brief Encode the EctLoopTest result facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_etsi_EctLoopTest_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args)
{
return asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
args->etsi.EctLoopTest.loop_result);
}
/*!
* \brief Decode the ExplicitEctExecute invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_etsi_ExplicitEctExecute_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int32_t value;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
ASN1_CALL(pos, asn1_dec_int(ctrl, "linkId", tag, pos, end, &value));
args->etsi.ExplicitEctExecute.link_id = value;
return pos;
}
/*!
* \brief Decode the SubaddressTransfer invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_etsi_SubaddressTransfer_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
return rose_dec_PartySubaddress(ctrl, "transferredToSubaddress", tag, pos, end,
&args->etsi.SubaddressTransfer.subaddress);
}
/*!
* \brief Decode the EctLinkIdRequest result argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_etsi_EctLinkIdRequest_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
{
int32_t value;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
ASN1_CALL(pos, asn1_dec_int(ctrl, "linkId", tag, pos, end, &value));
args->etsi.EctLinkIdRequest.link_id = value;
return pos;
}
/*!
* \brief Decode the EctInform invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_etsi_EctInform_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
struct roseEtsiEctInform_ARG *ect_inform;
int length;
int seq_offset;
const unsigned char *seq_end;
int32_t value;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " EctInform %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ect_inform = &args->etsi.EctInform;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "callStatus", tag, pos, seq_end, &value));
ect_inform->status = value;
if (pos < seq_end && *pos != ASN1_INDEF_TERM) {
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PresentedNumberUnscreened(ctrl, "redirectionNumber", tag,
pos, seq_end, &ect_inform->redirection));
ect_inform->redirection_present = 1;
} else {
ect_inform->redirection_present = 0;
}
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the EctLoopTest invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_etsi_EctLoopTest_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int32_t value;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
ASN1_CALL(pos, asn1_dec_int(ctrl, "callTransferId", tag, pos, end, &value));
args->etsi.EctLoopTest.call_transfer_id = value;
return pos;
}
/*!
* \brief Decode the EctLoopTest result argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_etsi_EctLoopTest_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
{
int32_t value;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "loopResult", tag, pos, end, &value));
args->etsi.EctLoopTest.loop_result = value;
return pos;
}
/* ------------------------------------------------------------------- */
/* end rose_etsi_ect.c */

477
rose_internal.h Normal file
View File

@@ -0,0 +1,477 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief Internal definitions and prototypes for ROSE.
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#ifndef _LIBPRI_ROSE_INTERNAL_H
#define _LIBPRI_ROSE_INTERNAL_H
#include "rose.h"
#ifdef __cplusplus
extern "C" {
#endif
/* ------------------------------------------------------------------- */
/* Embedded-Q931-Types */
unsigned char *rose_enc_Q931ie(struct pri *ctrl, unsigned char *pos, unsigned char *end,
unsigned tag, const struct roseQ931ie *q931ie);
const unsigned char *rose_dec_Q931ie(struct pri *ctrl, const char *name, unsigned tag,
const unsigned char *pos, const unsigned char *end, struct roseQ931ie *q931ie,
size_t contents_size);
/* Addressing-Data-Elements */
unsigned char *rose_enc_PartyNumber(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePartyNumber *party_number);
unsigned char *rose_enc_PartySubaddress(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePartySubaddress *party_subaddress);
unsigned char *rose_enc_Address(struct pri *ctrl, unsigned char *pos, unsigned char *end,
unsigned tag, const struct roseAddress *address);
unsigned char *rose_enc_PresentedNumberUnscreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePresentedNumberUnscreened *party);
unsigned char *rose_enc_NumberScreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, unsigned tag, const struct roseNumberScreened *screened);
unsigned char *rose_enc_PresentedNumberScreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePresentedNumberScreened *party);
unsigned char *rose_enc_AddressScreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, unsigned tag, const struct roseAddressScreened *screened);
unsigned char *rose_enc_PresentedAddressScreened(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct rosePresentedAddressScreened *party);
const unsigned char *rose_dec_PartyNumber(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartyNumber *party_number);
const unsigned char *rose_dec_PartySubaddress(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePartySubaddress *party_subaddress);
const unsigned char *rose_dec_Address(struct pri *ctrl, const char *name, unsigned tag,
const unsigned char *pos, const unsigned char *end, struct roseAddress *address);
const unsigned char *rose_dec_PresentedNumberUnscreened(struct pri *ctrl,
const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePresentedNumberUnscreened *party);
const unsigned char *rose_dec_NumberScreened(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseNumberScreened *screened);
const unsigned char *rose_dec_PresentedNumberScreened(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePresentedNumberScreened *party);
const unsigned char *rose_dec_AddressScreened(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseAddressScreened *screened);
const unsigned char *rose_dec_PresentedAddressScreened(struct pri *ctrl,
const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
struct rosePresentedAddressScreened *party);
/* ETSI Advice-of-Charge (AOC) */
unsigned char *rose_enc_etsi_ChargingRequest_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_ChargingRequest_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_etsi_AOCSCurrency_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_AOCSSpecialArr_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_AOCDCurrency_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_AOCDChargingUnit_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_AOCECurrency_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_AOCEChargingUnit_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_ChargingRequest_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_ChargingRequest_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_etsi_AOCSCurrency_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_AOCSSpecialArr_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_AOCDCurrency_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_AOCDChargingUnit_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_AOCECurrency_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_AOCEChargingUnit_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
/* ETSI Call Diversion */
unsigned char *rose_enc_etsi_ActivationDiversion_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_DeactivationDiversion_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_ActivationStatusNotificationDiv_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_DeactivationStatusNotificationDiv_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_InterrogationDiversion_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_InterrogationDiversion_RES(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_etsi_DiversionInformation_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_CallDeflection_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_CallRerouting_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_InterrogateServedUserNumbers_RES(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_etsi_DivertingLegInformation1_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_DivertingLegInformation2_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_DivertingLegInformation3_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_ActivationDiversion_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_DeactivationDiversion_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_ActivationStatusNotificationDiv_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_DeactivationStatusNotificationDiv_ARG(struct pri
*ctrl, unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_InterrogationDiversion_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_InterrogationDiversion_RES(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_etsi_DiversionInformation_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_CallDeflection_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_CallRerouting_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_InterrogateServedUserNumbers_RES(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_etsi_DivertingLegInformation1_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_DivertingLegInformation2_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_DivertingLegInformation3_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
/* ETSI Explicit Call Transfer (ECT) */
unsigned char *rose_enc_etsi_ExplicitEctExecute_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_SubaddressTransfer_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_EctLinkIdRequest_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_etsi_EctInform_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_EctLoopTest_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_etsi_EctLoopTest_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args);
const unsigned char *rose_dec_etsi_ExplicitEctExecute_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_SubaddressTransfer_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_EctLinkIdRequest_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_etsi_EctInform_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_EctLoopTest_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_etsi_EctLoopTest_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
/* Q.SIG Name-Operations */
unsigned char *rose_enc_qsig_Name(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct roseQsigName *name);
const unsigned char *rose_dec_qsig_Name(struct pri *ctrl, const char *fname,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseQsigName *name);
unsigned char *rose_enc_qsig_CallingName_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_CalledName_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_ConnectedName_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_BusyName_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_CallingName_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_CalledName_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_ConnectedName_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_BusyName_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
/*
* Q.SIG Dummy invoke/result argument used by:
* SS-AOC-Operations,
* Call-Transfer-Operations,
* Call-Diversion-Operations,
* and SS-MWI-Operations.
*/
unsigned char *rose_enc_qsig_DummyArg_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_DummyRes_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args);
const unsigned char *rose_dec_qsig_DummyArg_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_DummyRes_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
/* Q.SIG SS-AOC-Operations */
unsigned char *rose_enc_qsig_ChargeRequest_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_ChargeRequest_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_qsig_AocFinal_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_AocInterim_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_AocRate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_AocComplete_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_AocComplete_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_qsig_AocDivChargeReq_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_ChargeRequest_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_ChargeRequest_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_qsig_AocFinal_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_AocInterim_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_AocRate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_AocComplete_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_AocComplete_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_qsig_AocDivChargeReq_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
/* Q.SIG Call-Diversion-Operations */
unsigned char *rose_enc_qsig_ActivateDiversionQ_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_DeactivateDiversionQ_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_InterrogateDiversionQ_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_InterrogateDiversionQ_RES(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_qsig_CheckRestriction_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_CallRerouting_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_DivertingLegInformation1_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_DivertingLegInformation2_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_DivertingLegInformation3_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_ActivateDiversionQ_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_DeactivateDiversionQ_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_InterrogateDiversionQ_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_InterrogateDiversionQ_RES(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_qsig_CheckRestriction_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_CallRerouting_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_DivertingLegInformation1_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_DivertingLegInformation2_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_DivertingLegInformation3_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
/* Q.SIG Call-Transfer-Operations (CT) */
unsigned char *rose_enc_qsig_CallTransferIdentify_RES(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_qsig_CallTransferInitiate_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_CallTransferSetup_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_CallTransferActive_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_CallTransferComplete_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_CallTransferUpdate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_SubaddressTransfer_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_CallTransferIdentify_RES(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_qsig_CallTransferInitiate_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_CallTransferSetup_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_CallTransferActive_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_CallTransferComplete_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_CallTransferUpdate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_SubaddressTransfer_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
/* Q.SIG SS-MWI-Operations */
unsigned char *rose_enc_qsig_MWIActivate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_MWIDeactivate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_MWIInterrogate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_qsig_MWIInterrogate_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args);
const unsigned char *rose_dec_qsig_MWIActivate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_MWIDeactivate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_MWIInterrogate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_qsig_MWIInterrogate_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
/* Northern Telecom DMS-100 operations */
unsigned char *rose_enc_dms100_RLT_OperationInd_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args);
unsigned char *rose_enc_dms100_RLT_ThirdParty_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
const unsigned char *rose_dec_dms100_RLT_OperationInd_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args);
const unsigned char *rose_dec_dms100_RLT_ThirdParty_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
/* National ISDN 2 (NI2) operations */
unsigned char *rose_enc_ni2_InformationFollowing_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args);
unsigned char *rose_enc_ni2_InitiateTransfer_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args);
const unsigned char *rose_dec_ni2_InformationFollowing_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
const unsigned char *rose_dec_ni2_InitiateTransfer_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args);
/* ------------------------------------------------------------------- */
#ifdef __cplusplus
}
#endif
#endif /* _LIBPRI_ROSE_INTERNAL_H */
/* ------------------------------------------------------------------- */
/* end rose_internal.h */

277
rose_other.c Normal file
View File

@@ -0,0 +1,277 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief Switch type operations for: NI2, 4ESS, 5ESS, DMS-100
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#include "compat.h"
#include "libpri.h"
#include "pri_internal.h"
#include "rose.h"
#include "rose_internal.h"
#include "asn1.h"
/* ------------------------------------------------------------------- */
/*!
* \brief Encode the DMS-100 RLT_OperationInd result facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_dms100_RLT_OperationInd_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args)
{
return asn1_enc_int(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 0,
args->dms100.RLT_OperationInd.call_id);
}
/*!
* \brief Encode the DMS-100 RLT_ThirdParty invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_dms100_RLT_ThirdParty_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
const struct roseDms100RLTThirdParty_ARG *rlt_thirdparty;
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
rlt_thirdparty = &args->dms100.RLT_ThirdParty;
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 0,
rlt_thirdparty->call_id));
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 1,
rlt_thirdparty->reason));
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Decode the DMS-100 RLT_OperationInd result argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_dms100_RLT_OperationInd_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
{
int32_t value;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_CLASS_CONTEXT_SPECIFIC | 0);
ASN1_CALL(pos, asn1_dec_int(ctrl, "callId", tag, pos, end, &value));
args->dms100.RLT_OperationInd.call_id = value;
return pos;
}
/*!
* \brief Decode the DMS-100 RLT_ThirdParty invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_dms100_RLT_ThirdParty_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
struct roseDms100RLTThirdParty_ARG *rlt_third_party;
rlt_third_party = &args->dms100.RLT_ThirdParty;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " RLT_ThirdParty %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_CLASS_CONTEXT_SPECIFIC | 0);
ASN1_CALL(pos, asn1_dec_int(ctrl, "callId", tag, pos, seq_end, &value));
rlt_third_party->call_id = value;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_CLASS_CONTEXT_SPECIFIC | 1);
ASN1_CALL(pos, asn1_dec_int(ctrl, "reason", tag, pos, seq_end, &value));
rlt_third_party->reason = value;
/* Fixup will skip over any OPTIONAL information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Encode the NI2 InformationFollowing invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_ni2_InformationFollowing_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args)
{
/* Encode the unknown enumeration value. */
return asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
args->ni2.InformationFollowing.value);
}
/*!
* \brief Encode the NI2 InitiateTransfer invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_ni2_InitiateTransfer_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
const struct roseNi2InitiateTransfer_ARG *initiate_transfer;
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
initiate_transfer = &args->ni2.InitiateTransfer;
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER,
initiate_transfer->call_reference));
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Decode the NI2 InformationFollowing invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_ni2_InformationFollowing_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args)
{
int32_t value;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "unknown", tag, pos, end, &value));
args->ni2.InformationFollowing.value = value;
return pos;
}
/*!
* \brief Decode the NI2 InitiateTransfer invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_ni2_InitiateTransfer_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
struct roseNi2InitiateTransfer_ARG *initiate_transfer;
initiate_transfer = &args->ni2.InitiateTransfer;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " InitiateTransfer %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
ASN1_CALL(pos, asn1_dec_int(ctrl, "callReference", tag, pos, seq_end, &value));
initiate_transfer->call_reference = value;
/* Fixup will skip over any OPTIONAL information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/* ------------------------------------------------------------------- */
/* end rose_other.c */

100
rose_q931.c Normal file
View File

@@ -0,0 +1,100 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief ROSE Q.931 ie encode/decode functions
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#include "compat.h"
#include "libpri.h"
#include "pri_internal.h"
#include "rose.h"
#include "rose_internal.h"
#include "asn1.h"
/* ------------------------------------------------------------------- */
/*!
* \brief Encode the Q.931 ie value.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param tag Component tag to identify the encoded component.
* The tag should be ASN1_CLASS_APPLICATION | 0 unless the caller
* implicitly tags it otherwise.
* \param q931ie Q931 ie information to encode.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_Q931ie(struct pri *ctrl, unsigned char *pos, unsigned char *end,
unsigned tag, const struct roseQ931ie *q931ie)
{
return asn1_enc_string_bin(pos, end, tag, q931ie->contents, q931ie->length);
}
/*!
* \brief Decode the Q.931 ie value.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param q931ie Parameter storage to fill.
* \param contents_size Amount of space "allocated" for the q931ie->contents
* element. Must have enough room for a null terminator.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_Q931ie(struct pri *ctrl, const char *name, unsigned tag,
const unsigned char *pos, const unsigned char *end, struct roseQ931ie *q931ie,
size_t contents_size)
{
size_t str_len;
/* NOTE: The q931ie->contents memory is "allocated" after the struct. */
ASN1_CALL(pos, asn1_dec_string_bin(ctrl, name, tag, pos, end, contents_size,
q931ie->contents, &str_len));
q931ie->length = str_len;
/*
* NOTE: We may want to do some basic decoding of the Q.931 ie list
* for debug purposes.
*/
return pos;
}
/* ------------------------------------------------------------------- */
/* end rose_q931.c */

1714
rose_qsig_aoc.c Normal file

File diff suppressed because it is too large Load Diff

883
rose_qsig_ct.c Normal file
View File

@@ -0,0 +1,883 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief Q.SIG ROSE Call-Transfer-Operations (CT)
*
* Call-Transfer-Operations ECMA-178 Annex F Table F.1
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#include "compat.h"
#include "libpri.h"
#include "pri_internal.h"
#include "rose.h"
#include "rose_internal.h"
#include "asn1.h"
/* ------------------------------------------------------------------- */
/*!
* \brief Encode the Q.SIG CallTransferIdentify result facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_CallTransferIdentify_RES(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_result_args *args)
{
unsigned char *seq_len;
const struct roseQsigCTIdentifyRes_RES *call_transfer_identify;
call_transfer_identify = &args->qsig.CallTransferIdentify;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, asn1_enc_string_max(pos, end, ASN1_TYPE_NUMERIC_STRING,
call_transfer_identify->call_id, sizeof(call_transfer_identify->call_id) - 1));
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end,
&call_transfer_identify->rerouting_number));
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the Q.SIG CallTransferInitiate invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_CallTransferInitiate_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args)
{
unsigned char *seq_len;
const struct roseQsigCTInitiateArg_ARG *call_transfer_initiate;
call_transfer_initiate = &args->qsig.CallTransferInitiate;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, asn1_enc_string_max(pos, end, ASN1_TYPE_NUMERIC_STRING,
call_transfer_initiate->call_id, sizeof(call_transfer_initiate->call_id) - 1));
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end,
&call_transfer_initiate->rerouting_number));
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the Q.SIG CallTransferSetup invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_CallTransferSetup_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
unsigned char *seq_len;
const struct roseQsigCTSetupArg_ARG *call_transfer_setup;
call_transfer_setup = &args->qsig.CallTransferSetup;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, asn1_enc_string_max(pos, end, ASN1_TYPE_NUMERIC_STRING,
call_transfer_setup->call_id, sizeof(call_transfer_setup->call_id) - 1));
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the Q.SIG CallTransferActive invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_CallTransferActive_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
unsigned char *seq_len;
const struct roseQsigCTActiveArg_ARG *call_transfer_active;
call_transfer_active = &args->qsig.CallTransferActive;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, rose_enc_PresentedAddressScreened(ctrl, pos, end,
&call_transfer_active->connected));
if (call_transfer_active->q931ie.length) {
ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
&call_transfer_active->q931ie));
}
if (call_transfer_active->connected_name_present) {
ASN1_CALL(pos, rose_enc_qsig_Name(ctrl, pos, end,
&call_transfer_active->connected_name));
}
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the Q.SIG CallTransferComplete invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_CallTransferComplete_ARG(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const union rose_msg_invoke_args *args)
{
unsigned char *seq_len;
const struct roseQsigCTCompleteArg_ARG *call_transfer_complete;
call_transfer_complete = &args->qsig.CallTransferComplete;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
call_transfer_complete->end_designation));
ASN1_CALL(pos, rose_enc_PresentedNumberScreened(ctrl, pos, end,
&call_transfer_complete->redirection));
if (call_transfer_complete->q931ie.length) {
ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
&call_transfer_complete->q931ie));
}
if (call_transfer_complete->redirection_name_present) {
ASN1_CALL(pos, rose_enc_qsig_Name(ctrl, pos, end,
&call_transfer_complete->redirection_name));
}
if (call_transfer_complete->call_status) {
/* Not the DEFAULT value */
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
call_transfer_complete->call_status));
}
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the Q.SIG CallTransferUpdate invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_CallTransferUpdate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
unsigned char *seq_len;
const struct roseQsigCTUpdateArg_ARG *call_transfer_update;
call_transfer_update = &args->qsig.CallTransferUpdate;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, rose_enc_PresentedNumberScreened(ctrl, pos, end,
&call_transfer_update->redirection));
if (call_transfer_update->redirection_name_present) {
ASN1_CALL(pos, rose_enc_qsig_Name(ctrl, pos, end,
&call_transfer_update->redirection_name));
}
if (call_transfer_update->q931ie.length) {
ASN1_CALL(pos, rose_enc_Q931ie(ctrl, pos, end, ASN1_CLASS_APPLICATION | 0,
&call_transfer_update->q931ie));
}
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the Q.SIG SubaddressTransfer invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_SubaddressTransfer_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
unsigned char *seq_len;
const struct roseQsigSubaddressTransferArg_ARG *subaddress_transfer;
subaddress_transfer = &args->qsig.SubaddressTransfer;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, rose_enc_PartySubaddress(ctrl, pos, end,
&subaddress_transfer->redirection_subaddress));
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the Q.SIG DummyArg invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*
* \details
* DummyArg ::= CHOICE {
* none NULL,
* extension [1] IMPLICIT Extension,
* multipleExtension [2] IMPLICIT SEQUENCE OF Extension
* }
*/
unsigned char *rose_enc_qsig_DummyArg_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
return asn1_enc_null(pos, end, ASN1_TYPE_NULL);
}
/*!
* \brief Encode the Q.SIG DummyRes result facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*
* \details
* DummyRes ::= CHOICE {
* none NULL,
* extension [1] IMPLICIT Extension,
* multipleExtension [2] IMPLICIT SEQUENCE OF Extension
* }
*/
unsigned char *rose_enc_qsig_DummyRes_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args)
{
return asn1_enc_null(pos, end, ASN1_TYPE_NULL);
}
/*!
* \brief Decode the Q.SIG CallTransferIdentify result argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_CallTransferIdentify_RES(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_result_args *args)
{
size_t str_len;
int length;
int seq_offset;
const unsigned char *seq_end;
struct roseQsigCTIdentifyRes_RES *call_transfer_identify;
call_transfer_identify = &args->qsig.CallTransferIdentify;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " CallTransferIdentify %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag & ~ASN1_PC_MASK, tag, ASN1_TYPE_NUMERIC_STRING);
ASN1_CALL(pos, asn1_dec_string_max(ctrl, "callIdentity", tag, pos, seq_end,
sizeof(call_transfer_identify->call_id), call_transfer_identify->call_id,
&str_len));
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "reroutingNumber", tag, pos, seq_end,
&call_transfer_identify->rerouting_number));
/* Fixup will skip over any OPTIONAL manufacturer extension information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG CallTransferInitiate invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_CallTransferInitiate_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args)
{
size_t str_len;
int length;
int seq_offset;
const unsigned char *seq_end;
struct roseQsigCTInitiateArg_ARG *call_transfer_initiate;
call_transfer_initiate = &args->qsig.CallTransferInitiate;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " CallTransferInitiate %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag & ~ASN1_PC_MASK, tag, ASN1_TYPE_NUMERIC_STRING);
ASN1_CALL(pos, asn1_dec_string_max(ctrl, "callIdentity", tag, pos, seq_end,
sizeof(call_transfer_initiate->call_id), call_transfer_initiate->call_id,
&str_len));
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "reroutingNumber", tag, pos, seq_end,
&call_transfer_initiate->rerouting_number));
/* Fixup will skip over any OPTIONAL manufacturer extension information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG CallTransferSetup invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_CallTransferSetup_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
size_t str_len;
int length;
int seq_offset;
const unsigned char *seq_end;
struct roseQsigCTSetupArg_ARG *call_transfer_setup;
call_transfer_setup = &args->qsig.CallTransferSetup;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " CallTransferSetup %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag & ~ASN1_PC_MASK, tag, ASN1_TYPE_NUMERIC_STRING);
ASN1_CALL(pos, asn1_dec_string_max(ctrl, "callIdentity", tag, pos, seq_end,
sizeof(call_transfer_setup->call_id), call_transfer_setup->call_id, &str_len));
/* Fixup will skip over any OPTIONAL manufacturer extension information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG CallTransferActive invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_CallTransferActive_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int length;
int seq_offset;
const unsigned char *seq_end;
const unsigned char *save_pos;
struct roseQsigCTActiveArg_ARG *call_transfer_active;
call_transfer_active = &args->qsig.CallTransferActive;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " CallTransferActive %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PresentedAddressScreened(ctrl, "connectedAddress", tag, pos,
seq_end, &call_transfer_active->connected));
/*
* A sequence specifies an ordered list of component types.
* However, for simplicity we are not checking the order of
* the remaining optional components.
*/
call_transfer_active->q931ie.length = 0;
call_transfer_active->connected_name_present = 0;
while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
save_pos = pos;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_APPLICATION | 0:
ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "basicCallInfoElements", tag, pos,
seq_end, &call_transfer_active->q931ie,
sizeof(call_transfer_active->q931ie_contents)));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
case ASN1_CLASS_CONTEXT_SPECIFIC | 7:
ASN1_CALL(pos, rose_dec_qsig_Name(ctrl, "connectedName", tag, pos, seq_end,
&call_transfer_active->connected_name));
call_transfer_active->connected_name_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 9:
case ASN1_CLASS_CONTEXT_SPECIFIC | 10:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " argumentExtension %s\n", asn1_tag2str(tag));
}
/* Fixup will skip over the manufacturer extension information */
default:
pos = save_pos;
goto cancel_options;
}
}
cancel_options:;
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG CallTransferComplete invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_CallTransferComplete_ARG(struct pri *ctrl,
unsigned tag, const unsigned char *pos, const unsigned char *end,
union rose_msg_invoke_args *args)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
const unsigned char *save_pos;
struct roseQsigCTCompleteArg_ARG *call_transfer_complete;
call_transfer_complete = &args->qsig.CallTransferComplete;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " CallTransferComplete %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "endDesignation", tag, pos, seq_end, &value));
call_transfer_complete->end_designation = value;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PresentedNumberScreened(ctrl, "redirectionNumber", tag, pos,
seq_end, &call_transfer_complete->redirection));
/*
* A sequence specifies an ordered list of component types.
* However, for simplicity we are not checking the order of
* the remaining optional components.
*/
call_transfer_complete->q931ie.length = 0;
call_transfer_complete->redirection_name_present = 0;
call_transfer_complete->call_status = 0; /* DEFAULT answered */
while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
save_pos = pos;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_APPLICATION | 0:
ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "basicCallInfoElements", tag, pos,
seq_end, &call_transfer_complete->q931ie,
sizeof(call_transfer_complete->q931ie_contents)));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
case ASN1_CLASS_CONTEXT_SPECIFIC | 7:
ASN1_CALL(pos, rose_dec_qsig_Name(ctrl, "redirectionName", tag, pos, seq_end,
&call_transfer_complete->redirection_name));
call_transfer_complete->redirection_name_present = 1;
break;
case ASN1_TYPE_ENUMERATED:
/* Must not be constructed but we will not check for it for simplicity. */
ASN1_CALL(pos, asn1_dec_int(ctrl, "callStatus", tag, pos, seq_end, &value));
call_transfer_complete->call_status = value;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 9:
case ASN1_CLASS_CONTEXT_SPECIFIC | 10:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " argumentExtension %s\n", asn1_tag2str(tag));
}
/* Fixup will skip over the manufacturer extension information */
default:
pos = save_pos;
goto cancel_options;
}
}
cancel_options:;
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG CallTransferUpdate invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_CallTransferUpdate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int length;
int seq_offset;
const unsigned char *seq_end;
const unsigned char *save_pos;
struct roseQsigCTUpdateArg_ARG *call_transfer_update;
call_transfer_update = &args->qsig.CallTransferUpdate;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " CallTransferUpdate %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PresentedNumberScreened(ctrl, "redirectionNumber", tag, pos,
seq_end, &call_transfer_update->redirection));
/*
* A sequence specifies an ordered list of component types.
* However, for simplicity we are not checking the order of
* the remaining optional components.
*/
call_transfer_update->redirection_name_present = 0;
call_transfer_update->q931ie.length = 0;
while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
save_pos = pos;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
case ASN1_CLASS_CONTEXT_SPECIFIC | 7:
ASN1_CALL(pos, rose_dec_qsig_Name(ctrl, "redirectionName", tag, pos, seq_end,
&call_transfer_update->redirection_name));
call_transfer_update->redirection_name_present = 1;
break;
case ASN1_CLASS_APPLICATION | 0:
ASN1_CALL(pos, rose_dec_Q931ie(ctrl, "basicCallInfoElements", tag, pos,
seq_end, &call_transfer_update->q931ie,
sizeof(call_transfer_update->q931ie_contents)));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 9:
case ASN1_CLASS_CONTEXT_SPECIFIC | 10:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " argumentExtension %s\n", asn1_tag2str(tag));
}
/* Fixup will skip over the manufacturer extension information */
default:
pos = save_pos;
goto cancel_options;
}
}
cancel_options:;
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG SubaddressTransfer invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_SubaddressTransfer_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int length;
int seq_offset;
const unsigned char *seq_end;
struct roseQsigSubaddressTransferArg_ARG *subaddress_transfer;
subaddress_transfer = &args->qsig.SubaddressTransfer;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " SubaddressTransfer %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartySubaddress(ctrl, "redirectionSubaddress", tag, pos,
seq_end, &subaddress_transfer->redirection_subaddress));
/* Fixup will skip over any OPTIONAL manufacturer extension information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG DummyArg invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*
* \details
* DummyArg ::= CHOICE {
* none NULL,
* extension [1] IMPLICIT Extension,
* multipleExtension [2] IMPLICIT SEQUENCE OF Extension
* }
*/
const unsigned char *rose_dec_qsig_DummyArg_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
const char *name;
int length;
int seq_offset;
const unsigned char *seq_end;
switch (tag) {
case ASN1_TYPE_NULL:
return asn1_dec_null(ctrl, "none", tag, pos, end);
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 1:
name = "extension Extension";
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 2:
name = "multipleExtension SEQUENCE OF Extension";
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s %s\n", name, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
/* Fixup will skip over the manufacturer extension information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG DummyRes result argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*
* \details
* DummyRes ::= CHOICE {
* none NULL,
* extension [1] IMPLICIT Extension,
* multipleExtension [2] IMPLICIT SEQUENCE OF Extension
* }
*/
const unsigned char *rose_dec_qsig_DummyRes_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
{
const char *name;
int length;
int seq_offset;
const unsigned char *seq_end;
switch (tag) {
case ASN1_TYPE_NULL:
return asn1_dec_null(ctrl, "none", tag, pos, end);
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 1:
name = "extension Extension";
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 2:
name = "multipleExtension SEQUENCE OF Extension";
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s %s\n", name, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
/* Fixup will skip over the manufacturer extension information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/* ------------------------------------------------------------------- */
/* end rose_qsig_ct.c */

1390
rose_qsig_diversion.c Normal file

File diff suppressed because it is too large Load Diff

790
rose_qsig_mwi.c Normal file
View File

@@ -0,0 +1,790 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief Q.SIG ROSE SS-MWI-Operations
*
* SS-MWI-Operations ECMA-242 Annex E Table E.1
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#include "compat.h"
#include "libpri.h"
#include "pri_internal.h"
#include "rose.h"
#include "rose_internal.h"
#include "asn1.h"
/* ------------------------------------------------------------------- */
/*!
* \internal
* \brief Encode the MsgCentreId type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param msg_centre_id
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
static unsigned char *rose_enc_qsig_MsgCentreId(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct roseQsigMsgCentreId *msg_centre_id)
{
unsigned char *seq_len;
switch (msg_centre_id->type) {
case 0: /* integer */
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 0,
msg_centre_id->u.integer));
break;
case 1: /* partyNumber */
/* EXPLICIT tag */
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 1);
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end, &msg_centre_id->u.number));
ASN1_CONSTRUCTED_END(seq_len, pos, end);
break;
case 2: /* numericString */
ASN1_CALL(pos, asn1_enc_string_max(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 2,
msg_centre_id->u.str, sizeof(msg_centre_id->u.str) - 1));
break;
default:
ASN1_ENC_ERROR(ctrl, "Unknown MsgCentreId type");
return NULL;
}
return pos;
}
/*!
* \brief Encode the MWIActivate invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_MWIActivate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
const struct roseQsigMWIActivateArg *mwi_activate;
unsigned char *seq_len;
unsigned char *explicit_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
mwi_activate = &args->qsig.MWIActivate;
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end,
&mwi_activate->served_user_number));
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
mwi_activate->basic_service));
if (mwi_activate->msg_centre_id_present) {
ASN1_CALL(pos, rose_enc_qsig_MsgCentreId(ctrl, pos, end,
&mwi_activate->msg_centre_id));
}
if (mwi_activate->number_of_messages_present) {
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 3,
mwi_activate->number_of_messages));
}
if (mwi_activate->originating_number.length) {
/* EXPLICIT tag */
ASN1_CONSTRUCTED_BEGIN(explicit_len, pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 4);
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end,
&mwi_activate->originating_number));
ASN1_CONSTRUCTED_END(explicit_len, pos, end);
}
if (mwi_activate->timestamp_present) {
ASN1_CALL(pos, asn1_enc_string_max(pos, end, ASN1_TYPE_GENERALIZED_TIME,
mwi_activate->timestamp, sizeof(mwi_activate->timestamp) - 1));
}
if (mwi_activate->priority_present) {
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 5,
mwi_activate->priority));
}
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the MWIDeactivate invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_MWIDeactivate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
const struct roseQsigMWIDeactivateArg *mwi_deactivate;
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
mwi_deactivate = &args->qsig.MWIDeactivate;
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end,
&mwi_deactivate->served_user_number));
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
mwi_deactivate->basic_service));
if (mwi_deactivate->msg_centre_id_present) {
ASN1_CALL(pos, rose_enc_qsig_MsgCentreId(ctrl, pos, end,
&mwi_deactivate->msg_centre_id));
}
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the MWIInterrogate invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_MWIInterrogate_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
const struct roseQsigMWIInterrogateArg *mwi_interrogate;
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
mwi_interrogate = &args->qsig.MWIInterrogate;
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end,
&mwi_interrogate->served_user_number));
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED,
mwi_interrogate->basic_service));
if (mwi_interrogate->msg_centre_id_present) {
ASN1_CALL(pos, rose_enc_qsig_MsgCentreId(ctrl, pos, end,
&mwi_interrogate->msg_centre_id));
}
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \internal
* \brief Encode the MWIInterrogateResElt type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param tag Component tag to identify the encoded component.
* The tag should be ASN1_TAG_SEQUENCE unless the caller implicitly
* tags it otherwise.
* \param record
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
static unsigned char *rose_enc_qsig_MWIInterrogateResElt(struct pri *ctrl,
unsigned char *pos, unsigned char *end, unsigned tag,
const struct roseQsigMWIInterrogateResElt *record)
{
unsigned char *seq_len;
unsigned char *explicit_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, tag);
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_ENUMERATED, record->basic_service));
if (record->msg_centre_id_present) {
ASN1_CALL(pos, rose_enc_qsig_MsgCentreId(ctrl, pos, end,
&record->msg_centre_id));
}
if (record->number_of_messages_present) {
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 3,
record->number_of_messages));
}
if (record->originating_number.length) {
/* EXPLICIT tag */
ASN1_CONSTRUCTED_BEGIN(explicit_len, pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 4);
ASN1_CALL(pos, rose_enc_PartyNumber(ctrl, pos, end,
&record->originating_number));
ASN1_CONSTRUCTED_END(explicit_len, pos, end);
}
if (record->timestamp_present) {
ASN1_CALL(pos, asn1_enc_string_max(pos, end, ASN1_TYPE_GENERALIZED_TIME,
record->timestamp, sizeof(record->timestamp) - 1));
}
if (record->priority_present) {
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 5,
record->priority));
}
/* No extension to encode */
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the MWIInterrogate result facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_MWIInterrogate_RES(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_result_args *args)
{
unsigned index;
unsigned char *seq_len;
const struct roseQsigMWIInterrogateRes *mwi_interrogate;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, ASN1_TAG_SEQUENCE);
mwi_interrogate = &args->qsig.MWIInterrogate;
for (index = 0; index < mwi_interrogate->num_records; ++index) {
ASN1_CALL(pos, rose_enc_qsig_MWIInterrogateResElt(ctrl, pos, end,
ASN1_TAG_SEQUENCE, &mwi_interrogate->list[index]));
}
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \internal
* \brief Decode the MsgCentreId argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param msg_centre_id Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_qsig_MsgCentreId(struct pri *ctrl, const char *name,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseQsigMsgCentreId *msg_centre_id)
{
int32_t value;
size_t str_len;
int length;
int explicit_offset;
const unsigned char *explicit_end;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s MsgCentreId\n", name);
}
switch (tag) {
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
msg_centre_id->type = 0; /* integer */
ASN1_CALL(pos, asn1_dec_int(ctrl, "integer", tag, pos, end, &value));
msg_centre_id->u.integer = value;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 1:
msg_centre_id->type = 1; /* partyNumber */
/* Remove EXPLICIT tag */
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " Explicit %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(explicit_end, explicit_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, explicit_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "partyNumber", tag, pos, explicit_end,
&msg_centre_id->u.number));
ASN1_END_FIXUP(ctrl, pos, explicit_offset, explicit_end, end);
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
case ASN1_CLASS_CONTEXT_SPECIFIC | ASN1_PC_CONSTRUCTED | 2:
msg_centre_id->type = 2; /* numericString */
ASN1_CALL(pos, asn1_dec_string_max(ctrl, "numericString", tag, pos, end,
sizeof(msg_centre_id->u.str), msg_centre_id->u.str, &str_len));
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
return pos;
}
/*!
* \brief Decode the Q.SIG MWIActivate invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_MWIActivate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int32_t value;
size_t str_len;
int length;
int seq_offset;
int explicit_offset;
const unsigned char *explicit_end;
const unsigned char *seq_end;
const unsigned char *save_pos;
struct roseQsigMWIActivateArg *mwi_activate;
mwi_activate = &args->qsig.MWIActivate;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " MWIActivateArg %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "servedUserNr", tag, pos, seq_end,
&mwi_activate->served_user_number));
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "basicService", tag, pos, seq_end, &value));
mwi_activate->basic_service = value;
/*
* A sequence specifies an ordered list of component types.
* However, for simplicity we are not checking the order of
* the remaining optional components.
*/
mwi_activate->msg_centre_id_present = 0;
mwi_activate->number_of_messages_present = 0;
mwi_activate->originating_number.length = 0;
mwi_activate->timestamp_present = 0;
mwi_activate->priority_present = 0;
while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
save_pos = pos;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
ASN1_CALL(pos, rose_dec_qsig_MsgCentreId(ctrl, "msgCentreId", tag, pos,
seq_end, &mwi_activate->msg_centre_id));
mwi_activate->msg_centre_id_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
/* Must not be constructed but we will not check for it for simplicity. */
ASN1_CALL(pos, asn1_dec_int(ctrl, "nbOfMessages", tag, pos, seq_end,
&value));
mwi_activate->number_of_messages = value;
mwi_activate->number_of_messages_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
/* Must be constructed but we will not check for it for simplicity. */
/* Remove EXPLICIT tag */
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " Explicit %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, seq_end, &length));
ASN1_END_SETUP(explicit_end, explicit_offset, length, pos, seq_end);
ASN1_CALL(pos, asn1_dec_tag(pos, explicit_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "originatingNr", tag, pos,
explicit_end, &mwi_activate->originating_number));
ASN1_END_FIXUP(ctrl, pos, explicit_offset, explicit_end, seq_end);
break;
case ASN1_TYPE_GENERALIZED_TIME:
ASN1_CALL(pos, asn1_dec_string_max(ctrl, "timestamp", tag, pos, end,
sizeof(mwi_activate->timestamp), mwi_activate->timestamp, &str_len));
mwi_activate->timestamp_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 5:
/* Must not be constructed but we will not check for it for simplicity. */
ASN1_CALL(pos, asn1_dec_int(ctrl, "priority", tag, pos, seq_end, &value));
mwi_activate->priority = value;
mwi_activate->priority_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 6:
case ASN1_CLASS_CONTEXT_SPECIFIC | 7:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " argumentExt %s\n", asn1_tag2str(tag));
}
/* Fixup will skip over the manufacturer extension information */
default:
pos = save_pos;
goto cancel_options;
}
}
cancel_options:;
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG MWIDeactivate invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_MWIDeactivate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
const unsigned char *save_pos;
struct roseQsigMWIDeactivateArg *mwi_deactivate;
mwi_deactivate = &args->qsig.MWIDeactivate;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " MWIDeactivateArg %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "servedUserNr", tag, pos, seq_end,
&mwi_deactivate->served_user_number));
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "basicService", tag, pos, seq_end, &value));
mwi_deactivate->basic_service = value;
/*
* A sequence specifies an ordered list of component types.
* However, for simplicity we are not checking the order of
* the remaining optional components.
*/
mwi_deactivate->msg_centre_id_present = 0;
while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
save_pos = pos;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
ASN1_CALL(pos, rose_dec_qsig_MsgCentreId(ctrl, "msgCentreId", tag, pos,
seq_end, &mwi_deactivate->msg_centre_id));
mwi_deactivate->msg_centre_id_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " argumentExt %s\n", asn1_tag2str(tag));
}
/* Fixup will skip over the manufacturer extension information */
default:
pos = save_pos;
goto cancel_options;
}
}
cancel_options:;
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG MWIInterrogate invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_MWIInterrogate_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
const unsigned char *save_pos;
struct roseQsigMWIInterrogateArg *mwi_interrogate;
mwi_interrogate = &args->qsig.MWIInterrogate;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " MWIInterrogateArg %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "servedUserNr", tag, pos, seq_end,
&mwi_interrogate->served_user_number));
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "basicService", tag, pos, seq_end, &value));
mwi_interrogate->basic_service = value;
/*
* A sequence specifies an ordered list of component types.
* However, for simplicity we are not checking the order of
* the remaining optional components.
*/
mwi_interrogate->msg_centre_id_present = 0;
while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
save_pos = pos;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
ASN1_CALL(pos, rose_dec_qsig_MsgCentreId(ctrl, "msgCentreId", tag, pos,
seq_end, &mwi_interrogate->msg_centre_id));
mwi_interrogate->msg_centre_id_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " argumentExt %s\n", asn1_tag2str(tag));
}
/* Fixup will skip over the manufacturer extension information */
default:
pos = save_pos;
goto cancel_options;
}
}
cancel_options:;
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \internal
* \brief Decode the MWIInterrogateResElt argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param name Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param record Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_qsig_MWIInterrogateResElt(struct pri *ctrl,
const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseQsigMWIInterrogateResElt *record)
{
int32_t value;
size_t str_len;
int length;
int seq_offset;
int explicit_offset;
const unsigned char *explicit_end;
const unsigned char *seq_end;
const unsigned char *save_pos;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " MWIInterrogateResElt %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_ENUMERATED);
ASN1_CALL(pos, asn1_dec_int(ctrl, "basicService", tag, pos, seq_end, &value));
record->basic_service = value;
/*
* A sequence specifies an ordered list of component types.
* However, for simplicity we are not checking the order of
* the remaining optional components.
*/
record->msg_centre_id_present = 0;
record->number_of_messages_present = 0;
record->originating_number.length = 0;
record->timestamp_present = 0;
record->priority_present = 0;
while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
save_pos = pos;
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
ASN1_CALL(pos, rose_dec_qsig_MsgCentreId(ctrl, "msgCentreId", tag, pos,
seq_end, &record->msg_centre_id));
record->msg_centre_id_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
/* Must not be constructed but we will not check for it for simplicity. */
ASN1_CALL(pos, asn1_dec_int(ctrl, "nbOfMessages", tag, pos, seq_end,
&value));
record->number_of_messages = value;
record->number_of_messages_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
/* Must be constructed but we will not check for it for simplicity. */
/* Remove EXPLICIT tag */
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " Explicit %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, seq_end, &length));
ASN1_END_SETUP(explicit_end, explicit_offset, length, pos, seq_end);
ASN1_CALL(pos, asn1_dec_tag(pos, explicit_end, &tag));
ASN1_CALL(pos, rose_dec_PartyNumber(ctrl, "originatingNr", tag, pos,
explicit_end, &record->originating_number));
ASN1_END_FIXUP(ctrl, pos, explicit_offset, explicit_end, seq_end);
break;
case ASN1_TYPE_GENERALIZED_TIME:
ASN1_CALL(pos, asn1_dec_string_max(ctrl, "timestamp", tag, pos, end,
sizeof(record->timestamp), record->timestamp, &str_len));
record->timestamp_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 5:
/* Must not be constructed but we will not check for it for simplicity. */
ASN1_CALL(pos, asn1_dec_int(ctrl, "priority", tag, pos, seq_end, &value));
record->priority = value;
record->priority_present = 1;
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 6:
case ASN1_CLASS_CONTEXT_SPECIFIC | 7:
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " argumentExt %s\n", asn1_tag2str(tag));
}
/* Fixup will skip over the manufacturer extension information */
default:
pos = save_pos;
goto cancel_options;
}
}
cancel_options:;
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG MWIInterrogate result argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_MWIInterrogate_RES(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_result_args *args)
{
int length;
int seq_offset;
const unsigned char *seq_end;
struct roseQsigMWIInterrogateRes *mwi_interrogate;
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " MWIInterrogateRes %s\n", asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
mwi_interrogate = &args->qsig.MWIInterrogate;
mwi_interrogate->num_records = 0;
while (pos < seq_end && *pos != ASN1_INDEF_TERM) {
if (mwi_interrogate->num_records < ARRAY_LEN(mwi_interrogate->list)) {
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TAG_SEQUENCE);
ASN1_CALL(pos, rose_dec_qsig_MWIInterrogateResElt(ctrl, "listEntry", tag,
pos, seq_end, &mwi_interrogate->list[mwi_interrogate->num_records]));
++mwi_interrogate->num_records;
} else {
/* Too many records */
return NULL;
}
}
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/* ------------------------------------------------------------------- */
/* end rose_qsig_mwi.c */

475
rose_qsig_name.c Normal file
View File

@@ -0,0 +1,475 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Copyright (C) 2009 Digium, Inc.
*
* Richard Mudgett <rmudgett@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*!
* \file
* \brief Q.SIG ROSE Name operations and elements
*
* Name-Operations ECMA-164 Annex C
*
* \author Richard Mudgett <rmudgett@digium.com>
*/
#include "compat.h"
#include "libpri.h"
#include "pri_internal.h"
#include "rose.h"
#include "rose_internal.h"
#include "asn1.h"
/* ------------------------------------------------------------------- */
/*!
* \internal
* \brief Encode the Q.SIG NameSet type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param tag Component tag to identify the encoded component.
* The tag should be ASN1_TAG_SEQUENCE unless the caller
* implicitly tags it otherwise.
* \param name
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
static unsigned char *rose_enc_qsig_NameSet(struct pri *ctrl, unsigned char *pos,
unsigned char *end, unsigned tag, const struct roseQsigName *name)
{
unsigned char *seq_len;
ASN1_CONSTRUCTED_BEGIN(seq_len, pos, end, tag);
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_TYPE_OCTET_STRING, name->data,
name->length));
ASN1_CALL(pos, asn1_enc_int(pos, end, ASN1_TYPE_INTEGER, name->char_set));
ASN1_CONSTRUCTED_END(seq_len, pos, end);
return pos;
}
/*!
* \brief Encode the Q.SIG Name type.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param name
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_Name(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const struct roseQsigName *name)
{
switch (name->presentation) {
case 0: /* optional_name_not_present */
/* Do not encode anything */
break;
case 1: /* presentation_allowed */
if (name->char_set == 1) {
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 0,
name->data, name->length));
} else {
ASN1_CALL(pos, rose_enc_qsig_NameSet(ctrl, pos, end,
ASN1_CLASS_CONTEXT_SPECIFIC | 1, name));
}
break;
case 2: /* presentation_restricted */
if (name->char_set == 1) {
ASN1_CALL(pos, asn1_enc_string_bin(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 2,
name->data, name->length));
} else {
ASN1_CALL(pos, rose_enc_qsig_NameSet(ctrl, pos, end,
ASN1_CLASS_CONTEXT_SPECIFIC | 3, name));
}
break;
case 3: /* presentation_restricted_null */
ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 7));
break;
case 4: /* name_not_available */
ASN1_CALL(pos, asn1_enc_null(pos, end, ASN1_CLASS_CONTEXT_SPECIFIC | 4));
break;
default:
ASN1_ENC_ERROR(ctrl, "Unknown name presentation");
return NULL;
}
return pos;
}
/*!
* \internal
* \brief Encode the Q.SIG party-Name invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param party Information to encode.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
static unsigned char *rose_enc_qsig_PartyName_ARG_Backend(struct pri *ctrl,
unsigned char *pos, unsigned char *end, const struct roseQsigPartyName_ARG *party)
{
return rose_enc_qsig_Name(ctrl, pos, end, &party->name);
}
/*!
* \brief Encode the Q.SIG CallingName invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_CallingName_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
return rose_enc_qsig_PartyName_ARG_Backend(ctrl, pos, end, &args->qsig.CallingName);
}
/*!
* \brief Encode the Q.SIG CalledName invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_CalledName_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
return rose_enc_qsig_PartyName_ARG_Backend(ctrl, pos, end, &args->qsig.CalledName);
}
/*!
* \brief Encode the Q.SIG ConnectedName invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_ConnectedName_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
return rose_enc_qsig_PartyName_ARG_Backend(ctrl, pos, end,
&args->qsig.ConnectedName);
}
/*!
* \brief Encode the Q.SIG BusyName invoke facility ie arguments.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param pos Starting position to encode ASN.1 component.
* \param end End of ASN.1 encoding data buffer.
* \param args Arguments to encode in the buffer.
*
* \retval Start of the next ASN.1 component to encode on success.
* \retval NULL on error.
*/
unsigned char *rose_enc_qsig_BusyName_ARG(struct pri *ctrl, unsigned char *pos,
unsigned char *end, const union rose_msg_invoke_args *args)
{
return rose_enc_qsig_PartyName_ARG_Backend(ctrl, pos, end, &args->qsig.BusyName);
}
/*!
* \internal
* \brief Decode the Q.SIG NameData Name argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param fname Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param name Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_qsig_NameData(struct pri *ctrl, const char *fname,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseQsigName *name)
{
size_t str_len;
ASN1_CALL(pos, asn1_dec_string_bin(ctrl, fname, tag, pos, end, sizeof(name->data),
name->data, &str_len));
name->length = str_len;
return pos;
}
/*!
* \internal
* \brief Decode the Q.SIG NameSet Name argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param fname Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param name Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_qsig_NameSet(struct pri *ctrl, const char *fname,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseQsigName *name)
{
int32_t value;
int length;
int seq_offset;
const unsigned char *seq_end;
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s NameSet %s\n", fname, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag & ~ASN1_PC_MASK, ASN1_TYPE_OCTET_STRING);
ASN1_CALL(pos, rose_dec_qsig_NameData(ctrl, "nameData", tag, pos, seq_end, name));
if (pos < end && *pos != ASN1_INDEF_TERM) {
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CHECK_TAG(ctrl, tag, tag, ASN1_TYPE_INTEGER);
ASN1_CALL(pos, asn1_dec_int(ctrl, "characterSet", tag, pos, seq_end, &value));
name->char_set = value;
} else {
name->char_set = 1; /* default to iso8859-1 */
}
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
return pos;
}
/*!
* \brief Decode the Q.SIG Name argument parameters.
*
* \param ctrl D channel controller for any diagnostic messages.
* \param fname Field name
* \param tag Component tag that identified this production.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param name Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_Name(struct pri *ctrl, const char *fname,
unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseQsigName *name)
{
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s Name\n", fname);
}
name->char_set = 1; /* default to iso8859-1 */
switch (tag & ~ASN1_PC_MASK) {
case ASN1_CLASS_CONTEXT_SPECIFIC | 0:
name->presentation = 1; /* presentation_allowed */
ASN1_CALL(pos, rose_dec_qsig_NameData(ctrl, "namePresentationAllowedSimple", tag,
pos, end, name));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 1:
/* Must be constructed but we will not check for it for simplicity. */
name->presentation = 1; /* presentation_allowed */
ASN1_CALL(pos, rose_dec_qsig_NameSet(ctrl, "namePresentationAllowedExtended",
tag, pos, end, name));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 2:
name->presentation = 2; /* presentation_restricted */
ASN1_CALL(pos, rose_dec_qsig_NameData(ctrl, "namePresentationRestrictedSimple",
tag, pos, end, name));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 3:
/* Must be constructed but we will not check for it for simplicity. */
name->presentation = 2; /* presentation_restricted */
ASN1_CALL(pos, rose_dec_qsig_NameSet(ctrl, "namePresentationRestrictedExtended",
tag, pos, end, name));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 4:
/* Must not be constructed but we will not check for it for simplicity. */
name->presentation = 4; /* name_not_available */
name->length = 0;
name->data[0] = 0;
ASN1_CALL(pos, asn1_dec_null(ctrl, "nameNotAvailable", tag, pos, end));
break;
case ASN1_CLASS_CONTEXT_SPECIFIC | 7:
/* Must not be constructed but we will not check for it for simplicity. */
name->presentation = 3; /* presentation_restricted_null */
name->length = 0;
name->data[0] = 0;
ASN1_CALL(pos, asn1_dec_null(ctrl, "namePresentationRestrictedNull", tag, pos,
end));
break;
default:
ASN1_DID_NOT_EXPECT_TAG(ctrl, tag);
return NULL;
}
return pos;
}
/*!
* \internal
* \brief Decode the Q.SIG party-Name invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param name Field name
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param party Parameter storage to fill.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
static const unsigned char *rose_dec_qsig_PartyName_ARG_Backend(struct pri *ctrl,
const char *name, unsigned tag, const unsigned char *pos, const unsigned char *end,
struct roseQsigPartyName_ARG *party)
{
int length;
int seq_offset;
const unsigned char *seq_end;
if (tag == ASN1_TAG_SEQUENCE) {
if (ctrl->debug & PRI_DEBUG_APDU) {
pri_message(ctrl, " %s %s\n", name, asn1_tag2str(tag));
}
ASN1_CALL(pos, asn1_dec_length(pos, end, &length));
ASN1_END_SETUP(seq_end, seq_offset, length, pos, end);
ASN1_CALL(pos, asn1_dec_tag(pos, seq_end, &tag));
ASN1_CALL(pos, rose_dec_qsig_Name(ctrl, "name", tag, pos, seq_end,
&party->name));
/* Fixup will skip over any OPTIONAL manufacturer extension information */
ASN1_END_FIXUP(ctrl, pos, seq_offset, seq_end, end);
} else {
ASN1_CALL(pos, rose_dec_qsig_Name(ctrl, name, tag, pos, end, &party->name));
}
return pos;
}
/*!
* \brief Decode the Q.SIG CallingName invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_CallingName_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
return rose_dec_qsig_PartyName_ARG_Backend(ctrl, "callingName", tag, pos, end,
&args->qsig.CallingName);
}
/*!
* \brief Decode the Q.SIG CalledName invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_CalledName_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
return rose_dec_qsig_PartyName_ARG_Backend(ctrl, "calledName", tag, pos, end,
&args->qsig.CalledName);
}
/*!
* \brief Decode the Q.SIG ConnectedName invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_ConnectedName_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
return rose_dec_qsig_PartyName_ARG_Backend(ctrl, "connectedName", tag, pos, end,
&args->qsig.ConnectedName);
}
/*!
* \brief Decode the Q.SIG BusyName invoke argument parameters.
*
* \param ctrl D channel controller for diagnostic messages or global options.
* \param tag Component tag that identified this structure.
* \param pos Starting position of the ASN.1 component length.
* \param end End of ASN.1 decoding data buffer.
* \param args Arguments to fill in from the decoded buffer.
*
* \retval Start of the next ASN.1 component on success.
* \retval NULL on error.
*/
const unsigned char *rose_dec_qsig_BusyName_ARG(struct pri *ctrl, unsigned tag,
const unsigned char *pos, const unsigned char *end, union rose_msg_invoke_args *args)
{
return rose_dec_qsig_PartyName_ARG_Backend(ctrl, "busyName", tag, pos, end,
&args->qsig.BusyName);
}
/* ------------------------------------------------------------------- */
/* end rose_qsig_name.c */

2587
rosetest.c Normal file

File diff suppressed because it is too large Load Diff

108
testprilib.c Executable file → Normal file
View File

@@ -1,27 +1,33 @@
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <markster@linux-support.net>
* Written by Mark Spencer <markster@digium.com>
*
* Copyright (C) 2001, Linux Support Services, Inc.
* Copyright (C) 2001-2005, Digium, Inc.
* All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify
* 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.
*
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*
* This program tests libpri call reception using a zaptel interface.
* Its state machines are setup for RECEIVING CALLS ONLY, so if you
@@ -42,11 +48,18 @@
#include <sys/time.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <linux/zaptel.h>
#include <zaptel/zaptel.h>
#ifndef SOLARIS
#include <zap.h>
#endif
#include <pthread.h>
#include <sys/select.h>
#include "libpri.h"
#include "pri_q931.h"
#ifndef AF_LOCAL
#define AF_LOCAL AF_UNIX
#endif
#define DEBUG_LEVEL PRI_DEBUG_ALL
@@ -57,7 +70,7 @@ static struct pri *first, *cur;
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
#define TEST_CALLS 32
#define TEST_CALLS 1
static void event1(struct pri *pri, pri_event *e)
{
@@ -74,14 +87,40 @@ static void event1(struct pri *pri, pri_event *e)
sprintf(dest, "60%02d", x + 1);
if (!(calls[x] = pri_new_call(pri))) {
perror("pri_new_call");
} else if (pri_call(pri, calls[x], PRI_TRANS_CAP_DIGITAL, x + 1, 1, 1, num,
continue;
}
#if 0
{
struct pri_sr *sr;
sr = pri_sr_new();
pri_sr_set_channel(sr, x+1, 0, 0);
pri_sr_set_bearer(sr, 0, PRI_LAYER_1_ULAW);
pri_sr_set_called(sr, dest, PRI_NATIONAL_ISDN, 1);
pri_sr_set_caller(sr, num, name, PRI_NATIONAL_ISDN, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
pri_sr_set_redirecting(sr, num, PRI_NATIONAL_ISDN, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
if (pri_setup(pri, calls[x], sr))
perror("pri_setup");
pri_sr_free(sr);
}
#else
if (pri_call(pri, calls[x], PRI_TRANS_CAP_DIGITAL, x + 1, 1, 1, num,
PRI_NATIONAL_ISDN, name, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN,
dest, PRI_NATIONAL_ISDN, PRI_LAYER_1_ULAW)) {
perror("pri_call");
}
#endif
}
printf("Setup %d calls!\n", TEST_CALLS);
break;
case PRI_EVENT_RINGING:
printf("PRI 1: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
q931_facility(pri, e->ringing.call);
pri_answer(pri, e->ringing.call, e->ringing.channel, 0);
break;
case PRI_EVENT_HANGUP_REQ:
printf("PRI 1: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
pri_hangup(pri, e->hangup.call, e->hangup.cause);
break;
default:
printf("PRI 1: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
}
@@ -91,13 +130,26 @@ static void event2(struct pri *pri, pri_event *e)
{
/* CPE */
switch(e->gen.e) {
case PRI_EVENT_RING:
printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
pri_proceeding(pri, e->ring.call, e->ring.channel, 0);
pri_acknowledge(pri, e->ring.call, e->ring.channel, 0);
break;
case PRI_EVENT_ANSWER:
printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
pri_hangup(pri, e->answer.call, PRI_CAUSE_NORMAL_UNSPECIFIED);
break;
case PRI_EVENT_HANGUP:
printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
pri_hangup(pri, e->hangup.call, e->hangup.cause);
break;
case PRI_EVENT_DCHAN_UP:
default:
printf("PRI 2: %s (%d)\n", pri_event2str(e->gen.e), e->gen.e);
}
}
static void testmsg(char *s)
static void testmsg(struct pri *pri, char *s)
{
char *c;
static int keeplast = 0;
@@ -123,7 +175,7 @@ static void testmsg(char *s)
keeplast = 0;
}
static void testerr(char *s)
static void testerr(struct pri *pri, char *s)
{
char *c;
static int keeplast = 0;
@@ -159,7 +211,7 @@ static void *dchan(void *data)
fd_set fds;
int res;
for(;;) {
if (next == pri_schedule_next(pri)) {
if ((next = pri_schedule_next(pri))) {
gettimeofday(&tv, NULL);
tv.tv_sec = next->tv_sec - tv.tv_sec;
tv.tv_usec = next->tv_usec - tv.tv_usec;
@@ -186,9 +238,9 @@ static void *dchan(void *data)
}
if (e) {
if (first == pri) {
event1(pri, e);
event1(e->gen.pri, e);
} else {
event2(pri, e);
event2(e->gen.pri, e);
}
}
pthread_mutex_unlock(&lock);
@@ -208,21 +260,23 @@ int main(int argc, char *argv[])
perror("socketpair");
exit(1);
}
if (!(pri = pri_new(pair[0], PRI_NETWORK, PRI_DEF_SWITCHTYPE))) {
if (!(pri = pri_new_bri(pair[0], 0, PRI_NETWORK, PRI_DEF_SWITCHTYPE))) {
perror("pri(0)");
exit(1);
}
first = pri;
pri_set_debug(pri, DEBUG_LEVEL);
pri_facility_enable(pri);
if (pthread_create(&tmp, NULL, dchan, pri)) {
perror("thread(0)");
exit(1);
}
if (!(pri = pri_new(pair[1], PRI_CPE, PRI_DEF_SWITCHTYPE))) {
if (!(pri = pri_new_bri(pair[1], 0, PRI_CPE, PRI_DEF_SWITCHTYPE))) {
perror("pri(1)");
exit(1);
}
pri_set_debug(pri, DEBUG_LEVEL);
pri_facility_enable(pri);
if (pthread_create(&tmp, NULL, dchan, pri)) {
perror("thread(1)");
exit(1);